Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Require user to have left room to forget room #673
Conversation
erikjohnston
assigned
NegativeMjark
Mar 30, 2016
oddvar
added
the
in progress
label
Mar 30, 2016
This was referenced Mar 30, 2016
NegativeMjark
commented on an outdated diff
Mar 30, 2016
synapse/handlers/room.py
| - 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 | ||
| + )) | ||
| + | ||
| + yield self.store.forget(user_id, room_id) |
NegativeMjark
Contributor
|
NegativeMjark
commented on an outdated diff
Mar 30, 2016
erikjohnston
added some commits
Mar 30, 2016
|
@NegativeMjark PTAL |
|
Should forgetting fail if you aren't in the room? Otherwise LGTM |
I quite like that it doesn't, since then you can't use the API to tell if you had forgotten the room or were never in it. |
erikjohnston
merged commit 178c9fb
into
develop
Mar 30, 2016
8 checks passed
Flake8 + Packaging (Commit)
Build #226 origin/erikj/forget succeeded in 25 sec
Details
Flake8 + Packaging (Merged PR)
Build finished.
Details
Sytest Postgres (Commit)
Build #229 origin/erikj/forget succeeded in 5 min 24 sec
Details
Sytest Postgres (Merged PR)
Build finished.
Details
Sytest SQLite (Commit)
Build #230 origin/erikj/forget succeeded in 4 min 12 sec
Details
Sytest SQLite (Merged PR)
Build finished.
Details
Unit Tests (Commit)
Build #271 origin/erikj/forget succeeded in 1 min 14 sec
Details
Unit Tests (Merged PR)
Build finished.
Details
oddvar
removed
the
in progress
label
Mar 30, 2016
richvdh
deleted the
erikj/forget
branch
Dec 1, 2016
non-Jedi
referenced this pull request
in matrix-org/matrix-doc
Oct 2, 2017
Open
Document that users must now call the endpoint to leave a room before calling endpoint to forget it #1011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
erikjohnston commentedMar 30, 2016
This dramatically simplifies the forget API code - in particular it no longer generates a leave event.
matrix-org/sytest#220