Added maybeUid to CalEventParser
This commit is contained in:
parent
65fd733751
commit
2b38638d84
4 changed files with 11 additions and 7 deletions
|
@ -6,10 +6,12 @@ import { stripHtml } from "./emails/helpers";
|
||||||
const translator = short();
|
const translator = short();
|
||||||
|
|
||||||
export default class CalEventParser {
|
export default class CalEventParser {
|
||||||
calEvent: CalendarEvent;
|
protected calEvent: CalendarEvent;
|
||||||
|
protected maybeUid: string;
|
||||||
|
|
||||||
constructor(calEvent: CalendarEvent) {
|
constructor(calEvent: CalendarEvent, maybeUid: string = null) {
|
||||||
this.calEvent = calEvent;
|
this.calEvent = calEvent;
|
||||||
|
this.maybeUid = maybeUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +32,7 @@ export default class CalEventParser {
|
||||||
* Returns a unique identifier for the given calendar event.
|
* Returns a unique identifier for the given calendar event.
|
||||||
*/
|
*/
|
||||||
public getUid(): string {
|
public getUid(): string {
|
||||||
return translator.fromUUID(uuidv5(JSON.stringify(this.calEvent), uuidv5.URL));
|
return this.maybeUid ?? translator.fromUUID(uuidv5(JSON.stringify(this.calEvent), uuidv5.URL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -515,8 +515,8 @@ const createEvent = async (
|
||||||
noMail = false,
|
noMail = false,
|
||||||
maybeUid: string = null
|
maybeUid: string = null
|
||||||
): Promise<EventResult> => {
|
): Promise<EventResult> => {
|
||||||
const parser: CalEventParser = new CalEventParser(calEvent);
|
const parser: CalEventParser = new CalEventParser(calEvent, maybeUid);
|
||||||
const uid: string = maybeUid ?? parser.getUid();
|
const uid: string = parser.getUid();
|
||||||
const richEvent: CalendarEvent = parser.asRichEvent();
|
const richEvent: CalendarEvent = parser.asRichEvent();
|
||||||
|
|
||||||
let success = true;
|
let success = true;
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default abstract class EventMail {
|
||||||
constructor(calEvent: CalendarEvent, uid: string, additionInformation: AdditionInformation = null) {
|
constructor(calEvent: CalendarEvent, uid: string, additionInformation: AdditionInformation = null) {
|
||||||
this.calEvent = calEvent;
|
this.calEvent = calEvent;
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
this.parser = new CalEventParser(calEvent);
|
this.parser = new CalEventParser(calEvent, uid);
|
||||||
this.additionInformation = additionInformation;
|
this.additionInformation = additionInformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { EventResult } from "@lib/events/EventManager";
|
||||||
import logger from "@lib/logger";
|
import logger from "@lib/logger";
|
||||||
import { AdditionInformation, EntryPoint } from "@lib/emails/EventMail";
|
import { AdditionInformation, EntryPoint } from "@lib/emails/EventMail";
|
||||||
import { getIntegrationName } from "@lib/emails/helpers";
|
import { getIntegrationName } from "@lib/emails/helpers";
|
||||||
|
import CalEventParser from "@lib/CalEventParser";
|
||||||
|
|
||||||
const log = logger.getChildLogger({ prefix: ["[lib] videoClient"] });
|
const log = logger.getChildLogger({ prefix: ["[lib] videoClient"] });
|
||||||
|
|
||||||
|
@ -206,7 +207,8 @@ const createMeeting = async (
|
||||||
calEvent: CalendarEvent,
|
calEvent: CalendarEvent,
|
||||||
maybeUid: string = null
|
maybeUid: string = null
|
||||||
): Promise<EventResult> => {
|
): Promise<EventResult> => {
|
||||||
const uid: string = maybeUid ?? translator.fromUUID(uuidv5(JSON.stringify(calEvent), uuidv5.URL));
|
const parser: CalEventParser = new CalEventParser(calEvent, maybeUid);
|
||||||
|
const uid: string = parser.getUid();
|
||||||
|
|
||||||
if (!credential) {
|
if (!credential) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
Loading…
Reference in a new issue