Use a different type for events and todos

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2016-10-13 13:20:53 +02:00
parent 43b46bcc6a
commit d3e8463de2
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
2 changed files with 20 additions and 3 deletions

View File

@ -427,7 +427,7 @@ class Backend {
$event = $this->activityManager->generateEvent();
$event->setApp('dav')
->setObject(Extension::CALENDAR, $calendarId)
->setType(Extension::CALENDAR)
->setType($object['type'] === 'event' ? Extension::CALENDAR_EVENT : Extension::CALENDAR_TODO)
->setAuthor($currentUser);
$users = $this->getUsersForCalendar($calendarId);

View File

@ -31,6 +31,8 @@ class Extension implements IExtension {
* Filter with all sharing related activities
*/
const CALENDAR = 'calendar';
const CALENDAR_EVENT = 'calendar_event';
const CALENDAR_TODO = 'calendar_todo';
const SUBJECT_ADD = 'calendar_add';
const SUBJECT_UPDATE = 'calendar_update';
@ -75,6 +77,8 @@ class Extension implements IExtension {
return array(
self::CALENDAR => (string) $l->t('A <strong>calendar</strong> was modified'),
self::CALENDAR_EVENT => (string) $l->t('A calendar <strong>event</strong> was modified'),
self::CALENDAR_TODO => (string) $l->t('A calendar <strong>todo</strong> was modified'),
);
}
@ -89,6 +93,8 @@ class Extension implements IExtension {
$defaultTypes = [];
if ($method === self::METHOD_STREAM) {
$defaultTypes[] = self::CALENDAR;
$defaultTypes[] = self::CALENDAR_EVENT;
$defaultTypes[] = self::CALENDAR_TODO;
}
return $defaultTypes;
@ -104,7 +110,10 @@ class Extension implements IExtension {
public function getTypeIcon($type) {
switch ($type) {
case self::CALENDAR:
case self::CALENDAR_EVENT:
return 'icon-calendar-dark';
case self::CALENDAR_TODO:
return 'icon-checkmark';
}
return false;
@ -314,6 +323,12 @@ class Extension implements IExtension {
'name' => (string) $l->t('Calendar'),
'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', ['filter' => self::CALENDAR]),
],
self::CALENDAR_TODO => [
'id' => self::CALENDAR_TODO,
'icon' => 'icon-checkmark',
'name' => (string) $l->t('Todos'),
'url' => $this->URLGenerator->linkToRoute('activity.Activities.showList', ['filter' => self::CALENDAR_TODO]),
],
],
'top' => [],
];
@ -326,7 +341,7 @@ class Extension implements IExtension {
* @return boolean
*/
public function isFilterValid($filterValue) {
return $filterValue === self::CALENDAR;
return in_array($filterValue, [self::CALENDAR, self::CALENDAR_TODO]);
}
/**
@ -340,7 +355,9 @@ class Extension implements IExtension {
public function filterNotificationTypes($types, $filter) {
switch ($filter) {
case self::CALENDAR:
return array_intersect([self::CALENDAR], $types);
return array_intersect([self::CALENDAR, self::CALENDAR_EVENT], $types);
case self::CALENDAR_TODO:
return array_intersect([self::CALENDAR_TODO], $types);
}
return false;
}