Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable21] Only send desktop notifications in one tab #911

Merged
merged 1 commit into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions js/notifications-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/notifications-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default {
return this.backgroundFetching
&& this.webNotificationsGranted
&& this.userStatus !== 'dnd'
&& this.tabId !== this.lastTabId
&& this.tabId === this.lastTabId
},
},

Expand Down Expand Up @@ -240,7 +240,7 @@ export default {
} else if (response.status === 200) {
this.userStatus = response.headers['x-nextcloud-user-status']
this.lastETag = response.headers.etag
this.lastTabId = response.lastTabId
this.lastTabId = response.tabId
this.notifications = response.data
this._setPollingInterval(this.pollIntervalBase)
} else if (response.status === 304) {
Expand Down
4 changes: 4 additions & 0 deletions src/Components/Notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ export default {
this._$el = $(this.$el)

// Parents: TransitionGroup > NotificationsList
if (typeof this.$parent.$parent.showBrowserNotifications === 'undefined') {
console.error('Failed to read showBrowserNotifications property from App component')
}

if (this.$parent.$parent.showBrowserNotifications) {
this._createWebNotification()
}
Expand Down