Skip to content

Commit 0b4309b

Browse files
authored
Merge pull request #1376 from nextcloud/bugfix/1375/update-user-status-with-event-data
Update user status with event data
2 parents bf6d132 + 92d33de commit 0b4309b

9 files changed

+21
-10
lines changed

js/notifications-admin-settings.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/notifications-admin-settings.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/notifications-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/notifications-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/notifications-settings.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/notifications-settings.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"stylelint:fix": "stylelint css/*.css css/*.scss src/**/*.scss src/**/*.vue --fix"
1616
},
1717
"dependencies": {
18+
"@nextcloud/auth": "^2.0.0",
1819
"@nextcloud/axios": "^2.1.0",
1920
"@nextcloud/browser-storage": "^0.2.0",
2021
"@nextcloud/capabilities": "^1.0.4",

src/NotificationsApp.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ import Notification from './Components/Notification.vue'
9999
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
100100
import Close from 'vue-material-design-icons/Close.vue'
101101
import axios from '@nextcloud/axios'
102+
import { getCurrentUser } from '@nextcloud/auth'
102103
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
103104
import { showError } from '@nextcloud/dialogs'
104105
import { loadState } from '@nextcloud/initial-state'
@@ -233,20 +234,28 @@ export default {
233234
this.hasNotifyPush = true
234235
}
235236
236-
// Setup the background checker
237+
// Set up the background checker
237238
this._setPollingInterval(this.pollIntervalBase)
238239
239240
this._watchTabVisibility()
240241
subscribe('networkOffline', this.handleNetworkOffline)
241242
subscribe('networkOnline', this.handleNetworkOnline)
243+
subscribe('user_status:status.updated', this.userStatusUpdated)
242244
},
243245
244246
beforeDestroy() {
247+
unsubscribe('user_status:status.updated', this.userStatusUpdated)
245248
unsubscribe('networkOffline', this.handleNetworkOffline)
246249
unsubscribe('networkOnline', this.handleNetworkOnline)
247250
},
248251
249252
methods: {
253+
userStatusUpdated(state) {
254+
if (getCurrentUser().uid === state.userId) {
255+
this.userStatus = state.status
256+
}
257+
},
258+
250259
onOpen() {
251260
this.focusFirstFocusable()
252261
this.requestWebNotificationPermissions()

0 commit comments

Comments
 (0)