diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-10-19 01:47:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 01:47:29 +0200 |
commit | a38a452481d0f5207bb27ba7a2707c0028d2ac18 (patch) | |
tree | 5dfe4cab0fd6ebe15c924bd83e3abb6efca210db /app/javascript/mastodon/reducers/conversations.js | |
parent | bebe8ec887ba67c51353e09d7758819b117bf62d (diff) |
Add unread indicator to conversations (#9009)
Diffstat (limited to 'app/javascript/mastodon/reducers/conversations.js')
-rw-r--r-- | app/javascript/mastodon/reducers/conversations.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/javascript/mastodon/reducers/conversations.js b/app/javascript/mastodon/reducers/conversations.js index 6b3f22d25..ea39fccee 100644 --- a/app/javascript/mastodon/reducers/conversations.js +++ b/app/javascript/mastodon/reducers/conversations.js @@ -6,6 +6,7 @@ import { CONVERSATIONS_FETCH_SUCCESS, CONVERSATIONS_FETCH_FAIL, CONVERSATIONS_UPDATE, + CONVERSATIONS_READ, } from '../actions/conversations'; import compareId from '../compare_id'; @@ -18,6 +19,7 @@ const initialState = ImmutableMap({ const conversationToMap = item => ImmutableMap({ id: item.id, + unread: item.unread, accounts: ImmutableList(item.accounts.map(a => a.id)), last_status: item.last_status.id, }); @@ -80,6 +82,14 @@ export default function conversations(state = initialState, action) { return state.update('mounted', count => count + 1); case CONVERSATIONS_UNMOUNT: return state.update('mounted', count => count - 1); + case CONVERSATIONS_READ: + return state.update('items', list => list.map(item => { + if (item.get('id') === action.id) { + return item.set('unread', false); + } + + return item; + })); default: return state; } |