Force save settings at ad post

This commit is contained in:
Mr. Stallion 2022-09-03 11:11:37 -07:00
parent 2c99eac31a
commit 4b07e29417
2 changed files with 20 additions and 3 deletions

View File

@ -432,8 +432,18 @@ class ChannelConversation extends Conversation implements Interfaces.ChannelConv
createMessage(isAd ? MessageType.Ad : MessageType.Message, core.characters.ownCharacter, message, new Date())
);
if(isAd)
if(isAd) {
this.nextAd = Date.now() + core.connection.vars.lfrp_flood * 1000;
// enforces property setter
this.settings = {
...this.settings,
adSettings: {
...this.settings.adSettings,
lastAdTimestamp: Date.now()
}
};
}
}
);
}
@ -485,7 +495,14 @@ class ChannelConversation extends Conversation implements Interfaces.ChannelConv
this.nextAd = Date.now() + core.connection.vars.lfrp_flood * 1000;
this.settings.adSettings.lastAdTimestamp = Date.now();
// enforces property setter
this.settings = {
...this.settings,
adSettings: {
...this.settings.adSettings,
lastAdTimestamp: Date.now()
}
};
}
);
}

View File

@ -113,7 +113,7 @@ export namespace Conversation {
export interface AdSettings {
readonly ads: string[];
readonly randomOrder: boolean;
lastAdTimestamp: number;
readonly lastAdTimestamp: number;
}
export const enum UnreadState { None, Unread, Mention }