Skip to content

Commit

Permalink
Fix status is added bookmark category statuses list on bottom when bo…
Browse files Browse the repository at this point in the history
…okmark
  • Loading branch information
kmycode committed Sep 24, 2023
1 parent 60d36d7 commit 70258ea
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/javascript/mastodon/reducers/bookmark_categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ const appendToBookmarkCategoryStatusesById = (state, bookmarkCategoryId, statuse
}));
};

const prependToBookmarkCategoryStatusesById = (state, bookmarkCategoryId, statuses) => {
return state.update(bookmarkCategoryId, listMap => listMap.withMutations(map => {
map.set('isLoading', false);
if (map.get('items')) {
map.update('items', list => ImmutableOrderedSet([statuses]).union(list));
}
}));
};

const removeStatusFromBookmarkCategoryById = (state, bookmarkCategoryId, status) => {
if (state.getIn([bookmarkCategoryId, 'items'])) {
return state.updateIn([bookmarkCategoryId, 'items'], items => items.delete(status));
Expand Down Expand Up @@ -107,7 +116,8 @@ export default function bookmarkCategories(state = initialState, action) {
case BOOKMARK_CATEGORY_STATUSES_EXPAND_SUCCESS:
return appendToBookmarkCategoryStatuses(state, action.id, action.statuses, action.next);
case BOOKMARK_CATEGORY_EDITOR_ADD_SUCCESS:
return appendToBookmarkCategoryStatusesById(state, action.bookmarkCategoryId, action.statusId, undefined);
console.log('HERE')

Check warning on line 119 in app/javascript/mastodon/reducers/bookmark_categories.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
return prependToBookmarkCategoryStatusesById(state, action.bookmarkCategoryId, action.statusId);
case BOOKMARK_CATEGORY_EDITOR_REMOVE_SUCCESS:
return removeStatusFromBookmarkCategoryById(state, action.bookmarkCategoryId, action.statusId);
case UNBOOKMARK_SUCCESS:
Expand Down

0 comments on commit 70258ea

Please sign in to comment.