This commit is contained in:
Henry Jameson 2026-06-16 18:45:58 +03:00
commit 9eee55df4a
2 changed files with 9 additions and 16 deletions

View file

@ -35,9 +35,7 @@ const AnnouncementsPage = {
canPostAnnouncement() { canPostAnnouncement() {
return ( return (
this.currentUser && this.currentUser &&
this.currentUser.privileges.has( this.currentUser.privileges.has('announcements_manage_announcements')
'announcements_manage_announcements',
)
) )
}, },
}, },

View file

@ -22,21 +22,16 @@ export const promiseInterval = (promiseCall, interval) => {
window.clearTimeout(timeout) window.clearTimeout(timeout)
} }
const loop = new Promise(async (resolve, reject) => { const loop = async () => {
try {
while (!stopped) { while (!stopped) {
await promiseCall() await promiseCall()
const { timeoutId, promise } = wait(interval) const { timeoutId, promise } = wait(interval)
timeout = timeoutId timeout = timeoutId
await promise() await promise()
} }
resolve()
} catch (e) {
reject(e)
} }
})
loop.then() loop().then()
return { stop: stopFetcher } return { stop: stopFetcher }
} }