This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add experimental support for MSC3391: deleting account data #14714
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8173de4
Add experimental features flag
anoadragon453 8cd633f
Enable Complement tests for MSC3391
anoadragon453 d338a00
Add replication methods for removing account data
anoadragon453 36d3bd2
Add storage functions for deleting user/room account data
anoadragon453 dcfacc8
Add handler, servlet methods for deleting user/room account data
anoadragon453 ef562a2
Allow deleting account data by PUT'ing with empty content
anoadragon453 0f81122
Return a 404 if an account data type is empty
anoadragon453 2937973
Prevent deleted account data items appearing in initial syncs
anoadragon453 0520e4c
changelog
anoadragon453 80e991f
Simplify txn.rowcount return check
anoadragon453 3c62cd1
Remove unnecessary self.clock assignments in replication endpoints
anoadragon453 36eab04
Remove unnecessary self.store's in unstable account data servlets
anoadragon453 2aa8986
Document why we're not using simple_update
anoadragon453 ccd4225
Document the return value of simple_select_list(_txn)
anoadragon453 554dd36
Convert queries in get_account_data_for_user_txn to raw SQL
anoadragon453 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we special case this -- won't adding it with the empty dict be equivalent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the content of the account data item is the same, the logic for handling the
ignored_users
table and the code to eventually populate aaccount_data_undelivered_deletes
table is slightly different when deleting account data. That could all be handled conditionally in theadd_account_data_for_user
when supplying{}
, but I found it cleaner to just have a separateremove_account_data_for_user
handler function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it gives the same result in a slightly more efficient manner, correct?
I guess I'm finding the logic about this hard to reason about since I don't really understand why we need this table. (And it isn't in this PR.)
I'm not really suggesting getting rid of the
remove_account_data_for_user
method, but rather why are we calling it when someone is setting the value to{}
instead of just falling through to the old code.I don't feel strongly either way, it sounds it is mostly "because a future PR cares".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct. Falling back to the old code would (at the point of this PR) produce the same result through a slightly less efficient process.
In my head, calling the
remove_account_data_for_user
method here is easier to reason about, as MSC3391 states "For backwards compatibility reasons, if a clientPUT
s{}
for account data, that must be seen equivalent asDELETE
-ing that account data." But I also appreciate that I was the one to influence that line being added - so it would be ingrained in my understanding of the problem.That is indeed the only hard blocker here (which is difficult to justify as the code's not written yet!).
But I'd still be inclined to keep this slightly unconventional split off into a separate handler even if there wasn't a future PR involved, because a
PUT /user/{user_id}/account_data/{type}
with a body of{}
is supposed to be equivalent toDELETE
of the same path. If we didn't have this, future changes to the functionality ofDELETE
's handler could easily accidentally break that truth.Writing the above made me realise that we could go even farther into the deep end. Instead of calling the
remove_account_data_for_user
handler method here, we instead directly call theon_DELETE
method ofUnstable(Room)AccountDataServlet
. That way we don't miss out on any special functionality existing in the DELETE servlet but not the handler.