diff options
Diffstat (limited to 'apps/user_status/src/store/userStatus.js')
-rw-r--r-- | apps/user_status/src/store/userStatus.js | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/apps/user_status/src/store/userStatus.js b/apps/user_status/src/store/userStatus.js index c54fbe5040b..9bc86ab5062 100644 --- a/apps/user_status/src/store/userStatus.js +++ b/apps/user_status/src/store/userStatus.js @@ -1,23 +1,6 @@ /** - * @copyright Copyright (c) 2020 Georg Ehrke - * - * @author Georg Ehrke <oc.list@georgehrke.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/>. - * + * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ import { @@ -26,16 +9,16 @@ import { setPredefinedMessage, setCustomMessage, clearMessage, -} from '../services/statusService' +} from '../services/statusService.js' import { loadState } from '@nextcloud/initial-state' import { getCurrentUser } from '@nextcloud/auth' -import { getTimestampForClearAt } from '../services/clearAtService' +import { getTimestampForClearAt } from '../services/clearAtService.js' import { emit } from '@nextcloud/event-bus' const state = { // Status (online / away / dnd / invisible / offline) status: null, - // Whether or not the status is user-defined + // Whether the status is user-defined statusIsUserDefined: null, // A custom message set by the user message: null, @@ -43,7 +26,7 @@ const state = { icon: null, // When to automatically clean the status clearAt: null, - // Whether or not the message is predefined + // Whether the message is predefined // (and can automatically be translated by Nextcloud) messageIsPredefined: null, // The id of the message in case it's predefined @@ -130,12 +113,23 @@ const mutations = { */ loadStatusFromServer(state, { status, statusIsUserDefined, message, icon, clearAt, messageIsPredefined, messageId }) { state.status = status - state.statusIsUserDefined = statusIsUserDefined state.message = message state.icon = icon - state.clearAt = clearAt - state.messageIsPredefined = messageIsPredefined - state.messageId = messageId + + // Don't overwrite certain values if the refreshing comes in via short updates + // E.g. from talk participant list which only has the status, message and icon + if (typeof statusIsUserDefined !== 'undefined') { + state.statusIsUserDefined = statusIsUserDefined + } + if (typeof clearAt !== 'undefined') { + state.clearAt = clearAt + } + if (typeof messageIsPredefined !== 'undefined') { + state.messageIsPredefined = messageIsPredefined + } + if (typeof messageId !== 'undefined') { + state.messageId = messageId + } }, } |