Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
B
Backend Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SpinShare
Backend Server
Commits
fef91f16
Commit
fef91f16
authored
Aug 22, 2020
by
SpinShare
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added notification for cards
parent
2c3e52f1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
0 deletions
+35
-0
src/Controller/Moderation/CardsController.php
src/Controller/Moderation/CardsController.php
+10
-0
src/Controller/NotificationController.php
src/Controller/NotificationController.php
+4
-0
src/Entity/UserNotification.php
src/Entity/UserNotification.php
+17
-0
templates/base.html.twig
templates/base.html.twig
+4
-0
No files found.
src/Controller/Moderation/CardsController.php
View file @
fef91f16
...
@@ -15,6 +15,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
...
@@ -15,6 +15,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use
App\Entity\Card
;
use
App\Entity\Card
;
use
App\Entity\User
;
use
App\Entity\User
;
use
App\Entity\UserCard
;
use
App\Entity\UserCard
;
use
App\Entity\UserNotification
;
class
CardsController
extends
AbstractController
class
CardsController
extends
AbstractController
{
{
...
@@ -63,6 +64,15 @@ class CardsController extends AbstractController
...
@@ -63,6 +64,15 @@ class CardsController extends AbstractController
$newUserCard
->
setGivenDate
(
new
\DateTime
());
$newUserCard
->
setGivenDate
(
new
\DateTime
());
$em
->
persist
(
$newUserCard
);
$em
->
persist
(
$newUserCard
);
$newNotification
=
new
UserNotification
();
$newNotification
->
setUser
(
$user
);
$newNotification
->
setNotificationType
(
3
);
$newNotification
->
setNotificationData
(
""
);
$newNotification
->
setConnectedCard
(
$newUserCard
->
getCard
());
$newNotification
->
setConnectedUser
(
$user
);
$em
->
persist
(
$newNotification
);
$em
->
flush
();
$em
->
flush
();
}
}
...
...
src/Controller/NotificationController.php
View file @
fef91f16
...
@@ -42,6 +42,10 @@ class NotificationController extends AbstractController
...
@@ -42,6 +42,10 @@ class NotificationController extends AbstractController
// SpinPlay
// SpinPlay
return
$this
->
redirectToRoute
(
'song.detail'
,
[
'songId'
=>
$notificationToClear
->
getConnectedSong
()
->
getId
(),
'tab'
=>
'spinplays'
]);
return
$this
->
redirectToRoute
(
'song.detail'
,
[
'songId'
=>
$notificationToClear
->
getConnectedSong
()
->
getId
(),
'tab'
=>
'spinplays'
]);
break
;
break
;
case
3
:
// Card
return
$this
->
redirectToRoute
(
'user.detail'
,
[
'userId'
=>
$notificationToClear
->
getConnectedUser
()
->
getId
()]);
break
;
}
}
}
else
{
}
else
{
$returnUrl
=
$request
->
query
->
get
(
'returnUrl'
);
$returnUrl
=
$request
->
query
->
get
(
'returnUrl'
);
...
...
src/Entity/UserNotification.php
View file @
fef91f16
...
@@ -41,6 +41,11 @@ class UserNotification
...
@@ -41,6 +41,11 @@ class UserNotification
*/
*/
private
$connectedUser
;
private
$connectedUser
;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Card")
*/
private
$connectedCard
;
public
function
getId
()
:
?
int
public
function
getId
()
:
?
int
{
{
return
$this
->
id
;
return
$this
->
id
;
...
@@ -105,4 +110,16 @@ class UserNotification
...
@@ -105,4 +110,16 @@ class UserNotification
return
$this
;
return
$this
;
}
}
public
function
getConnectedCard
()
:
?
Card
{
return
$this
->
connectedCard
;
}
public
function
setConnectedCard
(
?
Card
$connectedCard
)
:
self
{
$this
->
connectedCard
=
$connectedCard
;
return
$this
;
}
}
}
templates/base.html.twig
View file @
fef91f16
...
@@ -73,6 +73,8 @@
...
@@ -73,6 +73,8 @@
<div
class=
"notification-icon"
>
<div
class=
"notification-icon"
>
{%
if
notification.notificationType
==
0
%}
{%
if
notification.notificationType
==
0
%}
<i
class=
"mdi mdi-server"
></i>
<i
class=
"mdi mdi-server"
></i>
{%
elseif
notification.notificationType
==
3
%}
<div
class=
"cover"
style=
"background-image: url(
{{
asset
(
"uploads/card/"
~
notification.connectedCard.icon
)
}}
);"
></div>
{%
else
%}
{%
else
%}
<div
class=
"cover"
style=
"background-image: url(
{{
asset
(
"uploads/thumbnail/"
~
notification.connectedSong.fileReference
~
".jpg?v="
~
date
()
.
timestamp
)
}}
), url(
{{
asset
(
"assets/img/defaultAlbumArt.jpg"
)
}}
);"
></div>
<div
class=
"cover"
style=
"background-image: url(
{{
asset
(
"uploads/thumbnail/"
~
notification.connectedSong.fileReference
~
".jpg?v="
~
date
()
.
timestamp
)
}}
), url(
{{
asset
(
"assets/img/defaultAlbumArt.jpg"
)
}}
);"
></div>
{%
endif
%}
{%
endif
%}
...
@@ -84,6 +86,8 @@
...
@@ -84,6 +86,8 @@
<strong>
{{
notification.connectedUser.username
}}
</strong>
reviewed your chart
<strong>
{{
notification.connectedSong.title
}}
</strong>
.
<strong>
{{
notification.connectedUser.username
}}
</strong>
reviewed your chart
<strong>
{{
notification.connectedSong.title
}}
</strong>
.
{%
elseif
notification.notificationType
==
2
%}
{%
elseif
notification.notificationType
==
2
%}
<strong>
{{
notification.connectedUser.username
}}
</strong>
added a SpinPlay to your chart
<strong>
{{
notification.connectedSong.title
}}
</strong>
.
<strong>
{{
notification.connectedUser.username
}}
</strong>
added a SpinPlay to your chart
<strong>
{{
notification.connectedSong.title
}}
</strong>
.
{%
elseif
notification.notificationType
==
3
%}
You've received the profile card
<strong>
{{
notification.connectedCard.title
}}
</strong>
.
{%
endif
%}
{%
endif
%}
</div>
</div>
</a>
</a>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment