Automated cherry pick of #3738 (#3740)

* Fix headers for ESR 5.9

* check if reactions is defined to avoid a crash with servers without metadata

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Mattermost Build 2019-12-20 05:37:07 +01:00 committed by Miguel Alatzar
parent f58c12f78d
commit ac8887e30c
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)"
]
}
}
}