Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2022-11-07 17:09:08 +0300
committerGitHub <noreply@github.com>2022-11-07 17:09:08 +0300
commitd7a4b80d1b45d1b13b2b10217c283fc9064b352f (patch)
treef39ce3e7b4be368c895271a5eeeb287ba222c263
parent6c470b9edfea647fc13cc5a716902acb01dc328c (diff)
parentbe1338f5f025dfa4a7a65038723f04a5aa4505d7 (diff)
Merge pull request #8286 from nextcloud/techdebt/noid/initial-state-has-fallback-by-now
Use the fallback of initial state directly
-rw-r--r--src/store/fileUploadStore.js6
-rw-r--r--src/store/fileUploadStore.spec.js1
-rw-r--r--src/store/helper.js29
-rw-r--r--src/store/settingsStore.js4
-rw-r--r--src/store/soundsStore.js4
5 files changed, 7 insertions, 37 deletions
diff --git a/src/store/fileUploadStore.js b/src/store/fileUploadStore.js
index 581949d99..2fa6304c3 100644
--- a/src/store/fileUploadStore.js
+++ b/src/store/fileUploadStore.js
@@ -23,7 +23,7 @@
import Vue from 'vue'
import client from '../services/DavClient.js'
import { showError } from '@nextcloud/dialogs'
-import fromStateOr from './helper.js'
+import { loadState } from '@nextcloud/initial-state'
import { findUniquePath, getFileExtension } from '../utils/fileUpload.js'
import moment from '@nextcloud/moment'
import { EventBus } from '../services/EventBus.js'
@@ -34,8 +34,8 @@ import {
import { setAttachmentFolder } from '../services/settingsService.js'
const state = {
- attachmentFolder: fromStateOr('spreed', 'attachment_folder', ''),
- attachmentFolderFreeSpace: fromStateOr('spreed', 'attachment_folder_free_space', 0),
+ attachmentFolder: loadState('spreed', 'attachment_folder', ''),
+ attachmentFolderFreeSpace: loadState('spreed', 'attachment_folder_free_space', 0),
uploads: {
},
currentUploadId: undefined,
diff --git a/src/store/fileUploadStore.spec.js b/src/store/fileUploadStore.spec.js
index fcc5c5701..1b345a891 100644
--- a/src/store/fileUploadStore.spec.js
+++ b/src/store/fileUploadStore.spec.js
@@ -13,7 +13,6 @@ import { showError } from '@nextcloud/dialogs'
import fileUploadStore from './fileUploadStore.js'
jest.mock('../services/DavClient')
-jest.mock('./helper')
jest.mock('../utils/fileUpload', () => ({
findUniquePath: jest.fn(),
getFileExtension: jest.fn(),
diff --git a/src/store/helper.js b/src/store/helper.js
deleted file mode 100644
index 4844990e8..000000000
--- a/src/store/helper.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * @copyright Copyright (c) 2021 Joas Schilling <coding@schilljs.com>
- *
- * @license AGPL-3.0-or-later
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-import { loadState } from '@nextcloud/initial-state'
-
-export default (app, key, orValue) => {
- try {
- return loadState(app, key)
- } catch (e) {
- return orValue
- }
-}
diff --git a/src/store/settingsStore.js b/src/store/settingsStore.js
index d6753716a..d42b5e8d8 100644
--- a/src/store/settingsStore.js
+++ b/src/store/settingsStore.js
@@ -18,12 +18,12 @@
*
*/
-import fromStateOr from './helper.js'
+import { loadState } from '@nextcloud/initial-state'
import { setReadStatusPrivacy } from '../services/settingsService.js'
import { PRIVACY } from '../constants.js'
const state = {
- readStatusPrivacy: fromStateOr('spreed', 'read_status_privacy', PRIVACY.PRIVATE),
+ readStatusPrivacy: loadState('spreed', 'read_status_privacy', PRIVACY.PRIVATE),
}
const getters = {
diff --git a/src/store/soundsStore.js b/src/store/soundsStore.js
index 607f699af..889c90803 100644
--- a/src/store/soundsStore.js
+++ b/src/store/soundsStore.js
@@ -20,13 +20,13 @@
*
*/
-import fromStateOr from './helper.js'
+import { loadState } from '@nextcloud/initial-state'
import BrowserStorage from '../services/BrowserStorage.js'
import { setPlaySounds } from '../services/settingsService.js'
const state = {
userId: undefined,
- playSoundsUser: fromStateOr('spreed', 'play_sounds', false),
+ playSoundsUser: loadState('spreed', 'play_sounds', false),
playSoundsGuest: BrowserStorage.getItem('play_sounds') !== 'no',
}