From 9115497c92da395b356508d1f948b7396f268172 Mon Sep 17 00:00:00 2001 From: Maximilian Harz Date: Mon, 7 Apr 2025 16:57:10 +0200 Subject: [PATCH] Fix linting --- webapp/pages/settings/notifications.spec.js | 24 ++++++------- webapp/pages/settings/notifications.vue | 38 +++++++++++++-------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/webapp/pages/settings/notifications.spec.js b/webapp/pages/settings/notifications.spec.js index b8c782b3e..bfe9f8935 100644 --- a/webapp/pages/settings/notifications.spec.js +++ b/webapp/pages/settings/notifications.spec.js @@ -1,6 +1,6 @@ import Vuex from 'vuex' import { mount } from '@vue/test-utils' -import {render, fireEvent, screen} from '@testing-library/vue' +import { render, fireEvent, screen } from '@testing-library/vue' import Notifications from './notifications.vue' const localVue = global.localVue @@ -12,7 +12,7 @@ describe('notifications.vue', () => { beforeEach(() => { mocks = { - $t: jest.fn(v => v), + $t: jest.fn((v) => v), $apollo: { mutate: jest.fn(), }, @@ -29,37 +29,37 @@ describe('notifications.vue', () => { name: 'MyAccount', emailNotificationSettings: [ { - type: "post", + type: 'post', settings: [ { - name: "commentOnObservedPost", + name: 'commentOnObservedPost', value: true, }, { - name: "mention", + name: 'mention', value: false, - } + }, ], }, { - type: "group", + type: 'group', settings: [ { - name: "groupMemberJoined", + name: 'groupMemberJoined', value: true, }, { - name: "groupMemberLeft", + name: 'groupMemberLeft', value: true, }, { - name: "groupMemberRemoved", + name: 'groupMemberRemoved', value: false, }, { - name: "groupMemberRoleChanged", + name: 'groupMemberRoleChanged', value: true, - } + }, ], }, ], diff --git a/webapp/pages/settings/notifications.vue b/webapp/pages/settings/notifications.vue index 934110f34..0f63a65d2 100644 --- a/webapp/pages/settings/notifications.vue +++ b/webapp/pages/settings/notifications.vue @@ -3,7 +3,7 @@

{{ $t('settings.notifications.name') }}

{{ $t(`settings.notifications.${topic.type}`) }}

-
+
@@ -35,29 +35,37 @@ export default { currentUser: 'auth/user', }), isSubmitDisabled() { - return this.emailNotificationSettings.every( - (topic) => topic.settings.every(setting => setting.value === this.currentUser.emailNotificationSettings.find(t => t.type === topic.type).settings.find(s => s.name === setting.name).value), + return this.emailNotificationSettings.every((topic) => + topic.settings.every( + (setting) => + setting.value === + this.currentUser.emailNotificationSettings + .find((t) => t.type === topic.type) + .settings.find((s) => s.name === setting.name).value, + ), ) }, isCheckAllDisabled() { - return this.emailNotificationSettings.every( - (topic) => topic.settings.every(setting => setting.value), + return this.emailNotificationSettings.every((topic) => + topic.settings.every((setting) => setting.value), ) }, isUncheckAllDisabled() { - return this.emailNotificationSettings.every( - (topic) => topic.settings.every(setting => !setting.value), + return this.emailNotificationSettings.every((topic) => + topic.settings.every((setting) => !setting.value), ) }, }, created() { - this.emailNotificationSettings = [ ...this.currentUser.emailNotificationSettings.map(topic => ({ - type: topic.type, - settings: topic.settings.map(setting => ({ - name: setting.name, - value: setting.value, + this.emailNotificationSettings = [ + ...this.currentUser.emailNotificationSettings.map((topic) => ({ + type: topic.type, + settings: topic.settings.map((setting) => ({ + name: setting.name, + value: setting.value, + })), })), - }))] + ] }, methods: { ...mapMutations({ @@ -94,7 +102,9 @@ export default { mutation: updateUserMutation(), variables: { id: this.currentUser.id, - emailNotificationSettings: this.transformToEmailSettingsInput(this.emailNotificationSettings), + emailNotificationSettings: this.transformToEmailSettingsInput( + this.emailNotificationSettings, + ), }, update: (_, { data: { UpdateUser } }) => { const { emailNotificationSettings } = UpdateUser