From 67fae22156b7b68ea23210da236d21d8a5b0080c Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 7 Apr 2021 15:49:20 +0200 Subject: [PATCH] Fix calendar view URL --- www/calendar/inner.js | 4 ++-- www/common/outer/calendar.js | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/www/calendar/inner.js b/www/calendar/inner.js index 29952cf3d..e5ade2fad 100644 --- a/www/calendar/inner.js +++ b/www/calendar/inner.js @@ -759,7 +759,7 @@ Messages.calendar_tempCalendar = "Temp calendar"; onEvent: onEvent }); APP.module.execCommand('SUBSCRIBE', null, function (obj) { - if (obj.empty) { + if (obj.empty && !privateData.calendarHash) { // No calendar yet, create one newCalendar({ teamId: 1, @@ -777,7 +777,7 @@ Messages.calendar_tempCalendar = "Temp calendar"; hash: privateData.hashes.editHash || privateData.hashes.viewHash, password: privateData.password }, function (obj) { - console.error(obj); // XXX + if (obj && obj.error) { console.error(obj.error); } }); } makeCalendar(); diff --git a/www/common/outer/calendar.js b/www/common/outer/calendar.js index 0ffc5862d..c504a8191 100644 --- a/www/common/outer/calendar.js +++ b/www/common/outer/calendar.js @@ -326,10 +326,12 @@ ctx.calendars[channel] = { var openCalendar = function (ctx, data, cId, cb) { var secret = Hash.getSecrets('calendar', data.hash, data.password); + var hash = Hash.getEditHashFromKeys(secret); + var roHash = Hash.getViewHashFromKeys(secret); var cal = { - href: Hash.hashToHref(Hash.getEditHashFromKeys(secret), 'calendar'), - roHref: Hash.hashToHref(Hash.getViewHashFromKeys(secret), 'calendar'), + href: hash && Hash.hashToHref(hash, 'calendar'), + roHref: roHash && Hash.hashToHref(roHash, 'calendar'), channel: secret.channel, color: Util.getRandomColor(), title: '...'