Merge pull request #828 from matrix-org/erikj/joined_hosts_for_room
Make get_joined_hosts_for_room use get_users_in_room
This commit is contained in:
commit
d06f2a229e
|
@ -238,23 +238,10 @@ class RoomMemberStore(SQLBaseStore):
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
@cached(max_entries=5000)
|
@cachedInlineCallbacks(max_entries=5000)
|
||||||
def get_joined_hosts_for_room(self, room_id):
|
def get_joined_hosts_for_room(self, room_id):
|
||||||
return self.runInteraction(
|
user_ids = yield self.get_users_in_room(room_id)
|
||||||
"get_joined_hosts_for_room",
|
defer.returnValue(set(get_domain_from_id(uid) for uid in user_ids))
|
||||||
self._get_joined_hosts_for_room_txn,
|
|
||||||
room_id,
|
|
||||||
)
|
|
||||||
|
|
||||||
def _get_joined_hosts_for_room_txn(self, txn, room_id):
|
|
||||||
rows = self._get_members_rows_txn(
|
|
||||||
txn,
|
|
||||||
room_id, membership=Membership.JOIN
|
|
||||||
)
|
|
||||||
|
|
||||||
joined_domains = set(get_domain_from_id(r["user_id"]) for r in rows)
|
|
||||||
|
|
||||||
return joined_domains
|
|
||||||
|
|
||||||
def _get_members_events_txn(self, txn, room_id, membership=None, user_id=None):
|
def _get_members_events_txn(self, txn, room_id, membership=None, user_id=None):
|
||||||
rows = self._get_members_rows_txn(
|
rows = self._get_members_rows_txn(
|
||||||
|
|
Loading…
Reference in New Issue