Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
phonetrack-oc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Julien Veyssier
phonetrack-oc
Commits
a9648a76
Commit
a9648a76
authored
6 years ago
by
Julien Veyssier
Browse files
Options
Downloads
Patches
Plain Diff
refs
#179
NC notification to A when B adds/deletes a session share to A
parent
85de89b8
No related branches found
No related tags found
No related merge requests found
Pipeline
#38944169
passed
6 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
controller/pagecontroller.php
+46
-0
46 additions, 0 deletions
controller/pagecontroller.php
lib/Notification/Notifier.php
+16
-0
16 additions, 0 deletions
lib/Notification/Notifier.php
with
62 additions
and
0 deletions
controller/pagecontroller.php
+
46
−
0
View file @
a9648a76
...
...
@@ -3284,6 +3284,29 @@ class PageController extends Controller {
$req
->
closeCursor
();
$ok
=
1
;
// SEND NOTIFICATION
$manager
=
\OC
::
$server
->
getNotificationManager
();
$notification
=
$manager
->
createNotification
();
$acceptAction
=
$notification
->
createAction
();
$acceptAction
->
setLabel
(
'accept'
)
->
setLink
(
'/apps/phonetrack'
,
'GET'
);
$declineAction
=
$notification
->
createAction
();
$declineAction
->
setLabel
(
'decline'
)
->
setLink
(
'/apps/phonetrack'
,
'GET'
);
$notification
->
setApp
(
'phonetrack'
)
->
setUser
(
$username
)
->
setDateTime
(
new
\DateTime
())
->
setObject
(
'addusershare'
,
$dbtoken
)
->
setSubject
(
'add_user_share'
,
[
$this
->
userId
,
$dbname
])
->
addAction
(
$acceptAction
)
->
addAction
(
$declineAction
)
;
$manager
->
notify
(
$notification
);
}
else
{
$ok
=
2
;
...
...
@@ -3429,6 +3452,29 @@ class PageController extends Controller {
$req
->
closeCursor
();
$ok
=
1
;
// SEND NOTIFICATION
$manager
=
\OC
::
$server
->
getNotificationManager
();
$notification
=
$manager
->
createNotification
();
$acceptAction
=
$notification
->
createAction
();
$acceptAction
->
setLabel
(
'accept'
)
->
setLink
(
'/apps/phonetrack'
,
'GET'
);
$declineAction
=
$notification
->
createAction
();
$declineAction
->
setLabel
(
'decline'
)
->
setLink
(
'/apps/phonetrack'
,
'GET'
);
$notification
->
setApp
(
'phonetrack'
)
->
setUser
(
$username
)
->
setDateTime
(
new
\DateTime
())
->
setObject
(
'deleteusershare'
,
$dbtoken
)
->
setSubject
(
'delete_user_share'
,
[
$this
->
userId
,
$dbname
])
->
addAction
(
$acceptAction
)
->
addAction
(
$declineAction
)
;
$manager
->
notify
(
$notification
);
}
else
{
$ok
=
2
;
...
...
This diff is collapsed.
Click to expand it.
lib/Notification/Notifier.php
+
16
−
0
View file @
a9648a76
...
...
@@ -100,6 +100,22 @@ class Notifier implements INotifier {
->
setLink
(
$this
->
url
->
linkToRouteAbsolute
(
'phonetrack.page.index'
));
return
$notification
;
case
'add_user_share'
:
$p
=
$notification
->
getSubjectParameters
();
$content
=
$l
->
t
(
'User "%s" shared PhoneTrack session "%s" with you.'
,
[
$p
[
0
],
$p
[
1
]]);
$notification
->
setParsedSubject
(
$content
)
->
setLink
(
$this
->
url
->
linkToRouteAbsolute
(
'phonetrack.page.index'
));
return
$notification
;
case
'delete_user_share'
:
$p
=
$notification
->
getSubjectParameters
();
$content
=
$l
->
t
(
'User "%s" stopped sharing PhoneTrack session "%s" with you.'
,
[
$p
[
0
],
$p
[
1
]]);
$notification
->
setParsedSubject
(
$content
)
->
setLink
(
$this
->
url
->
linkToRouteAbsolute
(
'phonetrack.page.index'
));
return
$notification
;
default
:
// Unknown subject => Unknown notification => throw
throw
new
\InvalidArgumentException
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment