-
Notifications
You must be signed in to change notification settings - Fork 396
Allow admins to see soft failed events (if they want to) #18238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
d1c73e7
Allow admins to see soft failed events
turt2live a855b55
changelog
turt2live 8f2fa30
Attempt to fix linting
turt2live 331bc7c
Empty commit to fix CI
turt2live b453b1a
Bump db txn expected count in relations tests
anoadragon453 8e823be
Merge branch 'develop' into travis/admin-soft-fail
turt2live a12af45
Switch to a general concept of "CS API extensions" on a per-user basis
turt2live efa5ad9
Reset aggregations counts
turt2live 24c809f
Add some untested tests
turt2live f24386a
Attempt to fix linting
turt2live 38a8937
kick ci
turt2live 043bd86
I guess the CI doesn't want us to do that
turt2live 99b9ee2
oops
turt2live 8908312
Attempt to fix linting
turt2live 1262b10
kick ci
turt2live 7344990
actually render new docs
turt2live f967bbb
Appease linter
turt2live b2e4a63
Attempt to fix linting
turt2live 88b4723
kick ci
turt2live 1c7e7f1
Create internal metadata properly in tests
turt2live 2800943
Bump db txn count in tests
turt2live b38c208
More txn count bumps
turt2live 25ef8dd
await
turt2live 37a38f8
fix internal_metadata?
turt2live 7e8e66e
Flip `if` order to reduce db transactions in the general case
turt2live bcf3a89
ok, so pop breaks things
turt2live 5c4ba56
Maybe there's just a bunch of checks behind the scenes
turt2live 61ba901
one more time
turt2live 0d13255
Merge branch 'develop' into travis/admin-soft-fail
turt2live 1d5e06b
copy and simplify
turt2live 9cf1cd1
evolve
turt2live 088a3d7
minor doc changes
turt2live 77cdaf4
Use the correct auth handler
turt2live 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 hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
If enabled by the user, server admins will see [soft failed](https://spec.matrix.org/v1.13/server-server-api/#soft-failure) events over the Client-Server API. |
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Client-Server API Extensions | ||
|
||
Server administrators can set special account data to change how the Client-Server API behaves for | ||
their clients. Setting the account data, or having it already set, as a non-admin has no effect. | ||
|
||
All configuration options can be set through the `io.element.synapse.admin_client_config` global | ||
account data on the admin's user account. | ||
|
||
Example: | ||
``` | ||
PUT /_matrix/client/v3/user/{adminUserId}/account_data/io.element.synapse.admin_client_config | ||
{ | ||
"return_soft_failed_events": true | ||
} | ||
``` | ||
|
||
## See soft failed events | ||
|
||
Learn more about soft failure from [the spec](https://spec.matrix.org/v1.14/server-server-api/#soft-failure). | ||
|
||
To receive soft failed events in APIs like `/sync` and `/messages`, set `return_soft_failed_events` | ||
to `true` in the admin client config. When `false`, the normal behaviour of these endpoints is to | ||
exclude soft failed events. | ||
|
||
Default: `false` |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import logging | ||
from typing import Optional | ||
|
||
from synapse.types import JsonMapping | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class AdminClientConfig: | ||
"""Class to track various Synapse-specific admin-only client-impacting config options.""" | ||
|
||
def __init__(self, account_data: Optional[JsonMapping]): | ||
# Allow soft-failed events to be returned down `/sync` and other | ||
# client APIs. `io.element.synapse.soft_failed: true` is added to the | ||
# `unsigned` portion of the event to inform clients that the event | ||
# is soft-failed. | ||
self.return_soft_failed_events: bool = False | ||
turt2live marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if account_data: | ||
self.return_soft_failed_events = account_data.get( | ||
"return_soft_failed_events", False | ||
) |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
Discussed in the
#synapse-dev:matrix.org
room