diff options
-rw-r--r-- | AUTHORS.rst | 7 | ||||
-rw-r--r-- | CHANGES.rst | 65 | ||||
-rw-r--r-- | synapse/__init__.py | 2 | ||||
-rw-r--r-- | synapse/handlers/room.py | 23 | ||||
-rw-r--r-- | synapse/rest/client/v1/room.py | 37 |
5 files changed, 125 insertions, 9 deletions
diff --git a/AUTHORS.rst b/AUTHORS.rst index 07d4bee2a3..8711a6ae5c 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -29,7 +29,7 @@ Matthew Hodgson <matthew at matrix.org> Emmanuel Rohee <manu at matrix.org> * Supporting iOS clients (testability and fallback registration) - + Turned to Dust <dwinslow86 at gmail.com> * ArchLinux installation instructions @@ -53,4 +53,7 @@ Mads Robin Christensen <mads at v42 dot dk> * CentOS 7 installation instructions. Florent Violleau <floviolleau at gmail dot com> - * Add Raspberry Pi installation instructions and general troubleshooting items \ No newline at end of file + * Add Raspberry Pi installation instructions and general troubleshooting items + +Niklas Riekenbrauck <nikriek at gmail dot.com> + * Add JWT support for registration and login diff --git a/CHANGES.rst b/CHANGES.rst index bebf489e21..8c180750ad 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,68 @@ +Changes in synapse v0.14.0 (2016-03-30) +======================================= + +No changes from v0.14.0-rc2 + +Changes in synapse v0.14.0-rc2 (2016-03-23) +=========================================== + +Features: + +* Add published room list API (PR #657) + +Changes: + +* Change various caches to consume less memory (PR #656, #658, #660, #662, + #663, #665) +* Allow rooms to be published without requiring an alias (PR #664) +* Intern common strings in caches to reduce memory footprint (#666) + +Bug fixes: + +* Fix reject invites over federation (PR #646) +* Fix bug where registration was not idempotent (PR #649) +* Update aliases event after deleting aliases (PR #652) +* Fix unread notification count, which was sometimes wrong (PR #661) + +Changes in synapse v0.14.0-rc1 (2016-03-14) +=========================================== + +Features: + +* Add event_id to response to state event PUT (PR #581) +* Allow guest users access to messages in rooms they have joined (PR #587) +* Add config for what state is included in a room invite (PR #598) +* Send the inviter's member event in room invite state (PR #607) +* Add error codes for malformed/bad JSON in /login (PR #608) +* Add support for changing the actions for default rules (PR #609) +* Add environment variable SYNAPSE_CACHE_FACTOR, default it to 0.1 (PR #612) +* Add ability for alias creators to delete aliases (PR #614) +* Add profile information to invites (PR #624) + +Changes: + +* Enforce user_id exclusivity for AS registrations (PR #572) +* Make adding push rules idempotent (PR #587) +* Improve presence performance (PR #582, #586) +* Change presence semantics for ``last_active_ago`` (PR #582, #586) +* Don't allow ``m.room.create`` to be changed (PR #596) +* Add 800x600 to default list of valid thumbnail sizes (PR #616) +* Always include kicks and bans in full /sync (PR #625) +* Send history visibility on boundary changes (PR #626) +* Register endpoint now returns a refresh_token (PR #637) + +Bug fixes: + +* Fix bug where we returned incorrect state in /sync (PR #573) +* Always return a JSON object from push rule API (PR #606) +* Fix bug where registering without a user id sometimes failed (PR #610) +* Report size of ExpiringCache in cache size metrics (PR #611) +* Fix rejection of invites to empty rooms (PR #615) +* Fix usage of ``bcrypt`` to not use ``checkpw`` (PR #619) +* Pin ``pysaml2`` dependency (PR #634) +* Fix bug in ``/sync`` where timeline order was incorrect for backfilled events + (PR #635) + Changes in synapse v0.13.3 (2016-02-11) ======================================= diff --git a/synapse/__init__.py b/synapse/__init__.py index bc50bec9db..7de51fbe8d 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -16,4 +16,4 @@ """ This is a reference implementation of a Matrix home server. """ -__version__ = "0.13.3" +__version__ = "0.14.0" diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 133183a257..71f7ab3d22 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -416,8 +416,6 @@ class RoomMemberHandler(BaseHandler): effective_membership_state = action if action in ["kick", "unban"]: effective_membership_state = "leave" - elif action == "forget": - effective_membership_state = "leave" if third_party_signed is not None: replication = self.hs.get_replication_layer() @@ -473,9 +471,6 @@ class RoomMemberHandler(BaseHandler): remote_room_hosts=remote_room_hosts, ) - if action == "forget": - yield self.forget(requester.user, room_id) - @defer.inlineCallbacks def send_membership_event( self, @@ -935,8 +930,24 @@ class RoomMemberHandler(BaseHandler): display_name = data["display_name"] defer.returnValue((token, public_keys, fallback_public_key, display_name)) + @defer.inlineCallbacks def forget(self, user, room_id): - return self.store.forget(user.to_string(), room_id) + user_id = user.to_string() + + member = yield self.state_handler.get_current_state( + room_id=room_id, + event_type=EventTypes.Member, + state_key=user_id + ) + membership = member.membership if member else None + + if membership is not None and membership != Membership.LEAVE: + raise SynapseError(400, "User %s in room %s" % ( + user_id, room_id + )) + + if membership: + yield self.store.forget(user_id, room_id) class RoomListHandler(BaseHandler): diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py index a1fa7daf79..b223fb7e5f 100644 --- a/synapse/rest/client/v1/room.py +++ b/synapse/rest/client/v1/room.py @@ -405,6 +405,42 @@ class RoomEventContext(ClientV1RestServlet): defer.returnValue((200, results)) +class RoomForgetRestServlet(ClientV1RestServlet): + def register(self, http_server): + PATTERNS = ("/rooms/(?P<room_id>[^/]*)/forget") + register_txn_path(self, PATTERNS, http_server) + + @defer.inlineCallbacks + def on_POST(self, request, room_id, txn_id=None): + requester = yield self.auth.get_user_by_req( + request, + allow_guest=False, + ) + + yield self.handlers.room_member_handler.forget( + user=requester.user, + room_id=room_id, + ) + + defer.returnValue((200, {})) + + @defer.inlineCallbacks + def on_PUT(self, request, room_id, txn_id): + try: + defer.returnValue( + self.txns.get_client_transaction(request, txn_id) + ) + except KeyError: + pass + + response = yield self.on_POST( + request, room_id, txn_id + ) + + self.txns.store_client_transaction(request, txn_id, response) + defer.returnValue(response) + + # TODO: Needs unit testing class RoomMembershipRestServlet(ClientV1RestServlet): @@ -624,6 +660,7 @@ def register_servlets(hs, http_server): RoomMemberListRestServlet(hs).register(http_server) RoomMessageListRestServlet(hs).register(http_server) JoinRoomAliasServlet(hs).register(http_server) + RoomForgetRestServlet(hs).register(http_server) RoomMembershipRestServlet(hs).register(http_server) RoomSendEventRestServlet(hs).register(http_server) PublicRoomListRestServlet(hs).register(http_server) |