Skip to content

Commit

Permalink
calendar: Persist calendar capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
kewisch committed Sep 11, 2024
1 parent 84f9081 commit b5d4b7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ this.calendar_calendars = class extends ExtensionAPI {
// TODO validate capability names
const unwrappedCalendar = calendar.wrappedJSObject.mUncachedCalendar.wrappedJSObject;
unwrappedCalendar.capabilities = Object.assign({}, unwrappedCalendar.capabilities, updateProperties.capabilities);
calendar.setProperty("extensionCapabilities", JSON.stringify(unwrappedCalendar.capabilities));
}

if (updateProperties.lastError !== undefined) {
Expand Down
17 changes: 7 additions & 10 deletions calendar/experiments/calendar/parent/ext-calendar-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,21 @@ class ExtCalendar extends cal.provider.BaseClass {
return this.extension.id;
}

get capabilities() {
if (!this._capabilities) {
this._capabilities = this.extension.manifest.calendar_provider.capabilities || {};
}
return this._capabilities;
}
set capabilities(val) {
this._capabilities = val;
}

canRefresh = true;
capabilities = {};

get id() {
return super.id;
}
set id(val) {
super.id = val;
if (this.id && this.uri) {
try {
this.capabilities = JSON.parse(super.getProperty("extensionCapabilities"));
} catch (e) {
this.capabilities = this.extension.manifest.calendar_provider.capabilities || {};
}

this.extension.emit("calendar.provider.onInit", this);
}
}
Expand Down

0 comments on commit b5d4b7f

Please sign in to comment.