2022-02-22 23:31:40 +02:00
|
|
|
import BooleanSetting from '../helpers/boolean_setting.vue'
|
|
|
|
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
2020-05-03 17:36:12 +03:00
|
|
|
|
2026-06-16 17:32:26 +03:00
|
|
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
2026-06-15 20:02:22 +03:00
|
|
|
|
2026-06-17 14:26:41 +03:00
|
|
|
import { updateNotificationSettings } from 'src/services/api/user.js'
|
2026-06-15 20:02:22 +03:00
|
|
|
|
2020-05-10 06:46:06 +03:00
|
|
|
const NotificationsTab = {
|
2026-01-06 16:22:52 +02:00
|
|
|
data() {
|
2020-05-03 17:36:12 +03:00
|
|
|
return {
|
|
|
|
|
activeTab: 'profile',
|
2026-01-06 16:22:52 +02:00
|
|
|
notificationSettings:
|
|
|
|
|
this.$store.state.users.currentUser.notification_settings,
|
|
|
|
|
newDomainToMute: '',
|
2020-05-03 17:36:12 +03:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
2026-01-06 16:22:52 +02:00
|
|
|
BooleanSetting,
|
2020-05-03 17:36:12 +03:00
|
|
|
},
|
|
|
|
|
computed: {
|
2026-01-06 16:22:52 +02:00
|
|
|
user() {
|
2020-05-03 17:36:12 +03:00
|
|
|
return this.$store.state.users.currentUser
|
2022-02-22 23:31:40 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
canReceiveReports() {
|
|
|
|
|
if (!this.user) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
2026-06-10 18:09:49 +03:00
|
|
|
return this.user.privileges.has('reports_manage_reports')
|
2023-11-19 16:12:43 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
...SharedComputedObject(),
|
2020-05-03 17:36:12 +03:00
|
|
|
},
|
|
|
|
|
methods: {
|
2026-01-06 16:22:52 +02:00
|
|
|
updateNotificationSettings() {
|
2026-06-15 20:02:22 +03:00
|
|
|
updateNotificationSettings({
|
2026-06-16 17:32:26 +03:00
|
|
|
credentials: useOAuthStore().token,
|
2026-01-06 16:22:52 +02:00
|
|
|
settings: this.notificationSettings,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-05-03 17:36:12 +03:00
|
|
|
}
|
|
|
|
|
|
2020-05-10 06:46:06 +03:00
|
|
|
export default NotificationsTab
|