mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-11-13 15:30:39 -05:00
Store room tag content and return the content in the m.tag event
This commit is contained in:
parent
0e36756383
commit
ddd8566f41
4 changed files with 41 additions and 22 deletions
|
|
@ -16,12 +16,14 @@
|
|||
from ._base import client_v2_pattern
|
||||
|
||||
from synapse.http.servlet import RestServlet
|
||||
from synapse.api.errors import AuthError
|
||||
from synapse.api.errors import AuthError, SynapseError
|
||||
|
||||
from twisted.internet import defer
|
||||
|
||||
import logging
|
||||
|
||||
import simplejson as json
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
@ -70,7 +72,13 @@ class TagServlet(RestServlet):
|
|||
if user_id != auth_user.to_string():
|
||||
raise AuthError(403, "Cannot add tags for other users.")
|
||||
|
||||
max_id = yield self.store.add_tag_to_room(user_id, room_id, tag)
|
||||
try:
|
||||
content_bytes = request.content.read()
|
||||
body = json.loads(content_bytes)
|
||||
except:
|
||||
raise SynapseError(400, "Invalid tag JSON")
|
||||
|
||||
max_id = yield self.store.add_tag_to_room(user_id, room_id, tag, body)
|
||||
|
||||
yield self.notifier.on_new_event(
|
||||
"private_user_data_key", max_id, users=[user_id]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue