Comments
This commit is contained in:
parent
3431ec55dc
commit
14a34f12d7
|
@ -672,7 +672,7 @@ class FederationGroupsAddRoomsServlet(BaseFederationServlet):
|
||||||
if get_domain_from_id(requester_user_id) != origin:
|
if get_domain_from_id(requester_user_id) != origin:
|
||||||
raise SynapseError(403, "requester_user_id doesn't match origin")
|
raise SynapseError(403, "requester_user_id doesn't match origin")
|
||||||
|
|
||||||
new_content = yield self.handler.add_room(
|
new_content = yield self.handler.add_room_to_group(
|
||||||
group_id, requester_user_id, room_id, content
|
group_id, requester_user_id, room_id, content
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,7 @@ class GroupsServerHandler(object):
|
||||||
})
|
})
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def add_room(self, group_id, requester_user_id, room_id, content):
|
def add_room_to_group(self, group_id, requester_user_id, room_id, content):
|
||||||
"""Add room to group
|
"""Add room to group
|
||||||
"""
|
"""
|
||||||
yield self.check_group_is_ours(
|
yield self.check_group_is_ours(
|
||||||
|
|
|
@ -74,6 +74,8 @@ class GroupsLocalHandler(object):
|
||||||
get_group_profile = _create_rerouter("get_group_profile")
|
get_group_profile = _create_rerouter("get_group_profile")
|
||||||
get_rooms_in_group = _create_rerouter("get_rooms_in_group")
|
get_rooms_in_group = _create_rerouter("get_rooms_in_group")
|
||||||
|
|
||||||
|
add_room_to_group = _create_rerouter("add_room_to_group")
|
||||||
|
|
||||||
update_group_summary_room = _create_rerouter("update_group_summary_room")
|
update_group_summary_room = _create_rerouter("update_group_summary_room")
|
||||||
delete_group_summary_room = _create_rerouter("delete_group_summary_room")
|
delete_group_summary_room = _create_rerouter("delete_group_summary_room")
|
||||||
|
|
||||||
|
@ -130,6 +132,9 @@ class GroupsLocalHandler(object):
|
||||||
defer.returnValue(res)
|
defer.returnValue(res)
|
||||||
|
|
||||||
def create_group(self, group_id, user_id, content):
|
def create_group(self, group_id, user_id, content):
|
||||||
|
"""Create a group
|
||||||
|
"""
|
||||||
|
|
||||||
logger.info("Asking to create group with ID: %r", group_id)
|
logger.info("Asking to create group with ID: %r", group_id)
|
||||||
|
|
||||||
if self.is_mine_id(group_id):
|
if self.is_mine_id(group_id):
|
||||||
|
@ -141,18 +146,10 @@ class GroupsLocalHandler(object):
|
||||||
get_domain_from_id(group_id), group_id, user_id, content,
|
get_domain_from_id(group_id), group_id, user_id, content,
|
||||||
) # TODO
|
) # TODO
|
||||||
|
|
||||||
def add_room(self, group_id, user_id, room_id, content):
|
|
||||||
if self.is_mine_id(group_id):
|
|
||||||
return self.groups_server_handler.add_room(
|
|
||||||
group_id, user_id, room_id, content
|
|
||||||
)
|
|
||||||
|
|
||||||
return self.transport_client.add_room_to_group(
|
|
||||||
get_domain_from_id(group_id), group_id, user_id, room_id, content,
|
|
||||||
)
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_users_in_group(self, group_id, requester_user_id):
|
def get_users_in_group(self, group_id, requester_user_id):
|
||||||
|
"""Get users in a group
|
||||||
|
"""
|
||||||
if self.is_mine_id(group_id):
|
if self.is_mine_id(group_id):
|
||||||
res = yield self.groups_server_handler.get_users_in_group(
|
res = yield self.groups_server_handler.get_users_in_group(
|
||||||
group_id, requester_user_id
|
group_id, requester_user_id
|
||||||
|
@ -184,10 +181,14 @@ class GroupsLocalHandler(object):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def join_group(self, group_id, user_id, content):
|
def join_group(self, group_id, user_id, content):
|
||||||
|
"""Request to join a group
|
||||||
|
"""
|
||||||
raise NotImplementedError() # TODO
|
raise NotImplementedError() # TODO
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def accept_invite(self, group_id, user_id, content):
|
def accept_invite(self, group_id, user_id, content):
|
||||||
|
"""Accept an invite to a group
|
||||||
|
"""
|
||||||
if self.is_mine_id(group_id):
|
if self.is_mine_id(group_id):
|
||||||
yield self.groups_server_handler.accept_invite(
|
yield self.groups_server_handler.accept_invite(
|
||||||
group_id, user_id, content
|
group_id, user_id, content
|
||||||
|
@ -222,6 +223,8 @@ class GroupsLocalHandler(object):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def invite(self, group_id, user_id, requester_user_id, config):
|
def invite(self, group_id, user_id, requester_user_id, config):
|
||||||
|
"""Invite a user to a group
|
||||||
|
"""
|
||||||
content = {
|
content = {
|
||||||
"requester_user_id": requester_user_id,
|
"requester_user_id": requester_user_id,
|
||||||
"config": config,
|
"config": config,
|
||||||
|
@ -240,6 +243,8 @@ class GroupsLocalHandler(object):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def on_invite(self, group_id, user_id, content):
|
def on_invite(self, group_id, user_id, content):
|
||||||
|
"""One of our users were invited to a group
|
||||||
|
"""
|
||||||
# TODO: Support auto join and rejection
|
# TODO: Support auto join and rejection
|
||||||
|
|
||||||
if not self.is_mine_id(user_id):
|
if not self.is_mine_id(user_id):
|
||||||
|
@ -262,6 +267,8 @@ class GroupsLocalHandler(object):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def remove_user_from_group(self, group_id, user_id, requester_user_id, content):
|
def remove_user_from_group(self, group_id, user_id, requester_user_id, content):
|
||||||
|
"""Remove a user from a group
|
||||||
|
"""
|
||||||
if user_id == requester_user_id:
|
if user_id == requester_user_id:
|
||||||
yield self.store.register_user_group_membership(
|
yield self.store.register_user_group_membership(
|
||||||
group_id, user_id,
|
group_id, user_id,
|
||||||
|
@ -286,6 +293,8 @@ class GroupsLocalHandler(object):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def user_removed_from_group(self, group_id, user_id, content):
|
def user_removed_from_group(self, group_id, user_id, content):
|
||||||
|
"""One of our users was removed/kicked from a group
|
||||||
|
"""
|
||||||
# TODO: Check if user in group
|
# TODO: Check if user in group
|
||||||
yield self.store.register_user_group_membership(
|
yield self.store.register_user_group_membership(
|
||||||
group_id, user_id,
|
group_id, user_id,
|
||||||
|
|
|
@ -405,7 +405,9 @@ class GroupAdminRoomsServlet(RestServlet):
|
||||||
user_id = requester.user.to_string()
|
user_id = requester.user.to_string()
|
||||||
|
|
||||||
content = parse_json_object_from_request(request)
|
content = parse_json_object_from_request(request)
|
||||||
result = yield self.groups_handler.add_room(group_id, user_id, room_id, content)
|
result = yield self.groups_handler.add_room_to_group(
|
||||||
|
group_id, user_id, room_id, content,
|
||||||
|
)
|
||||||
|
|
||||||
defer.returnValue((200, result))
|
defer.returnValue((200, result))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue