Merge pull request #5483 from nextcloud/issue-5075-png-files-for-activity-emails
Use PNGs for icons in activity emails
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="32" width="32" viewBox="0 0 32 32"><path fill="#000" d="M16 3C7.163 3 0 7.925 0 14s7.163 11 16 11c.5 0 .98-.032 1.47-.063L26 32v-9.406c3.658-2.017 6-5.12 6-8.595 0-6.076-7.164-11-16-11z"/></svg>
|
After Width: | Height: | Size: 243 B |
|
@ -87,7 +87,11 @@ class Provider implements IProvider {
|
||||||
|
|
||||||
if ($event->getSubject() === 'add_comment_subject') {
|
if ($event->getSubject() === 'add_comment_subject') {
|
||||||
$this->parseMessage($event);
|
$this->parseMessage($event);
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg')));
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->activityManager->isFormattingFilteredObject()) {
|
if ($this->activityManager->isFormattingFilteredObject()) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -84,7 +84,11 @@ class Calendar extends Base {
|
||||||
|
|
||||||
$this->l = $this->languageFactory->get('dav', $language);
|
$this->l = $this->languageFactory->get('dav', $language);
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')));
|
||||||
|
}
|
||||||
|
|
||||||
if ($event->getSubject() === self::SUBJECT_ADD) {
|
if ($event->getSubject() === self::SUBJECT_ADD) {
|
||||||
$subject = $this->l->t('{actor} created calendar {calendar}');
|
$subject = $this->l->t('{actor} created calendar {calendar}');
|
||||||
|
|
|
@ -80,7 +80,11 @@ class Event extends Base {
|
||||||
|
|
||||||
$this->l = $this->languageFactory->get('dav', $language);
|
$this->l = $this->languageFactory->get('dav', $language);
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')));
|
||||||
|
}
|
||||||
|
|
||||||
if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event') {
|
if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event') {
|
||||||
$subject = $this->l->t('{actor} created event {event} in calendar {calendar}');
|
$subject = $this->l->t('{actor} created event {event} in calendar {calendar}');
|
||||||
|
|
|
@ -40,7 +40,11 @@ class Todo extends Event {
|
||||||
|
|
||||||
$this->l = $this->languageFactory->get('dav', $language);
|
$this->l = $this->languageFactory->get('dav', $language);
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')));
|
||||||
|
}
|
||||||
|
|
||||||
if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') {
|
if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') {
|
||||||
$subject = $this->l->t('{actor} created todo {todo} in list {calendar}');
|
$subject = $this->l->t('{actor} created todo {todo} in list {calendar}');
|
||||||
|
|
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
|
@ -97,11 +97,19 @@ class FavoriteProvider implements IProvider {
|
||||||
public function parseShortVersion(IEvent $event) {
|
public function parseShortVersion(IEvent $event) {
|
||||||
|
|
||||||
if ($event->getSubject() === self::SUBJECT_ADDED) {
|
if ($event->getSubject() === self::SUBJECT_ADDED) {
|
||||||
$event->setParsedSubject($this->l->t('Added to favorites'))
|
$event->setParsedSubject($this->l->t('Added to favorites'));
|
||||||
->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) {
|
} else if ($event->getSubject() === self::SUBJECT_REMOVED) {
|
||||||
$event->setParsedSubject($this->l->t('Removed from favorites'))
|
$event->setParsedSubject($this->l->t('Removed from favorites'));
|
||||||
->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 {
|
} else {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
@ -120,10 +128,18 @@ class FavoriteProvider implements IProvider {
|
||||||
|
|
||||||
if ($event->getSubject() === self::SUBJECT_ADDED) {
|
if ($event->getSubject() === self::SUBJECT_ADDED) {
|
||||||
$subject = $this->l->t('You added {file} to your favorites');
|
$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) {
|
} else if ($event->getSubject() === self::SUBJECT_REMOVED) {
|
||||||
$subject = $this->l->t('You removed {file} from your favorites');
|
$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 {
|
} else {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,21 +110,41 @@ class Provider implements IProvider {
|
||||||
|
|
||||||
if ($event->getSubject() === 'created_by') {
|
if ($event->getSubject() === 'created_by') {
|
||||||
$subject = $this->l->t('Created by {user}');
|
$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') {
|
} else if ($event->getSubject() === 'changed_by') {
|
||||||
$subject = $this->l->t('Changed by {user}');
|
$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') {
|
} else if ($event->getSubject() === 'deleted_by') {
|
||||||
$subject = $this->l->t('Deleted by {user}');
|
$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') {
|
} else if ($event->getSubject() === 'restored_by') {
|
||||||
$subject = $this->l->t('Restored by {user}');
|
$subject = $this->l->t('Restored by {user}');
|
||||||
} else if ($event->getSubject() === 'renamed_by') {
|
} else if ($event->getSubject() === 'renamed_by') {
|
||||||
$subject = $this->l->t('Renamed by {user}');
|
$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') {
|
} else if ($event->getSubject() === 'moved_by') {
|
||||||
$subject = $this->l->t('Moved by {user}');
|
$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 {
|
} else {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
@ -151,41 +171,85 @@ class Provider implements IProvider {
|
||||||
|
|
||||||
if ($event->getSubject() === 'created_self') {
|
if ($event->getSubject() === 'created_self') {
|
||||||
$subject = $this->l->t('You created {file}');
|
$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') {
|
} else if ($event->getSubject() === 'created_by') {
|
||||||
$subject = $this->l->t('{user} created {file}');
|
$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') {
|
} else if ($event->getSubject() === 'created_public') {
|
||||||
$subject = $this->l->t('{file} was created in a public folder');
|
$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') {
|
} else if ($event->getSubject() === 'changed_self') {
|
||||||
$subject = $this->l->t('You changed {file}');
|
$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') {
|
} else if ($event->getSubject() === 'changed_by') {
|
||||||
$subject = $this->l->t('{user} changed {file}');
|
$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') {
|
} else if ($event->getSubject() === 'deleted_self') {
|
||||||
$subject = $this->l->t('You deleted {file}');
|
$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') {
|
} else if ($event->getSubject() === 'deleted_by') {
|
||||||
$subject = $this->l->t('{user} deleted {file}');
|
$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') {
|
} else if ($event->getSubject() === 'restored_self') {
|
||||||
$subject = $this->l->t('You restored {file}');
|
$subject = $this->l->t('You restored {file}');
|
||||||
} else if ($event->getSubject() === 'restored_by') {
|
} else if ($event->getSubject() === 'restored_by') {
|
||||||
$subject = $this->l->t('{user} restored {file}');
|
$subject = $this->l->t('{user} restored {file}');
|
||||||
} else if ($event->getSubject() === 'renamed_self') {
|
} else if ($event->getSubject() === 'renamed_self') {
|
||||||
$subject = $this->l->t('You renamed {oldfile} to {newfile}');
|
$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') {
|
} else if ($event->getSubject() === 'renamed_by') {
|
||||||
$subject = $this->l->t('{user} renamed {oldfile} to {newfile}');
|
$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') {
|
} else if ($event->getSubject() === 'moved_self') {
|
||||||
$subject = $this->l->t('You moved {oldfile} to {newfile}');
|
$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') {
|
} else if ($event->getSubject() === 'moved_by') {
|
||||||
$subject = $this->l->t('{user} moved {oldfile} to {newfile}');
|
$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 {
|
} else {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,11 @@ class Downloads extends Base {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/download.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/download.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/download.svg')));
|
||||||
|
}
|
||||||
$this->setSubjects($event, $subject, $parsedParameters);
|
$this->setSubjects($event, $subject, $parsedParameters);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
|
@ -76,7 +80,11 @@ class Downloads extends Base {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/download.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/download.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/download.svg')));
|
||||||
|
}
|
||||||
$this->setSubjects($event, $subject, $parsedParameters);
|
$this->setSubjects($event, $subject, $parsedParameters);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
|
|
|
@ -51,7 +51,11 @@ class Groups extends Base {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
$this->setSubjects($event, $subject, $parsedParameters);
|
$this->setSubjects($event, $subject, $parsedParameters);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
|
@ -78,7 +82,11 @@ class Groups extends Base {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
$this->setSubjects($event, $subject, $parsedParameters);
|
$this->setSubjects($event, $subject, $parsedParameters);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
|
|
|
@ -58,7 +58,11 @@ class PublicLinks extends Base {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
$this->setSubjects($event, $subject, $parsedParameters);
|
$this->setSubjects($event, $subject, $parsedParameters);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
|
@ -90,7 +94,11 @@ class PublicLinks extends Base {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
$this->setSubjects($event, $subject, $parsedParameters);
|
$this->setSubjects($event, $subject, $parsedParameters);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
|
|
|
@ -73,7 +73,11 @@ class RemoteShares extends Base {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
$this->setSubjects($event, $subject, $parsedParameters);
|
$this->setSubjects($event, $subject, $parsedParameters);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
|
@ -100,7 +104,11 @@ class RemoteShares extends Base {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
$this->setSubjects($event, $subject, $parsedParameters);
|
$this->setSubjects($event, $subject, $parsedParameters);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
|
|
|
@ -60,7 +60,11 @@ class Users extends Base {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
$this->setSubjects($event, $subject, $parsedParameters);
|
$this->setSubjects($event, $subject, $parsedParameters);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
|
@ -92,7 +96,11 @@ class Users extends Base {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
$this->setSubjects($event, $subject, $parsedParameters);
|
$this->setSubjects($event, $subject, $parsedParameters);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
|
|
|
@ -117,8 +117,12 @@ class Activity implements IProvider {
|
||||||
]))
|
]))
|
||||||
->setRichSubject($this->l->t('Shared with {email}'), [
|
->setRichSubject($this->l->t('Shared with {email}'), [
|
||||||
'email' => $parsedParameters['email'],
|
'email' => $parsedParameters['email'],
|
||||||
])
|
]);
|
||||||
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) {
|
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) {
|
||||||
$event->setParsedSubject($this->l->t('Shared with %1$s by %2$s', [
|
$event->setParsedSubject($this->l->t('Shared with %1$s by %2$s', [
|
||||||
$parsedParameters['email']['name'],
|
$parsedParameters['email']['name'],
|
||||||
|
@ -127,20 +131,32 @@ class Activity implements IProvider {
|
||||||
->setRichSubject($this->l->t('Shared with {email} by {actor}'), [
|
->setRichSubject($this->l->t('Shared with {email} by {actor}'), [
|
||||||
'email' => $parsedParameters['email'],
|
'email' => $parsedParameters['email'],
|
||||||
'actor' => $parsedParameters['actor'],
|
'actor' => $parsedParameters['actor'],
|
||||||
])
|
]);
|
||||||
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) {
|
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) {
|
||||||
$event->setParsedSubject($this->l->t('Password for mail share sent to %1$s', [
|
$event->setParsedSubject($this->l->t('Password for mail share sent to %1$s', [
|
||||||
$parsedParameters['email']['name']
|
$parsedParameters['email']['name']
|
||||||
]))
|
]))
|
||||||
->setRichSubject($this->l->t('Password for mail share sent to {email}'), [
|
->setRichSubject($this->l->t('Password for mail share sent to {email}'), [
|
||||||
'email' => $parsedParameters['email']
|
'email' => $parsedParameters['email']
|
||||||
])
|
]);
|
||||||
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) {
|
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) {
|
||||||
$event->setParsedSubject($this->l->t('Password for mail share sent to you'))
|
$event->setParsedSubject($this->l->t('Password for mail share sent to you'))
|
||||||
->setRichSubject($this->l->t('Password for mail share sent to you'))
|
->setRichSubject($this->l->t('Password for mail share sent to you'));
|
||||||
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
@ -162,29 +178,45 @@ class Activity implements IProvider {
|
||||||
$parsedParameters['file']['path'],
|
$parsedParameters['file']['path'],
|
||||||
$parsedParameters['email']['name'],
|
$parsedParameters['email']['name'],
|
||||||
]))
|
]))
|
||||||
->setRichSubject($this->l->t('You shared {file} with {email} by mail'), $parsedParameters)
|
->setRichSubject($this->l->t('You shared {file} with {email} by mail'), $parsedParameters);
|
||||||
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) {
|
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_BY) {
|
||||||
$event->setParsedSubject($this->l->t('%3$s shared %1$s with %2$s by mail', [
|
$event->setParsedSubject($this->l->t('%3$s shared %1$s with %2$s by mail', [
|
||||||
$parsedParameters['file']['path'],
|
$parsedParameters['file']['path'],
|
||||||
$parsedParameters['email']['name'],
|
$parsedParameters['email']['name'],
|
||||||
$parsedParameters['actor']['name'],
|
$parsedParameters['actor']['name'],
|
||||||
]))
|
]))
|
||||||
->setRichSubject($this->l->t('{actor} shared {file} with {email} by mail'), $parsedParameters)
|
->setRichSubject($this->l->t('{actor} shared {file} with {email} by mail'), $parsedParameters);
|
||||||
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) {
|
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND) {
|
||||||
$event->setParsedSubject($this->l->t('Password to access %1$s was sent to %2s', [
|
$event->setParsedSubject($this->l->t('Password to access %1$s was sent to %2s', [
|
||||||
$parsedParameters['file']['path'],
|
$parsedParameters['file']['path'],
|
||||||
$parsedParameters['email']['name']
|
$parsedParameters['email']['name']
|
||||||
]))
|
]))
|
||||||
->setRichSubject($this->l->t('Password to access {file} was sent to {email}'), $parsedParameters)
|
->setRichSubject($this->l->t('Password to access {file} was sent to {email}'), $parsedParameters);
|
||||||
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) {
|
} else if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF) {
|
||||||
$event->setParsedSubject(
|
$event->setParsedSubject(
|
||||||
$this->l->t('Password to access %1$s was sent to you',
|
$this->l->t('Password to access %1$s was sent to you',
|
||||||
[$parsedParameters['file']['path']]))
|
[$parsedParameters['file']['path']]))
|
||||||
->setRichSubject($this->l->t('Password to access {file} was sent to you'), $parsedParameters)
|
->setRichSubject($this->l->t('Password to access {file} was sent to you'), $parsedParameters);
|
||||||
->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.svg')));
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
|
|
|
@ -104,7 +104,12 @@ class Provider implements IProvider {
|
||||||
*/
|
*/
|
||||||
public function parseShortVersion(IEvent $event) {
|
public function parseShortVersion(IEvent $event) {
|
||||||
$parsedParameters = $this->getParameters($event);
|
$parsedParameters = $this->getParameters($event);
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/tag.svg')));
|
|
||||||
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/tag.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/tag.svg')));
|
||||||
|
}
|
||||||
|
|
||||||
if ($event->getSubject() === self::ASSIGN_TAG) {
|
if ($event->getSubject() === self::ASSIGN_TAG) {
|
||||||
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
|
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
|
||||||
|
@ -157,7 +162,12 @@ class Provider implements IProvider {
|
||||||
*/
|
*/
|
||||||
public function parseLongVersion(IEvent $event) {
|
public function parseLongVersion(IEvent $event) {
|
||||||
$parsedParameters = $this->getParameters($event);
|
$parsedParameters = $this->getParameters($event);
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/tag.svg')));
|
|
||||||
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/tag.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/tag.svg')));
|
||||||
|
}
|
||||||
|
|
||||||
if ($event->getSubject() === self::CREATE_TAG) {
|
if ($event->getSubject() === self::CREATE_TAG) {
|
||||||
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
|
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
|
||||||
|
|
|
@ -24,8 +24,8 @@ namespace OCA\TwoFactorBackupCodes\Activity;
|
||||||
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use OCP\Activity\IEvent;
|
use OCP\Activity\IEvent;
|
||||||
|
use OCP\Activity\IManager;
|
||||||
use OCP\Activity\IProvider;
|
use OCP\Activity\IProvider;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use OCP\L10N\IFactory as L10nFactory;
|
use OCP\L10N\IFactory as L10nFactory;
|
||||||
|
|
||||||
|
@ -37,17 +37,17 @@ class Provider implements IProvider {
|
||||||
/** @var IURLGenerator */
|
/** @var IURLGenerator */
|
||||||
private $urlGenerator;
|
private $urlGenerator;
|
||||||
|
|
||||||
/** @var ILogger */
|
/** @var IManager */
|
||||||
private $logger;
|
private $activityManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param L10nFactory $l10n
|
* @param L10nFactory $l10n
|
||||||
* @param IURLGenerator $urlGenerator
|
* @param IURLGenerator $urlGenerator
|
||||||
* @param ILogger $logger
|
* @param IManager $activityManager
|
||||||
*/
|
*/
|
||||||
public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, ILogger $logger) {
|
public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) {
|
||||||
$this->logger = $logger;
|
|
||||||
$this->urlGenerator = $urlGenerator;
|
$this->urlGenerator = $urlGenerator;
|
||||||
|
$this->activityManager = $activityManager;
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,12 @@ class Provider implements IProvider {
|
||||||
switch ($event->getSubject()) {
|
switch ($event->getSubject()) {
|
||||||
case 'codes_generated':
|
case 'codes_generated':
|
||||||
$event->setParsedSubject($l->t('You created two-factor backup codes for your account'));
|
$event->setParsedSubject($l->t('You created two-factor backup codes for your account'));
|
||||||
$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
|
|
||||||
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidArgumentException();
|
throw new InvalidArgumentException();
|
||||||
|
|
|
@ -25,8 +25,8 @@ namespace OCA\TwoFactorBackupCodes\Test\Unit\Activity;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use OCA\TwoFactorBackupCodes\Activity\Provider;
|
use OCA\TwoFactorBackupCodes\Activity\Provider;
|
||||||
use OCP\Activity\IEvent;
|
use OCP\Activity\IEvent;
|
||||||
|
use OCP\Activity\IManager;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use OCP\L10N\IFactory;
|
use OCP\L10N\IFactory;
|
||||||
use PHPUnit_Framework_MockObject_MockObject;
|
use PHPUnit_Framework_MockObject_MockObject;
|
||||||
|
@ -34,14 +34,14 @@ use Test\TestCase;
|
||||||
|
|
||||||
class ProviderTest extends TestCase {
|
class ProviderTest extends TestCase {
|
||||||
|
|
||||||
/** @var IL10N|PHPUnit_Framework_MockObject_MockObject */
|
/** @var IFactory|PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $l10n;
|
private $l10n;
|
||||||
|
|
||||||
/** @var IURLGenerator|PHPUnit_Framework_MockObject_MockObject */
|
/** @var IURLGenerator|PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $urlGenerator;
|
private $urlGenerator;
|
||||||
|
|
||||||
/** @var ILogger|PHPUnit_Framework_MockObject_MockObject */
|
/** @var IManager|PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $logger;
|
private $activityManager;
|
||||||
|
|
||||||
/** @var Provider */
|
/** @var Provider */
|
||||||
private $provider;
|
private $provider;
|
||||||
|
@ -51,9 +51,9 @@ class ProviderTest extends TestCase {
|
||||||
|
|
||||||
$this->l10n = $this->createMock(IFactory::class);
|
$this->l10n = $this->createMock(IFactory::class);
|
||||||
$this->urlGenerator = $this->createMock(IURLGenerator::class);
|
$this->urlGenerator = $this->createMock(IURLGenerator::class);
|
||||||
$this->logger = $this->createMock(ILogger::class);
|
$this->activityManager = $this->createMock(IManager::class);
|
||||||
|
|
||||||
$this->provider = new Provider($this->l10n, $this->urlGenerator, $this->logger);
|
$this->provider = new Provider($this->l10n, $this->urlGenerator, $this->activityManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParseUnrelated() {
|
public function testParseUnrelated() {
|
||||||
|
|
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
|
@ -57,6 +57,9 @@ class Manager implements IManager {
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected $formattingObjectId;
|
protected $formattingObjectId;
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
protected $requirePNG;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $currentUserId;
|
protected $currentUserId;
|
||||||
|
|
||||||
|
@ -465,6 +468,20 @@ class Manager implements IManager {
|
||||||
&& $this->formattingObjectId === $this->request->getParam('object_id');
|
&& $this->formattingObjectId === $this->request->getParam('object_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $status Set to true, when parsing events should not use SVG icons
|
||||||
|
*/
|
||||||
|
public function setRequirePNG($status) {
|
||||||
|
$this->requirePNG = $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getRequirePNG() {
|
||||||
|
return $this->requirePNG;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $app
|
* @param string $app
|
||||||
* @param string $text
|
* @param string $text
|
||||||
|
|
|
@ -206,6 +206,18 @@ interface IManager {
|
||||||
*/
|
*/
|
||||||
public function isFormattingFilteredObject();
|
public function isFormattingFilteredObject();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $status Set to true, when parsing events should not use SVG icons
|
||||||
|
* @since 12.0.1
|
||||||
|
*/
|
||||||
|
public function setRequirePNG($status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
* @since 12.0.1
|
||||||
|
*/
|
||||||
|
public function getRequirePNG();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $app
|
* @param string $app
|
||||||
* @param string $text
|
* @param string $text
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
namespace OC\Settings\Activity;
|
namespace OC\Settings\Activity;
|
||||||
|
|
||||||
use OCP\Activity\IEvent;
|
use OCP\Activity\IEvent;
|
||||||
|
use OCP\Activity\IManager;
|
||||||
use OCP\Activity\IProvider;
|
use OCP\Activity\IProvider;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
|
@ -50,6 +51,9 @@ class Provider implements IProvider {
|
||||||
/** @var IUserManager */
|
/** @var IUserManager */
|
||||||
protected $userManager;
|
protected $userManager;
|
||||||
|
|
||||||
|
/** @var IManager */
|
||||||
|
private $activityManager;
|
||||||
|
|
||||||
/** @var string[] cached displayNames - key is the UID and value the displayname */
|
/** @var string[] cached displayNames - key is the UID and value the displayname */
|
||||||
protected $displayNames = [];
|
protected $displayNames = [];
|
||||||
|
|
||||||
|
@ -57,11 +61,13 @@ class Provider implements IProvider {
|
||||||
* @param IFactory $languageFactory
|
* @param IFactory $languageFactory
|
||||||
* @param IURLGenerator $url
|
* @param IURLGenerator $url
|
||||||
* @param IUserManager $userManager
|
* @param IUserManager $userManager
|
||||||
|
* @param IManager $activityManager
|
||||||
*/
|
*/
|
||||||
public function __construct(IFactory $languageFactory, IURLGenerator $url, IUserManager $userManager) {
|
public function __construct(IFactory $languageFactory, IURLGenerator $url, IUserManager $userManager, IManager $activityManager) {
|
||||||
$this->languageFactory = $languageFactory;
|
$this->languageFactory = $languageFactory;
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
$this->userManager = $userManager;
|
$this->userManager = $userManager;
|
||||||
|
$this->activityManager = $activityManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +85,11 @@ class Provider implements IProvider {
|
||||||
|
|
||||||
$this->l = $this->languageFactory->get('settings', $language);
|
$this->l = $this->languageFactory->get('settings', $language);
|
||||||
|
|
||||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('settings', 'personal.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('settings', 'personal.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('settings', 'personal.svg')));
|
||||||
|
}
|
||||||
|
|
||||||
if ($event->getSubject() === self::PASSWORD_CHANGED_BY) {
|
if ($event->getSubject() === self::PASSWORD_CHANGED_BY) {
|
||||||
$subject = $this->l->t('{actor} changed your password');
|
$subject = $this->l->t('{actor} changed your password');
|
||||||
|
|
|
@ -24,8 +24,8 @@ namespace OC\Settings\Activity;
|
||||||
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use OCP\Activity\IEvent;
|
use OCP\Activity\IEvent;
|
||||||
|
use OCP\Activity\IManager;
|
||||||
use OCP\Activity\IProvider;
|
use OCP\Activity\IProvider;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use OCP\L10N\IFactory as L10nFactory;
|
use OCP\L10N\IFactory as L10nFactory;
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ class SecurityProvider implements IProvider {
|
||||||
/** @var IURLGenerator */
|
/** @var IURLGenerator */
|
||||||
private $urlGenerator;
|
private $urlGenerator;
|
||||||
|
|
||||||
/** @var ILogger */
|
/** @var IManager */
|
||||||
private $logger;
|
private $activityManager;
|
||||||
|
|
||||||
public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, ILogger $logger) {
|
public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IManager $activityManager) {
|
||||||
$this->logger = $logger;
|
|
||||||
$this->urlGenerator = $urlGenerator;
|
$this->urlGenerator = $urlGenerator;
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
|
$this->activityManager = $activityManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parse($language, IEvent $event, IEvent $previousEvent = null) {
|
public function parse($language, IEvent $event, IEvent $previousEvent = null) {
|
||||||
|
@ -59,14 +59,22 @@ class SecurityProvider implements IProvider {
|
||||||
$event->setParsedSubject($l->t('You successfully logged in using two-factor authentication (%1$s)', [
|
$event->setParsedSubject($l->t('You successfully logged in using two-factor authentication (%1$s)', [
|
||||||
$params['provider'],
|
$params['provider'],
|
||||||
]));
|
]));
|
||||||
$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'twofactor_failed':
|
case 'twofactor_failed':
|
||||||
$params = $event->getSubjectParameters();
|
$params = $event->getSubjectParameters();
|
||||||
$event->setParsedSubject($l->t('A login attempt using two-factor authentication failed (%1$s)', [
|
$event->setParsedSubject($l->t('A login attempt using two-factor authentication failed (%1$s)', [
|
||||||
$params['provider'],
|
$params['provider'],
|
||||||
]));
|
]));
|
||||||
$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
|
if ($this->activityManager->getRequirePNG()) {
|
||||||
|
$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
|
||||||
|
} else {
|
||||||
|
$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.svg')));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidArgumentException();
|
throw new InvalidArgumentException();
|
||||||
|
|
After Width: | Height: | Size: 4.1 KiB |
|
@ -25,8 +25,8 @@ namespace Tests\Settings\Activity;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use OC\Settings\Activity\SecurityProvider;
|
use OC\Settings\Activity\SecurityProvider;
|
||||||
use OCP\Activity\IEvent;
|
use OCP\Activity\IEvent;
|
||||||
|
use OCP\Activity\IManager;
|
||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
use OCP\ILogger;
|
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use OCP\L10N\IFactory;
|
use OCP\L10N\IFactory;
|
||||||
use PHPUnit_Framework_MockObject_MockObject;
|
use PHPUnit_Framework_MockObject_MockObject;
|
||||||
|
@ -34,14 +34,14 @@ use Test\TestCase;
|
||||||
|
|
||||||
class SecurityProviderTest extends TestCase {
|
class SecurityProviderTest extends TestCase {
|
||||||
|
|
||||||
/** @var IL10N|PHPUnit_Framework_MockObject_MockObject */
|
/** @var IFactory|PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $l10n;
|
private $l10n;
|
||||||
|
|
||||||
/** @var IURLGenerator|PHPUnit_Framework_MockObject_MockObject */
|
/** @var IURLGenerator|PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $urlGenerator;
|
private $urlGenerator;
|
||||||
|
|
||||||
/** @var ILogger|PHPUnit_Framework_MockObject_MockObject */
|
/** @var IManager|PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $logger;
|
private $activityManager;
|
||||||
|
|
||||||
/** @var SecurityProvider */
|
/** @var SecurityProvider */
|
||||||
private $provider;
|
private $provider;
|
||||||
|
@ -51,9 +51,9 @@ class SecurityProviderTest extends TestCase {
|
||||||
|
|
||||||
$this->l10n = $this->createMock(IFactory::class);
|
$this->l10n = $this->createMock(IFactory::class);
|
||||||
$this->urlGenerator = $this->createMock(IURLGenerator::class);
|
$this->urlGenerator = $this->createMock(IURLGenerator::class);
|
||||||
$this->logger = $this->createMock(ILogger::class);
|
$this->activityManager = $this->createMock(IManager::class);
|
||||||
|
|
||||||
$this->provider = new SecurityProvider($this->l10n, $this->urlGenerator, $this->logger);
|
$this->provider = new SecurityProvider($this->l10n, $this->urlGenerator, $this->activityManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParseUnrelated() {
|
public function testParseUnrelated() {
|
||||||
|
|