From 7b5ea7270db8de2a57e3a93dad4aaa5cd46d2d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lanie=20Chauvel=20=28ariasuni=29?= Date: Sat, 11 Aug 2018 11:52:53 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20crash=20when=20clicking=20=E2=80=9CShow?= =?UTF-8?q?=20more/less=20for=20all=E2=80=9D=20when=20a=20toot=20is=20not?= =?UTF-8?q?=20visible=20(#8118)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/mastodon/reducers/statuses.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/reducers/statuses.js b/app/javascript/mastodon/reducers/statuses.js index 3abe69bce..6e3d830da 100644 --- a/app/javascript/mastodon/reducers/statuses.js +++ b/app/javascript/mastodon/reducers/statuses.js @@ -49,11 +49,19 @@ export default function statuses(state = initialState, action) { return state.setIn([action.id, 'muted'], false); case STATUS_REVEAL: return state.withMutations(map => { - action.ids.forEach(id => map.setIn([id, 'hidden'], false)); + action.ids.forEach(id => { + if (!(state.get(id) === undefined)) { + map.setIn([id, 'hidden'], false); + } + }); }); case STATUS_HIDE: return state.withMutations(map => { - action.ids.forEach(id => map.setIn([id, 'hidden'], true)); + action.ids.forEach(id => { + if (!(state.get(id) === undefined)) { + map.setIn([id, 'hidden'], true); + } + }); }); case TIMELINE_DELETE: return deleteStatus(state, action.id, action.references);