aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2019-08-26 12:58:51 +0200
committerGitHub <noreply@github.com>2019-08-26 12:58:51 +0200
commitb1a0d464ba599e32936f284e7bdba0bf246ab70c (patch)
tree3f79e491eb6933fe3c2b5b01f0ae5e0c4c1e58bc /apps
parent40edabaf6170e74d319d11585b673316348e1ff3 (diff)
parentb557f52c2290379b99838f86c7ab90892b955b41 (diff)
downloadnextcloud-server-b1a0d464ba599e32936f284e7bdba0bf246ab70c.tar.gz
nextcloud-server-b1a0d464ba599e32936f284e7bdba0bf246ab70c.zip
Merge pull request #16723 from nextcloud/fix/sharing/unshare-message
Add expiration event for shares
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/Activity/Providers/Groups.php8
-rw-r--r--apps/files_sharing/lib/Activity/Providers/Users.php14
2 files changed, 21 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/Activity/Providers/Groups.php b/apps/files_sharing/lib/Activity/Providers/Groups.php
index 10f52882aeb..9585646491c 100644
--- a/apps/files_sharing/lib/Activity/Providers/Groups.php
+++ b/apps/files_sharing/lib/Activity/Providers/Groups.php
@@ -35,9 +35,12 @@ class Groups extends Base {
const SUBJECT_SHARED_GROUP_SELF = 'shared_group_self';
const SUBJECT_RESHARED_GROUP_BY = 'reshared_group_by';
+
const SUBJECT_UNSHARED_GROUP_SELF = 'unshared_group_self';
const SUBJECT_UNSHARED_GROUP_BY = 'unshared_group_by';
+ const SUBJECT_EXPIRED_GROUP = 'expired_group';
+
/** @var IGroupManager */
protected $groupManager;
@@ -73,6 +76,8 @@ class Groups extends Base {
$subject = $this->l->t('{actor} shared with group {group}');
} else if ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_BY) {
$subject = $this->l->t('{actor} removed share for group {group}');
+ } else if ($event->getSubject() === self::SUBJECT_EXPIRED_GROUP) {
+ $subject = $this->l->t('Share for group {group} expired');
} else {
throw new \InvalidArgumentException();
}
@@ -104,6 +109,8 @@ class Groups extends Base {
$subject = $this->l->t('{actor} shared {file} with group {group}');
} else if ($event->getSubject() === self::SUBJECT_UNSHARED_GROUP_BY) {
$subject = $this->l->t('{actor} removed group {group} from {file}');
+ } else if ($event->getSubject() === self::SUBJECT_EXPIRED_GROUP) {
+ $subject = $this->l->t('Share for file {file} with group {group} expired');
} else {
throw new \InvalidArgumentException();
}
@@ -132,6 +139,7 @@ class Groups extends Base {
];
case self::SUBJECT_SHARED_GROUP_SELF:
case self::SUBJECT_UNSHARED_GROUP_SELF:
+ case self::SUBJECT_EXPIRED_GROUP:
return [
'file' => $this->getFile($parameters[0], $event),
'group' => $this->generateGroupParameter($parameters[1]),
diff --git a/apps/files_sharing/lib/Activity/Providers/Users.php b/apps/files_sharing/lib/Activity/Providers/Users.php
index 61f169fd092..8f30f2cdc08 100644
--- a/apps/files_sharing/lib/Activity/Providers/Users.php
+++ b/apps/files_sharing/lib/Activity/Providers/Users.php
@@ -38,6 +38,9 @@ class Users extends Base {
const SUBJECT_SELF_UNSHARED = 'self_unshared';
const SUBJECT_SELF_UNSHARED_BY = 'self_unshared_by';
+ const SUBJECT_EXPIRED_USER = 'expired_user';
+ const SUBJECT_EXPIRED = 'expired';
+
/**
* @param IEvent $event
* @return IEvent
@@ -63,7 +66,10 @@ class Users extends Base {
$subject = $this->l->t('Shared by {actor}');
} else if ($event->getSubject() === self::SUBJECT_UNSHARED_BY) {
$subject = $this->l->t('{actor} removed share');
-
+ } else if ($event->getSubject() === self::SUBJECT_EXPIRED_USER) {
+ $subject = $this->l->t('Share for {user} expired');
+ } else if ($event->getSubject() === self::SUBJECT_EXPIRED) {
+ $subject = $this->l->t('Share expired');
} else {
throw new \InvalidArgumentException();
}
@@ -103,6 +109,10 @@ class Users extends Base {
$subject = $this->l->t('{actor} shared {file} with you');
} else if ($event->getSubject() === self::SUBJECT_UNSHARED_BY) {
$subject = $this->l->t('{actor} removed you from the share named {file}');
+ } else if ($event->getSubject() === self::SUBJECT_EXPIRED_USER) {
+ $subject = $this->l->t('Share for file {file} with {user} expired');
+ } else if ($event->getSubject() === self::SUBJECT_EXPIRED) {
+ $subject = $this->l->t('Share for file {file} expired');
} else {
throw new \InvalidArgumentException();
@@ -125,6 +135,8 @@ class Users extends Base {
switch ($subject) {
case self::SUBJECT_SHARED_USER_SELF:
case self::SUBJECT_UNSHARED_USER_SELF:
+ case self::SUBJECT_EXPIRED_USER:
+ case self::SUBJECT_EXPIRED:
return [
'file' => $this->getFile($parameters[0], $event),
'user' => $this->getUser($parameters[1]),