Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calendar/issue/4128 : Feature: added between calendars patterns on events #887

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/models/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class Calendar extends davCollectionPublishable(davCollectionShareable(Da
super._exposeProperty('order', NS.APPLE, 'calendar-order', true);
super._exposeProperty('timezone', NS.IETF_CALDAV, 'calendar-timezone', true);
super._exposeProperty('components', NS.IETF_CALDAV, 'supported-calendar-component-set');
super._exposeProperty('pattern', NS.NEXTCLOUD, 'calendar-pattern', true);
}

/**
Expand Down Expand Up @@ -293,7 +294,8 @@ export class Calendar extends davCollectionPublishable(davCollectionShareable(Da
[NS.OWNCLOUD, 'calendar-enabled'],
[NS.NEXTCLOUD, 'owner-displayname'],
[NS.NEXTCLOUD, 'trash-bin-retention-duration'],
[NS.NEXTCLOUD, 'deleted-at']
[NS.NEXTCLOUD, 'deleted-at'],
[NS.NEXTCLOUD, 'calendar-pattern']
]);
}

Expand Down
22 changes: 22 additions & 0 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ export default class Parser {
this.registerParser('{http://owncloud.org/ns}read-only', Parser.bool);
this.registerParser('{http://nextcloud.com/ns}owner-displayname', Parser.text);
this.registerParser('{http://nextcloud.com/ns}deleted-at', Parser.iso8601DateTime);
this.registerParser('{http://nextcloud.com/ns}calendar-pattern', Parser.text);
this.registerParser('{http://nextcloud.com/ns}calendar-uri', Parser.text);
this.registerParser('{http://nextcloud.com/ns}has-photo', Parser.bool);
this.registerParser('{http://nextcloud.com/ns}trash-bin-retention-duration', Parser.decInt);
Expand Down Expand Up @@ -548,6 +549,27 @@ export default class Parser {
return text;
}

/**
* Parses a {http://apple.com/ns/ical/}calendar-color Node
* strips the alpha value of RGB values
*
* @param {Document} document
* @param {Node} node
* @param {XPathNSResolver} resolver
* @returns {String}
*/
static pattern(document, node, resolver) {
const text = Parser.text(document, node, resolver);
// some stupid clients store an alpha value in the rgb hash (like #rrggbbaa) *cough cough* Apple Calendar *cough cough*
// but some browsers can't parse that *cough cough* Safari 9 *cough cough*
// Safari 10 seems to support this though
// if (text.length === 9) {
// return text.slice(0, 7);
// }

return text;
}

/**
* Parses a {http://calendarserver.org/ns/}allowed-sharing-modes Node
*
Expand Down
7 changes: 7 additions & 0 deletions src/propset/calendarPropSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ export default function calendarPropSet(props) {
});
break;

case '{http://nextcloud.com/ns}calendar-pattern':
xmlified.push({
name: [NS.NEXTCLOUD, 'calendar-pattern'],
value: value
});
break;

case '{http://calendarserver.org/ns/}source':
xmlified.push({
name: [NS.CALENDARSERVER, 'source'],
Expand Down
Loading