Add admin API to send a server_notice to one/all users#3531
Conversation
|
Can one of the admins verify this patch? |
1 similar comment
|
Can one of the admins verify this patch? |
994826b to
5ed5a60
Compare
|
let's not add too much magic which is only meant to be used via the manhole. better to add admin apis. |
692dd05 to
f4c79ea
Compare
692dd05 to
f4c79ea
Compare
|
Seems like all the Admin_APIs in https://github.com/matrix-org/synapse/tree/master/docs/admin_api reference |
There was a problem hiding this comment.
you seem to switch between v1 and r0 interchangeably...
There was a problem hiding this comment.
it was a copy/paste error. I got confused by the doc strings of the other methods.
It should be r0 AFAIK. I have changed it now
There was a problem hiding this comment.
it seems like it is actually v1
There was a problem hiding this comment.
It is that class but it adds the /client/r0/ endpoints as well.
37b755d to
d1141bc
Compare
d1141bc to
e9c2acd
Compare
There was a problem hiding this comment.
could you stick this under docs/admin_api, with a link here to say "there is an API which is documented at [...]"?
There was a problem hiding this comment.
"a lot of users". Or better: "a large number of registered users."
There was a problem hiding this comment.
if you drop the access_token (which is kinda obvious), does this fit on one line?
If not, can you indent this line more?
also, I suggest @user:host rather than @dest:user
There was a problem hiding this comment.
I feel like sending a message to all users is a dangerous thing that might happen by accident. Would it be better to have separate APIs
/admin/send_server_notice_to_user/<user_id>
/admin/send_server_notice_to_all_users
?
There was a problem hiding this comment.
It would cause some code duplication as I would have to create a new servlet for that.
Personally I think there is a reason why we require an admin token so that the admin should take care that (s)he does it right.
But I can change it if you like.
There was a problem hiding this comment.
well, fair enough. I won't insist.
There was a problem hiding this comment.
surely we should yield here to wait for the request to complete?
In matrix-org#3525 it got requested to have an easier way to send a server notice to all users on the server. Besides the query that got mentioned there this adds another command which can be called via manhole to send those messages. Signed-Off-By: Matthias Kesler <krombel@krombel.de>
a926483 to
240c23e
Compare
240c23e to
a5dd1e9
Compare
|
|
||
|
|
||
| class ServerNoticeRestServlet(ClientV1RestServlet): | ||
| PATTERNS = client_path_patterns("/admin/send_server_notice(/(?P<user_id>[^/]+))?") |
There was a problem hiding this comment.
I'm trying to figure out whether there is a difference in behaviour between /admin/send_server_notice/ (with a trailing slash and an empty user_id) and /admin/send_server_notice (with no trailing slash). AFAICT the former will fail, but the docs say it is valid?
I'd suggest that you should not accept /admin/send_server_notice/, and the docs should be updated to clarify.
|
I have taken this PR as a basis for another implementation, over in #5121. It doesn't currently implement the "send-to-all" functionality, so that is left for a future PR. My feeling is that should be a separate endpoint anyway. In the meantime, I'm going to close this PR. Thank you for your work on this, @krombel! |
|
[…] |
In #3525 it got requested to have an easier way to send a server notice
to all users on the server.
Besides the query that got mentioned there this adds another command
which can be called via manhole to send those messages.
This PR adds admin API as follows:
@dest:useris optionalThis would fix #3532
Signed-Off-By: Matthias Kesler krombel@krombel.de