summary refs log tree commit diff
path: root/synapse/rest/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-27 14:13:06 +0100
committerErik Johnston <erik@matrix.org>2014-08-27 14:13:06 +0100
commit47519cd8c27c343405431c206660ba74fdea52f6 (patch)
tree77b7a55778c42e256b99577226a6172f719e8416 /synapse/rest/events.py
parentImplement presence event source. Change the way the notifier indexes listeners (diff)
parentfix joining rooms on webclient (diff)
downloadsynapse-47519cd8c27c343405431c206660ba74fdea52f6.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into stream_refactor
Conflicts:
	synapse/handlers/events.py
	synapse/rest/events.py
	synapse/rest/room.py
Diffstat (limited to 'synapse/rest/events.py')
-rw-r--r--synapse/rest/events.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/rest/events.py b/synapse/rest/events.py
index 28da418498..2e7563d14b 100644
--- a/synapse/rest/events.py
+++ b/synapse/rest/events.py
@@ -48,6 +48,22 @@ class EventStreamRestServlet(RestServlet):
         return (200, {})
 
 
+# TODO: Unit test gets, with and without auth, with different kinds of events.
+class EventRestServlet(RestServlet):
+    PATTERN = client_path_pattern("/events/(?P<event_id>[^/]*)$")
+
+    @defer.inlineCallbacks
+    def on_GET(self, request, event_id):
+        auth_user = yield self.auth.get_user_by_req(request)
+        handler = self.handlers.event_handler
+        event = yield handler.get_event(auth_user, event_id)
+
+        if event:
+            defer.returnValue((200, event.get_dict()))
+        else:
+            defer.returnValue((404, "Event not found."))
+
 
 def register_servlets(hs, http_server):
     EventStreamRestServlet(hs).register(http_server)
+    EventRestServlet(hs).register(http_server)