Chore: Fix presence for current user (#1001)
Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
This commit is contained in:
@@ -44,6 +44,8 @@ module OnlineStatusTracker
|
||||
|
||||
def self.get_available_users(account_id)
|
||||
user_ids = ::Redis::Alfred.zrangebyscore(presence_key(account_id, 'User'), (Time.zone.now - PRESENCE_DURATION).to_i, Time.now.to_i)
|
||||
return {} if user_ids.blank?
|
||||
|
||||
user_availabilities = ::Redis::Alfred.hmget(status_key(account_id), user_ids)
|
||||
user_ids.map.with_index { |id, index| [id, (user_availabilities[index] || 'online')] }.to_h
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user