Implement automatic check for new notifications [SCI-8654] (#5631)

This commit is contained in:
ajugo 2023-07-11 16:05:34 +02:00 committed by GitHub
parent b9ec8ecc08
commit 051e686787
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -126,6 +126,9 @@
// Track name update in user profile settings // Track name update in user profile settings
$(document).on('inlineEditing::updated', '.inline-editing-container[data-field-to-update="full_name"]', this.fetchData); $(document).on('inlineEditing::updated', '.inline-editing-container[data-field-to-update="full_name"]', this.fetchData);
}, },
beforeDestroy: function(){
clearTimeout(this.unseenNotificationsTimeout);
},
methods: { methods: {
fetchData() { fetchData() {
$.get(this.url, (result) => { $.get(this.url, (result) => {
@ -160,8 +163,10 @@
window.open(`${this.searchUrl}?q=${e.target.value}`, '_self') window.open(`${this.searchUrl}?q=${e.target.value}`, '_self')
}, },
checkUnseenNotifications() { checkUnseenNotifications() {
clearTimeout(this.unseenNotificationsTimeout);
$.get(this.unseenNotificationsUrl, (result) => { $.get(this.unseenNotificationsUrl, (result) => {
this.unseenNotificationsCount = result.unseen; this.unseenNotificationsCount = result.unseen;
this.unseenNotificationsTimeout = setTimeout(this.checkUnseenNotifications, 30000);
}) })
}, },
refreshCurrentTeam() { refreshCurrentTeam() {