summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-08-26 17:50:28 +0100
committerKegan Dougal <kegan@matrix.org>2014-08-26 17:50:28 +0100
commit5dd8087ea41fce6a9153d7b275c752bd3e409592 (patch)
tree8ccec4c3752deede87488a29d73db238bcfa9087 /synapse/api
parentMerge branch 'client_server_url_rename' into develop (diff)
parentMerge branch 'develop' of github.com:matrix-org/synapse into client_server_ur... (diff)
downloadsynapse-5dd8087ea41fce6a9153d7b275c752bd3e409592.tar.xz
Merge branch 'client_server_url_rename' into develop
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/constants.py4
-rw-r--r--synapse/api/events/room.py16
2 files changed, 11 insertions, 9 deletions
diff --git a/synapse/api/constants.py b/synapse/api/constants.py
index 2af5424029..f69f2445a2 100644
--- a/synapse/api/constants.py
+++ b/synapse/api/constants.py
@@ -31,8 +31,8 @@ class Feedback(object):
     """Represents the types of feedback a user can send in response to a
     message."""
 
-    DELIVERED = u"d"
-    READ = u"r"
+    DELIVERED = u"delivered"
+    READ = u"read"
     LIST = (DELIVERED, READ)
 
 
diff --git a/synapse/api/events/room.py b/synapse/api/events/room.py
index 2a7b5e8aba..9faad57ac0 100644
--- a/synapse/api/events/room.py
+++ b/synapse/api/events/room.py
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from synapse.api.constants import Membership
+from synapse.api.constants import Feedback, Membership
 from synapse.api.errors import SynapseError
 from . import SynapseEvent
 
@@ -93,17 +93,19 @@ class MessageEvent(SynapseEvent):
 class FeedbackEvent(SynapseEvent):
     TYPE = "m.room.message.feedback"
 
-    valid_keys = SynapseEvent.valid_keys + [
-        "msg_id",  # the message ID being acknowledged
-        "msg_sender_id",  # person who is sending the feedback is 'user_id'
-        "feedback_type",  # the type of feedback (delivery, read, etc)
-    ]
+    valid_keys = SynapseEvent.valid_keys
 
     def __init__(self, **kwargs):
         super(FeedbackEvent, self).__init__(**kwargs)
+        if not kwargs["content"]["type"] in Feedback.LIST:
+            raise SynapseError(400, "Bad feedback value.")
 
     def get_content_template(self):
-        return {}
+        return {
+            "type": u"string",
+            "target_event_id": u"string",
+            "msg_sender_id": u"string"
+        }
 
 
 class InviteJoinEvent(SynapseEvent):