Skip to content
Merged
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
2 changes: 1 addition & 1 deletion dist/dist.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/dist.js.map

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/models/calendarHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { Subscription } from './subscription.js';
import ScheduleInbox from './scheduleInbox.js';
import ScheduleOutbox from './scheduleOutbox.js';
import * as NS from '../utility/namespaceUtility.js';
import * as XMLUtility from '../utility/xmlUtility.js';

import { debugFactory } from '../debug.js';
const debug = debugFactory('CalendarHome');
Expand Down Expand Up @@ -213,4 +214,18 @@ export class CalendarHome extends DavCollection {
// TODO - implement me
}

/**
* enables the birthday calendar for the Calendar Home that belongs to this user
*
* @returns {Promise<void>}
*/
async enableBirthdayCalendar() {
const [skeleton] = XMLUtility.getRootSkeleton(
[NS.NEXTCLOUD, 'enable-birthday-calendar']
);
const xmlBody = XMLUtility.serialize(skeleton);

await this._request.post(this.url, {}, xmlBody);
}

}
21 changes: 21 additions & 0 deletions test/unit/models/calendarHomeTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,27 @@ describe('Calendar home model', () => {
pending('to be implemeneted ... ');
});

it('should allow to enable the birthday-calendar', () => {
const parent = null;
const request = jasmine.createSpyObj('Request', ['post']);
const url = '/nextcloud/remote.php/dav/calendars/admin/';

request.post.and.returnValue(Promise.resolve({
status: 204,
body: null,
xhr: null
})
);

const calendarHome = new CalendarHome(parent, request, url, {});
return calendarHome.enableBirthdayCalendar().then((res) => {
expect(request.post).toHaveBeenCalledTimes(1);
expect(request.post).toHaveBeenCalledWith('/nextcloud/remote.php/dav/calendars/admin/', {}, '<x0:enable-birthday-calendar xmlns:x0="http://nextcloud.com/ns"/>');

expect(res).toEqual(undefined)
});
})

});

function getDefaultPropFind() {
Expand Down