Fix headers for ESR 5.9 (#3738)

* Fix headers for ESR 5.9

* check if reactions is defined to avoid a crash with servers without metadata
This commit is contained in:
Elias Nahum
2019-12-20 01:33:28 -03:00
committed by Miguel Alatzar
parent 2fa2e05f49
commit a8e3b608ad
4 changed files with 16 additions and 4 deletions

View File

@@ -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,

View File

@@ -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();
});

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "mattermost-mobile",
"version": "1.26.0",
"version": "1.26.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -154,4 +154,4 @@
"node_modules/(?!react-native|jail-monkey|@sentry/react-native|react-navigation|@react-native-community/cameraroll)"
]
}
}
}