Fix calendar view URL

pull/1/head
yflory 4 years ago
parent 5dded12f53
commit 67fae22156

@ -759,7 +759,7 @@ Messages.calendar_tempCalendar = "Temp calendar";
onEvent: onEvent onEvent: onEvent
}); });
APP.module.execCommand('SUBSCRIBE', null, function (obj) { APP.module.execCommand('SUBSCRIBE', null, function (obj) {
if (obj.empty) { if (obj.empty && !privateData.calendarHash) {
// No calendar yet, create one // No calendar yet, create one
newCalendar({ newCalendar({
teamId: 1, teamId: 1,
@ -777,7 +777,7 @@ Messages.calendar_tempCalendar = "Temp calendar";
hash: privateData.hashes.editHash || privateData.hashes.viewHash, hash: privateData.hashes.editHash || privateData.hashes.viewHash,
password: privateData.password password: privateData.password
}, function (obj) { }, function (obj) {
console.error(obj); // XXX if (obj && obj.error) { console.error(obj.error); }
}); });
} }
makeCalendar(); makeCalendar();

@ -326,10 +326,12 @@ ctx.calendars[channel] = {
var openCalendar = function (ctx, data, cId, cb) { var openCalendar = function (ctx, data, cId, cb) {
var secret = Hash.getSecrets('calendar', data.hash, data.password); var secret = Hash.getSecrets('calendar', data.hash, data.password);
var hash = Hash.getEditHashFromKeys(secret);
var roHash = Hash.getViewHashFromKeys(secret);
var cal = { var cal = {
href: Hash.hashToHref(Hash.getEditHashFromKeys(secret), 'calendar'), href: hash && Hash.hashToHref(hash, 'calendar'),
roHref: Hash.hashToHref(Hash.getViewHashFromKeys(secret), 'calendar'), roHref: roHash && Hash.hashToHref(roHash, 'calendar'),
channel: secret.channel, channel: secret.channel,
color: Util.getRandomColor(), color: Util.getRandomColor(),
title: '...' title: '...'

Loading…
Cancel
Save