mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-19 01:48:40 -04:00
Inform the client of new room tags using v1 /events
This commit is contained in:
parent
a89b86dc47
commit
f40b0ed5e1
6 changed files with 91 additions and 14 deletions
|
@ -62,6 +62,7 @@ class TagServlet(RestServlet):
|
|||
super(TagServlet, self).__init__()
|
||||
self.auth = hs.get_auth()
|
||||
self.store = hs.get_datastore()
|
||||
self.notifier = hs.get_notifier()
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def on_PUT(self, request, user_id, room_id, tag):
|
||||
|
@ -69,9 +70,12 @@ class TagServlet(RestServlet):
|
|||
if user_id != auth_user.to_string():
|
||||
raise AuthError(403, "Cannot add tags for other users.")
|
||||
|
||||
yield self.store.add_tag_to_room(user_id, room_id, tag)
|
||||
max_id = yield self.store.add_tag_to_room(user_id, room_id, tag)
|
||||
|
||||
yield self.notifier.on_new_event(
|
||||
"private_user_data_key", max_id, users=[user_id]
|
||||
)
|
||||
|
||||
# TODO: poke the notifier.
|
||||
defer.returnValue((200, {}))
|
||||
|
||||
@defer.inlineCallbacks
|
||||
|
@ -80,7 +84,11 @@ class TagServlet(RestServlet):
|
|||
if user_id != auth_user.to_string():
|
||||
raise AuthError(403, "Cannot add tags for other users.")
|
||||
|
||||
yield self.store.remove_tag_from_room(user_id, room_id, tag)
|
||||
max_id = yield self.store.remove_tag_from_room(user_id, room_id, tag)
|
||||
|
||||
yield self.notifier.on_new_event(
|
||||
"private_user_data_key", max_id, users=[user_id]
|
||||
)
|
||||
|
||||
# TODO: poke the notifier.
|
||||
defer.returnValue((200, {}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue