0
0
Fork 0

Keep notification when muting_notifications is true (#7311)

* Keep notification when muting_notifications is true

* Retrun mute object

* Fix test
This commit is contained in:
abcang 2018-05-02 23:14:51 +09:00 committed by Eugen Rochko
parent d0cdd5cf94
commit 71a7cea73f
4 changed files with 34 additions and 39 deletions

View file

@ -105,7 +105,7 @@ export default function notifications(state = initialState, action) {
return expandNormalizedNotifications(state, action.notifications, action.next);
case ACCOUNT_BLOCK_SUCCESS:
case ACCOUNT_MUTE_SUCCESS:
return filterNotifications(state, action.relationship);
return action.relationship.muting_notifications ? filterNotifications(state, action.relationship) : state;
case NOTIFICATIONS_CLEAR:
return state.set('items', ImmutableList()).set('hasMore', false);
case TIMELINE_DELETE:

View file

@ -93,6 +93,7 @@ module AccountInteractions
if mute.hide_notifications? != notifications
mute.update!(hide_notifications: notifications)
end
mute
end
def mute_conversation!(conversation)

View file

@ -3,9 +3,13 @@
class MuteService < BaseService
def call(account, target_account, notifications: nil)
return if account.id == target_account.id
FeedManager.instance.clear_from_timeline(account, target_account)
mute = account.mute!(target_account, notifications: notifications)
BlockWorker.perform_async(account.id, target_account.id)
if mute.hide_notifications?
BlockWorker.perform_async(account.id, target_account.id)
else
FeedManager.instance.clear_from_timeline(account, target_account)
end
mute
end
end