From 768d843e377e8c2852bf05b0dc72b98ac3f62a20 Mon Sep 17 00:00:00 2001 From: enahum Date: Thu, 1 Feb 2018 17:37:20 -0300 Subject: [PATCH] Hotfix for release-1.5 (#1405) * Request data retention policies only when the user is logged in (#1351) * Bump App version to 1.5.3 * Bump app build version to 83 --- android/app/build.gradle | 4 ++-- app/actions/views/login.js | 11 +++++++++++ app/actions/views/root.js | 13 ++++++++----- ios/Mattermost.xcodeproj/project.pbxproj | 4 ++-- ios/Mattermost/Info.plist | 4 ++-- ios/MattermostTests/Info.plist | 4 ++-- 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 2f8ebd76d..3417962cd 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -106,8 +106,8 @@ android { applicationId "com.mattermost.rnbeta" minSdkVersion 21 targetSdkVersion 23 - versionCode 77 - versionName "1.5.2" + versionCode 83 + versionName "1.5.3" multiDexEnabled true ndk { abiFilters "armeabi-v7a", "x86" diff --git a/app/actions/views/login.js b/app/actions/views/login.js index 513507d64..eb69aa0e6 100644 --- a/app/actions/views/login.js +++ b/app/actions/views/login.js @@ -1,5 +1,7 @@ // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. + +import {getDataRetentionPolicy} from 'mattermost-redux/actions/general'; import {GeneralTypes} from 'mattermost-redux/action_types'; import {Client, Client4} from 'mattermost-redux/client'; @@ -25,8 +27,10 @@ export function handlePasswordChanged(password) { export function handleSuccessfulLogin() { return async (dispatch, getState) => { + const {config, license} = getState().entities.general; const token = Client4.getToken(); const url = Client4.getUrl(); + dispatch({ type: GeneralTypes.RECEIVED_APP_CREDENTIALS, data: { @@ -38,6 +42,13 @@ export function handleSuccessfulLogin() { Client.setToken(token); Client.setUrl(url); + if (config.DataRetentionEnableMessageDeletion && config.DataRetentionEnableMessageDeletion === 'true' && + license.IsLicensed === 'true' && license.DataRetention === 'true') { + getDataRetentionPolicy()(dispatch, getState); + } else { + dispatch({type: GeneralTypes.RECEIVED_DATA_RETENTION_POLICY, data: {}}); + } + return true; }; } diff --git a/app/actions/views/root.js b/app/actions/views/root.js index 43fbb0d24..f27b7190c 100644 --- a/app/actions/views/root.js +++ b/app/actions/views/root.js @@ -19,6 +19,7 @@ import { export function loadConfigAndLicense() { return async (dispatch, getState) => { + const {currentUserId} = getState().entities.users; const [configData, licenseData] = await Promise.all([ getClientConfig()(dispatch, getState), getLicenseConfig()(dispatch, getState) @@ -27,11 +28,13 @@ export function loadConfigAndLicense() { const config = configData.data || {}; const license = licenseData.data || {}; - if (config.DataRetentionEnableMessageDeletion && config.DataRetentionEnableMessageDeletion === 'true' && - license.IsLicensed === 'true' && license.DataRetention === 'true') { - getDataRetentionPolicy()(dispatch, getState); - } else { - dispatch({type: GeneralTypes.RECEIVED_DATA_RETENTION_POLICY, data: {}}); + if (currentUserId) { + if (config.DataRetentionEnableMessageDeletion && config.DataRetentionEnableMessageDeletion === 'true' && + license.IsLicensed === 'true' && license.DataRetention === 'true') { + getDataRetentionPolicy()(dispatch, getState); + } else { + dispatch({type: GeneralTypes.RECEIVED_DATA_RETENTION_POLICY, data: {}}); + } } return {config, license}; diff --git a/ios/Mattermost.xcodeproj/project.pbxproj b/ios/Mattermost.xcodeproj/project.pbxproj index 9bbe8c507..8923d321e 100644 --- a/ios/Mattermost.xcodeproj/project.pbxproj +++ b/ios/Mattermost.xcodeproj/project.pbxproj @@ -2156,7 +2156,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 77; + CURRENT_PROJECT_VERSION = 83; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; @@ -2206,7 +2206,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = Mattermost/Mattermost.entitlements; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 77; + CURRENT_PROJECT_VERSION = 83; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = UQ8HT4Q2XM; ENABLE_BITCODE = NO; diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist index 249c0b524..3921bb5cb 100644 --- a/ios/Mattermost/Info.plist +++ b/ios/Mattermost/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.5.2 + 1.5.3 CFBundleSignature ???? CFBundleURLTypes @@ -32,7 +32,7 @@ CFBundleVersion - 77 + 83 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/MattermostTests/Info.plist b/ios/MattermostTests/Info.plist index e8144c8a1..46875036d 100644 --- a/ios/MattermostTests/Info.plist +++ b/ios/MattermostTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.5.2 + 1.5.3 CFBundleSignature ???? CFBundleVersion - 77 + 83