diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-07-07 11:05:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-07 11:05:00 +0200 |
commit | b4deba207856e92adfbf7239ea7d2420157993dd (patch) | |
tree | 22bc71158a91e74e1d28c639c0801a735a78db76 /apps/files | |
parent | b1520a645833c2047103a2cf550f5c21b1c25586 (diff) | |
parent | ca3a6ec6077e4248d56550b1acb19ab72546e808 (diff) | |
download | nextcloud-server-b4deba207856e92adfbf7239ea7d2420157993dd.tar.gz nextcloud-server-b4deba207856e92adfbf7239ea7d2420157993dd.zip |
Merge pull request #5483 from nextcloud/issue-5075-png-files-for-activity-emails
Use PNGs for icons in activity emails
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/img/add-color.png | bin | 0 -> 4217 bytes | |||
-rw-r--r-- | apps/files/img/change.png | bin | 0 -> 4217 bytes | |||
-rw-r--r-- | apps/files/img/delete-color.png | bin | 0 -> 4217 bytes | |||
-rw-r--r-- | apps/files/lib/Activity/FavoriteProvider.php | 28 | ||||
-rw-r--r-- | apps/files/lib/Activity/Provider.php | 96 |
5 files changed, 102 insertions, 22 deletions
diff --git a/apps/files/img/add-color.png b/apps/files/img/add-color.png Binary files differnew file mode 100644 index 00000000000..2211eb6e0bc --- /dev/null +++ b/apps/files/img/add-color.png diff --git a/apps/files/img/change.png b/apps/files/img/change.png Binary files differnew file mode 100644 index 00000000000..1465882d72e --- /dev/null +++ b/apps/files/img/change.png diff --git a/apps/files/img/delete-color.png b/apps/files/img/delete-color.png Binary files differnew file mode 100644 index 00000000000..1d563db1c8d --- /dev/null +++ b/apps/files/img/delete-color.png diff --git a/apps/files/lib/Activity/FavoriteProvider.php b/apps/files/lib/Activity/FavoriteProvider.php index 941579e730d..318ce66e672 100644 --- a/apps/files/lib/Activity/FavoriteProvider.php +++ b/apps/files/lib/Activity/FavoriteProvider.php @@ -97,11 +97,19 @@ class FavoriteProvider implements IProvider { public function parseShortVersion(IEvent $event) { if ($event->getSubject() === self::SUBJECT_ADDED) { - $event->setParsedSubject($this->l->t('Added to favorites')) - ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.svg'))); + $event->setParsedSubject($this->l->t('Added to favorites')); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.svg'))); + } } else if ($event->getSubject() === self::SUBJECT_REMOVED) { - $event->setParsedSubject($this->l->t('Removed from favorites')) - ->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star.svg'))); + $event->setParsedSubject($this->l->t('Removed from favorites')); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star.svg'))); + } } else { throw new \InvalidArgumentException(); } @@ -120,10 +128,18 @@ class FavoriteProvider implements IProvider { if ($event->getSubject() === self::SUBJECT_ADDED) { $subject = $this->l->t('You added {file} to your favorites'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/starred.svg'))); + } } else if ($event->getSubject() === self::SUBJECT_REMOVED) { $subject = $this->l->t('You removed {file} from your favorites'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star.svg'))); + } } else { throw new \InvalidArgumentException(); } diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php index c3289ed3703..736b930b7aa 100644 --- a/apps/files/lib/Activity/Provider.php +++ b/apps/files/lib/Activity/Provider.php @@ -110,21 +110,41 @@ class Provider implements IProvider { if ($event->getSubject() === 'created_by') { $subject = $this->l->t('Created by {user}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg'))); + } } else if ($event->getSubject() === 'changed_by') { $subject = $this->l->t('Changed by {user}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + } } else if ($event->getSubject() === 'deleted_by') { $subject = $this->l->t('Deleted by {user}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.svg'))); + } } else if ($event->getSubject() === 'restored_by') { $subject = $this->l->t('Restored by {user}'); } else if ($event->getSubject() === 'renamed_by') { $subject = $this->l->t('Renamed by {user}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + } } else if ($event->getSubject() === 'moved_by') { $subject = $this->l->t('Moved by {user}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + } } else { throw new \InvalidArgumentException(); } @@ -151,41 +171,85 @@ class Provider implements IProvider { if ($event->getSubject() === 'created_self') { $subject = $this->l->t('You created {file}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg'))); + } } else if ($event->getSubject() === 'created_by') { $subject = $this->l->t('{user} created {file}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg'))); + } } else if ($event->getSubject() === 'created_public') { $subject = $this->l->t('{file} was created in a public folder'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'add-color.svg'))); + } } else if ($event->getSubject() === 'changed_self') { $subject = $this->l->t('You changed {file}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + } } else if ($event->getSubject() === 'changed_by') { $subject = $this->l->t('{user} changed {file}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + } } else if ($event->getSubject() === 'deleted_self') { $subject = $this->l->t('You deleted {file}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.svg'))); + } } else if ($event->getSubject() === 'deleted_by') { $subject = $this->l->t('{user} deleted {file}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'delete-color.svg'))); + } } else if ($event->getSubject() === 'restored_self') { $subject = $this->l->t('You restored {file}'); } else if ($event->getSubject() === 'restored_by') { $subject = $this->l->t('{user} restored {file}'); } else if ($event->getSubject() === 'renamed_self') { $subject = $this->l->t('You renamed {oldfile} to {newfile}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + } } else if ($event->getSubject() === 'renamed_by') { $subject = $this->l->t('{user} renamed {oldfile} to {newfile}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + } } else if ($event->getSubject() === 'moved_self') { $subject = $this->l->t('You moved {oldfile} to {newfile}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + } } else if ($event->getSubject() === 'moved_by') { $subject = $this->l->t('{user} moved {oldfile} to {newfile}'); - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + if ($this->activityManager->getRequirePNG()) { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.png'))); + } else { + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('files', 'change.svg'))); + } } else { throw new \InvalidArgumentException(); } |