Fix permanent mutes being removed immediately as if they expired
This commit is contained in:
parent
2e9445ce35
commit
58e69a19a3
5 changed files with 13 additions and 5 deletions
|
@ -52,8 +52,12 @@ export async function runExpiringMutesLoop() {
|
|||
export function registerExpiringMute(mute: Mute) {
|
||||
clearExpiringMute(mute);
|
||||
|
||||
if (mute.expires_at === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("[EXPIRING MUTES LOOP] Registering new expiring mute");
|
||||
const remaining = Math.max(0, moment.utc(mute.expires_at!).diff(moment.utc()));
|
||||
const remaining = Math.max(0, moment.utc(mute.expires_at).diff(moment.utc()));
|
||||
if (remaining > LOOP_INTERVAL) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ export function registerExpiringTempban(tempban: Tempban) {
|
|||
clearExpiringTempban(tempban);
|
||||
|
||||
console.log("[EXPIRING TEMPBANS LOOP] Registering new expiring tempban");
|
||||
const remaining = Math.max(0, moment.utc(tempban.expires_at!).diff(moment.utc()));
|
||||
const remaining = Math.max(0, moment.utc(tempban.expires_at).diff(moment.utc()));
|
||||
if (remaining > LOOP_INTERVAL) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ export function registerExpiringVCAlert(alert: VCAlert) {
|
|||
clearExpiringVCAlert(alert);
|
||||
|
||||
console.log("[EXPIRING VCALERTS LOOP] Registering new expiring vcalert");
|
||||
const remaining = Math.max(0, moment.utc(alert.expires_at!).diff(moment.utc()));
|
||||
const remaining = Math.max(0, moment.utc(alert.expires_at).diff(moment.utc()));
|
||||
if (remaining > LOOP_INTERVAL) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export function registerUpcomingReminder(reminder: Reminder) {
|
|||
clearUpcomingReminder(reminder);
|
||||
|
||||
console.log("[REMINDERS LOOP] Registering new upcoming reminder");
|
||||
const remaining = Math.max(0, moment.utc(reminder.remind_at!).diff(moment.utc()));
|
||||
const remaining = Math.max(0, moment.utc(reminder.remind_at).diff(moment.utc()));
|
||||
if (remaining > LOOP_INTERVAL) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -47,8 +47,12 @@ export async function runUpcomingScheduledPostsLoop() {
|
|||
export function registerUpcomingScheduledPost(post: ScheduledPost) {
|
||||
clearUpcomingScheduledPost(post);
|
||||
|
||||
if (post.post_at === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("[SCHEDULED POSTS LOOP] Registering new upcoming scheduled post");
|
||||
const remaining = Math.max(0, moment.utc(post.post_at!).diff(moment.utc()));
|
||||
const remaining = Math.max(0, moment.utc(post.post_at).diff(moment.utc()));
|
||||
if (remaining > LOOP_INTERVAL) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue