diff options
author | Joas Schilling <coding@schilljs.com> | 2016-11-29 15:56:22 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-11-29 16:08:58 +0100 |
commit | 8d87e39146e0a657b2fecdae2f4e12dbc2368061 (patch) | |
tree | 52df784e81a4a4cea80bdc2d27944743a3bcd54a /apps/dav/lib | |
parent | 9b62302f7dc5666a73d6b44787bbc2b943a969d5 (diff) | |
download | nextcloud-server-8d87e39146e0a657b2fecdae2f4e12dbc2368061.tar.gz nextcloud-server-8d87e39146e0a657b2fecdae2f4e12dbc2368061.zip |
Deduplicate icon assignment
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/CalDAV/Activity/Provider/Calendar.php | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php index 2307c2048e0..05881866ce6 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php @@ -81,63 +81,48 @@ class Calendar implements IProvider { * @since 11.0.0 */ public function parse(IEvent $event, IEvent $previousEvent = null) { - if ($event->getApp() !== 'dav') { + if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar') { throw new \InvalidArgumentException(); } + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); + if ($event->getSubject() === self::SUBJECT_ADD) { $subject = $this->l->t('{actor} created calendar {calendar}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_ADD . '_self') { $subject = $this->l->t('You created calendar {calendar}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_DELETE) { $subject = $this->l->t('{actor} deleted calendar {calendar}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_DELETE . '_self') { $subject = $this->l->t('You deleted calendar {calendar}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_UPDATE) { $subject = $this->l->t('{actor} updated calendar {calendar}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_UPDATE . '_self') { $subject = $this->l->t('You updated calendar {calendar}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_SHARE_USER) { $subject = $this->l->t('{actor} shared calendar {calendar} with you'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_SHARE_USER . '_you') { $subject = $this->l->t('You shared calendar {calendar} with {user}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_SHARE_USER . '_by') { $subject = $this->l->t('{actor} shared calendar {calendar} with {user}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER) { $subject = $this->l->t('{actor} unshared calendar {calendar} from you'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_you') { $subject = $this->l->t('You unshared calendar {calendar} from {user}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_by') { $subject = $this->l->t('{actor} unshared calendar {calendar} from {user}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_self') { $subject = $this->l->t('{actor} unshared calendar {calendar} from themselves'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_you') { $subject = $this->l->t('You shared calendar {calendar} with group {group}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_by') { $subject = $this->l->t('{actor} shared calendar {calendar} with group {group}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_you') { $subject = $this->l->t('You unshared calendar {calendar} from group {group}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else if ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_by') { $subject = $this->l->t('{actor} unshared calendar {calendar} from group {group}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); } else { throw new \InvalidArgumentException(); } |