diff --git a/app/components/reactions/index.js b/app/components/reactions/index.js index 62dc1914d..a959f7b44 100644 --- a/app/components/reactions/index.js +++ b/app/components/reactions/index.js @@ -44,7 +44,12 @@ function makeMapStateToProps() { channel: channelId, permission: Permissions.ADD_REACTION, }); - canAddMoreReactions = Object.values(reactions).length < MAX_ALLOWED_REACTIONS; + + if (reactions) { + // On servers without metadata reactions at this point can be undefined + canAddMoreReactions = Object.values(reactions).length < MAX_ALLOWED_REACTIONS; + } + canRemoveReaction = haveIChannelPermission(state, { team: teamId, channel: channelId, diff --git a/app/utils/security.js b/app/utils/security.js index abee13504..40946f5ef 100644 --- a/app/utils/security.js +++ b/app/utils/security.js @@ -19,7 +19,14 @@ export function setCSRFFromCookie(url) { CookieManager.get(url, false).then((res) => { const token = res.MMCSRF; if (token) { - Client4.setCSRF(token?.value || token); + let value = null; + if (typeof token === 'object' && Object.prototype.hasOwnProperty.call(token, 'value')) { + value = token.value; + } else { + value = token; + } + + Client4.setCSRF(value); } resolve(); }); diff --git a/package-lock.json b/package-lock.json index ac94108ff..6d82081c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "mattermost-mobile", - "version": "1.26.0", + "version": "1.26.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index e2491b96f..17f6e9cbd 100644 --- a/package.json +++ b/package.json @@ -154,4 +154,4 @@ "node_modules/(?!react-native|jail-monkey|@sentry/react-native|react-navigation|@react-native-community/cameraroll)" ] } -} \ No newline at end of file +}