Skip to content

Commit

Permalink
Allow Activity registers actions of share and unshare for circles nex…
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsl authored and fgsl committed May 11, 2018
1 parent 58e4ddd commit c863078
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions apps/files_sharing/lib/Activity/Providers/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class Groups extends Base {
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_SHARED_CIRCLE_SELF = 'shared_circle_self';
const SUBJECT_UNSHARED_CIRCLE_SELF = 'unshared_circle_self';
const SUBJECT_RESHARED_CIRCLE_BY = 'reshared_circle_by';
const SUBJECT_UNSHARED_CIRCLE_BY = 'unshared_circle_by';

/** @var IGroupManager */
protected $groupManager;
Expand Down Expand Up @@ -73,6 +77,14 @@ public function parseShortVersion(IEvent $event) {
$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_SHARED_CIRCLE_SELF) {
$subject = $this->l->t('Shared with circle {circle}');
} else if ($event->getSubject() === self::SUBJECT_UNSHARED_CIRCLE_SELF) {
$subject = $this->l->t('Removed share for circle {circle}');
} else if ($event->getSubject() === self::SUBJECT_RESHARED_CIRCLE_BY) {
$subject = $this->l->t('{actor} shared with circle {circle}');
} else if ($event->getSubject() === self::SUBJECT_UNSHARED_CIRCLE_BY) {
$subject = $this->l->t('{actor} removed share for circle {circle}');
} else {
throw new \InvalidArgumentException();
}
Expand Down Expand Up @@ -104,6 +116,14 @@ public function parseLongVersion(IEvent $event) {
$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_SHARED_CIRCLE_SELF) {
$subject = $this->l->t('You shared {file} with circle {circle}');
} else if ($event->getSubject() === self::SUBJECT_UNSHARED_CIRCLE_SELF) {
$subject = $this->l->t('You removed circle {circle} from {file}');
} else if ($event->getSubject() === self::SUBJECT_RESHARED_CIRCLE_BY) {
$subject = $this->l->t('{actor} shared {file} with circle {circle}');
} else if ($event->getSubject() === self::SUBJECT_UNSHARED_CIRCLE_BY) {
$subject = $this->l->t('{actor} removed circle {circle} from {file}');
} else {
throw new \InvalidArgumentException();
}
Expand Down Expand Up @@ -136,6 +156,29 @@ protected function getParsedParameters(IEvent $event) {
'file' => $this->getFile($parameters[0], $event),
'group' => $this->generateGroupParameter($parameters[1]),
];
case self::SUBJECT_SHARED_CIRCLE_SELF:
case self::SUBJECT_UNSHARED_CIRCLE_SELF:
$circle = \OCA\Circles\Api\v1\Circles::detailsCircle($parameters[1]);
return [
'file' => $this->getFile($parameters[0], $event),
'circle' => [
'type' => 'circle',
'id' => $parameters[1],
'name' => $circle->getName(),
],
];
case self::SUBJECT_RESHARED_CIRCLE_BY:
case self::SUBJECT_UNSHARED_CIRCLE_BY:
$circle = \OCA\Circles\Api\v1\Circles::detailsCircle($parameters[2]);
return [
'file' => $this->getFile($parameters[0], $event),
'circle' => [
'type' => 'circle',
'id' => $parameters[2],
'name' => $parameters[2],
],
'actor' => $this->getUser($parameters[1]),
];
}
return [];
}
Expand Down

0 comments on commit c863078

Please sign in to comment.