about summary refs log tree commit diff
path: root/app/javascript/mastodon/reducers/statuses.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-11-13 23:02:10 +0100
committerEugen Rochko <eugen@zeonfederated.com>2019-11-13 23:02:10 +0100
commitdfea7368c934f600bd0b6b93b4a6c008a4e265b0 (patch)
tree9db2db756c89b70ec5f01b782b787465d4b45b07 /app/javascript/mastodon/reducers/statuses.js
parentafb398b583b23c139c5a069c1281550bb69760e0 (diff)
Add bookmarks (#7107)
* Add backend support for bookmarks

Bookmarks behave like favourites, except they aren't shared with other
users and do not have an associated counter.

* Add spec for bookmark endpoints

* Add front-end support for bookmarks

* Introduce OAuth scopes for bookmarks

* Add bookmarks to archive takeout

* Fix migration

* Coding style fixes

* Fix rebase issue

* Update bookmarked_statuses to latest UI changes

* Update bookmark actions to properly reflect status changes in state

* Add bookmarks item to single-column layout

* Make active bookmarks red
Diffstat (limited to 'app/javascript/mastodon/reducers/statuses.js')
-rw-r--r--app/javascript/mastodon/reducers/statuses.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/javascript/mastodon/reducers/statuses.js b/app/javascript/mastodon/reducers/statuses.js
index 372673bc0..772f98bcb 100644
--- a/app/javascript/mastodon/reducers/statuses.js
+++ b/app/javascript/mastodon/reducers/statuses.js
@@ -4,6 +4,8 @@ import {
   FAVOURITE_REQUEST,
   FAVOURITE_FAIL,
   UNFAVOURITE_SUCCESS,
+  BOOKMARK_REQUEST,
+  BOOKMARK_FAIL,
 } from '../actions/interactions';
 import {
   STATUS_MUTE_SUCCESS,
@@ -43,6 +45,10 @@ export default function statuses(state = initialState, action) {
     return state.setIn([action.status.get('id'), 'favourites_count'], favouritesCount - 1);
   case FAVOURITE_FAIL:
     return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'favourited'], false);
+  case BOOKMARK_REQUEST:
+    return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'bookmarked'], true);
+  case BOOKMARK_FAIL:
+    return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'bookmarked'], false);
   case REBLOG_REQUEST:
     return state.setIn([action.status.get('id'), 'reblogged'], true);
   case REBLOG_FAIL: