Feature: Ability to mute contacts (#891)

fixes: #867
This commit is contained in:
Abdulkadir Poyraz
2020-05-26 15:13:59 +03:00
committed by GitHub
parent d8d14fc4a4
commit b1aab228ae
16 changed files with 148 additions and 2 deletions

View File

@@ -74,6 +74,15 @@ class Conversation < ApplicationRecord
save
end
def mute!
resolved!
Redis::Alfred.setex(mute_key, 1, mute_period)
end
def muted?
!Redis::Alfred.get(mute_key).nil?
end
def lock!
update!(locked: true)
end
@@ -184,4 +193,12 @@ class Conversation < ApplicationRecord
messages.create(activity_message_params(content))
end
def mute_key
format('CONVERSATION::%<id>d::MUTED', id: id)
end
def mute_period
6.hours
end
end