feat: Ability to block contacts permanently (#8922)

Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
Sojan Jose
2024-02-22 03:48:42 +05:30
committed by GitHub
parent c031cb19d2
commit ae4c8d818f
10 changed files with 63 additions and 28 deletions

View File

@@ -3,26 +3,16 @@ module ConversationMuteHelpers
def mute!
resolved!
Redis::Alfred.setex(mute_key, 1, mute_period)
contact.update(blocked: true)
create_muted_message
end
def unmute!
Redis::Alfred.delete(mute_key)
contact.update(blocked: false)
create_unmuted_message
end
def muted?
Redis::Alfred.get(mute_key).present?
end
private
def mute_key
format(Redis::RedisKeys::CONVERSATION_MUTE_KEY, id: id)
end
def mute_period
6.hours
contact.blocked?
end
end