mirror of https://github.com/xwiki-labs/cryptpad
Move an event from a calendar to another
This commit is contained in:
parent
63581e2cf3
commit
547b0c1d3e
|
@ -748,10 +748,7 @@ Messages.calendar_import = "Import to my calendars";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var isUpdate = Boolean($el.find('#tui-full-calendar-schedule-title').val());
|
var isUpdate = Boolean($el.find('#tui-full-calendar-schedule-title').val());
|
||||||
if (isUpdate) {
|
if (!isUpdate) { $el.find('.tui-full-calendar-dropdown-menu li').first().click(); }
|
||||||
$el.find('.tui-full-calendar-dropdown-button').attr('disabled', 'disabled').off('click');
|
|
||||||
$el.find('.tui-full-calendar-dropdown-menu').addClass('cp-forcehide');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
var onCalendarEditPopup = function (el) {
|
var onCalendarEditPopup = function (el) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
|
@ -552,11 +552,27 @@ ctx.calendars[channel] = {
|
||||||
|
|
||||||
// update the event
|
// update the event
|
||||||
var changes = data.changes || {};
|
var changes = data.changes || {};
|
||||||
|
|
||||||
|
var newC;
|
||||||
|
if (changes.calendarId) {
|
||||||
|
newC = ctx.calendars[changes.calendarId];
|
||||||
|
if (!newC || !newC.proxy || !newC.proxy.content) { return void cb({error: "ENOENT"}); }
|
||||||
|
}
|
||||||
|
|
||||||
Object.keys(changes).forEach(function (key) {
|
Object.keys(changes).forEach(function (key) {
|
||||||
ev[key] = changes[key];
|
ev[key] = changes[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
Realtime.whenRealtimeSyncs(c.lm.realtime, cb);
|
// Move to a different calendar?
|
||||||
|
if (changes.calendarId && newC) {
|
||||||
|
newC.proxy.content[data.ev.id] = Util.clone(ev);
|
||||||
|
delete c.proxy.content[data.ev.id];
|
||||||
|
}
|
||||||
|
|
||||||
|
nThen(function (waitFor) {
|
||||||
|
Realtime.whenRealtimeSyncs(c.lm.realtime, waitFor());
|
||||||
|
if (newC) { Realtime.whenRealtimeSyncs(newC.lm.realtime, waitFor()); }
|
||||||
|
}).nThen(cb);
|
||||||
};
|
};
|
||||||
var deleteEvent = function (ctx, data, cId, cb) {
|
var deleteEvent = function (ctx, data, cId, cb) {
|
||||||
var id = data.calendarId;
|
var id = data.calendarId;
|
||||||
|
|
Loading…
Reference in New Issue