feat: Add API to get the active contacts (#1313)
This commit is contained in:
@@ -37,9 +37,13 @@ module OnlineStatusTracker
|
||||
format(::Redis::Alfred::ONLINE_STATUS, account_id: account_id)
|
||||
end
|
||||
|
||||
def self.get_available_contact_ids(account_id)
|
||||
::Redis::Alfred.zrangebyscore(presence_key(account_id, 'Contact'), (Time.zone.now - PRESENCE_DURATION).to_i, Time.now.to_i)
|
||||
end
|
||||
|
||||
def self.get_available_contacts(account_id)
|
||||
contact_ids = ::Redis::Alfred.zrangebyscore(presence_key(account_id, 'Contact'), (Time.zone.now - PRESENCE_DURATION).to_i, Time.now.to_i)
|
||||
contact_ids.index_with { |_id| 'online' }
|
||||
# returns {id1: 'online', id2: 'online'}
|
||||
get_available_contact_ids(account_id).index_with { |_id| 'online' }
|
||||
end
|
||||
|
||||
def self.get_available_users(account_id)
|
||||
|
||||
Reference in New Issue
Block a user