Skip to content

Commit

Permalink
Add possibility to hide rooms in calendar entries (#107)
Browse files Browse the repository at this point in the history
If the project's short description includes "rooms: hide", the code will no
longer set the room in the calendar entry.

Since Zoom info is per room too, it will also not set Zoom coordinates.

Close #95.
  • Loading branch information
tidoust authored Apr 22, 2024
1 parent 3fc4a69 commit a468ac4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/lib/calendar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ async function fillCalendarEntry({ page, entry, session, project, status, zoom }
status = status ?? 'draft';
await page.$eval(`input[name="event[status]"][value=${status}]`, el => el.click());

const room = project.rooms.find(room => room.name === entry.room);
const room = (project.metadata.rooms === 'hide') ?
null :
project.rooms.find(room => room.name === entry.room);
const roomLocation = (room?.label ?? '') + (room?.location ? ' - ' + room.location : '');
await fillTextInput('input#event_location', roomLocation ?? '');

Expand Down Expand Up @@ -647,20 +649,22 @@ export async function synchronizeSessionWithCalendar(
for (const entry of actions.update) {
console.log(`- refresh calendar entry ${entry.url}, meeting in ${entry.room} on ${entry.day} ${entry.start} - ${entry.end}`);
const room = project.rooms.find(room => room.name === entry.room);
const zoom = project.metadata.rooms === 'hide' ? null : roomZoom[room.label];
entry.url = await updateCalendarEntry({
calendarUrl: entry.url,
entry, session, project,
browser, login, password, status, roomZoom[room.label]
browser, login, password, status, zoom
});
}

for (const entry of actions.create) {
console.log(`- create new calendar entry, meeting in ${entry.room} on ${entry.day} ${entry.start} - ${entry.end}`);
const room = project.rooms.find(room => room.name === entry.room);
const zoom = project.metadata.rooms === 'hide' ? null : roomZoom[room.label];
entry.url = await updateCalendarEntry({
calendarUrl: null,
entry, session, project,
browser, login, password, status, roomZoom[room.label]
browser, login, password, status, zoom
});
}

Expand Down

0 comments on commit a468ac4

Please sign in to comment.