* MM-24451 Set prev app version to current on logout/reset cache * Fix unit tests for master Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
parent
43c42caba7
commit
f4e180d339
3 changed files with 11 additions and 6 deletions
|
|
@ -279,7 +279,7 @@ class GlobalEventHandler {
|
|||
app: {
|
||||
build: DeviceInfo.getBuildNumber(),
|
||||
version: DeviceInfo.getVersion(),
|
||||
previousVersion: state.app?.previousVersion || DeviceInfo.getVersion(),
|
||||
previousVersion: DeviceInfo.getVersion(),
|
||||
},
|
||||
entities: {
|
||||
...initialState.entities,
|
||||
|
|
|
|||
|
|
@ -86,7 +86,10 @@ export function getStateForReset(initialState, currentState) {
|
|||
});
|
||||
|
||||
const resetState = merge(initialState, {
|
||||
app,
|
||||
app: {
|
||||
...app,
|
||||
previousVersion: DeviceInfo.getVersion(),
|
||||
},
|
||||
entities: {
|
||||
general: currentState.entities.general,
|
||||
users: {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
|
||||
import initialState from '@store/initial_state';
|
||||
import {getStateForReset} from '@store/utils';
|
||||
|
||||
|
|
@ -21,8 +23,8 @@ describe('getStateForReset', () => {
|
|||
const currentTeamId = 'current-team-id';
|
||||
const currentState = {
|
||||
app: {
|
||||
build: 'build',
|
||||
version: 'version',
|
||||
build: DeviceInfo.getBuildNumber(),
|
||||
version: DeviceInfo.getVersion(),
|
||||
previousVersion: 'previousVersion',
|
||||
},
|
||||
entities: {
|
||||
|
|
@ -87,9 +89,9 @@ describe('getStateForReset', () => {
|
|||
expect(themeKeys.length).toEqual(preferenceKeys.length);
|
||||
});
|
||||
|
||||
it('should keep app', () => {
|
||||
it('should set previous version as current', () => {
|
||||
const resetState = getStateForReset(initialState, currentState);
|
||||
const {app} = resetState;
|
||||
expect(app).toStrictEqual(currentState.app);
|
||||
expect(app.previousVersion).toStrictEqual(currentState.app.version);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue