Skip to content

Commit

Permalink
Merge pull request #134 from jadolg/fix-channels-online
Browse files Browse the repository at this point in the history
Fix the channels_online
  • Loading branch information
jadolg authored Aug 6, 2021
2 parents 0ae412d + 93343ab commit 8f772d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions rocketchat_API/APISections/channels.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json

from rocketchat_API.APIExceptions.RocketExceptions import RocketMissingParamException
from rocketchat_API.APISections.base import RocketChatBase

Expand Down Expand Up @@ -242,7 +244,7 @@ def channels_counters(self, room_id=None, room_name=None, **kwargs):
)
raise RocketMissingParamException("room_id or room_name required")

def channels_online(self, _id):
def channels_online(self, query):
"""Lists all online users of a channel if the channel's id is provided, otherwise it gets all online users of
all channels."""
return self.call_api_get("channels.online", _id=_id)
return self.call_api_get("channels.online", query=json.dumps(query))
4 changes: 2 additions & 2 deletions tests/test_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,6 @@ def test_channels_counters(logged_rocket):


def test_channels_online(logged_rocket):
channels_online = logged_rocket.channels_online(_id="GENERAL").json()
channels_online = logged_rocket.channels_online(query={"_id": "GENERAL"}).json()
assert channels_online.get("success")
assert channels_online.get("online") == []
assert len(channels_online.get("online")) >= 1

0 comments on commit 8f772d5

Please sign in to comment.