-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
bot_server: Support trigger value private_message
renamed to direct_message
.
#791
Conversation
I didn't rename
as they are related to This PR is restricted to handling the outgoing webhook issue we encountered. |
@@ -201,7 +201,7 @@ def handle_bot() -> str: | |||
bot_handler = app.config.get("BOT_HANDLERS", {})[bot] | |||
message_handler = app.config.get("MESSAGE_HANDLERS", {})[bot] | |||
is_mentioned = event["trigger"] == "mention" | |||
is_private_message = event["trigger"] == "private_message" | |||
is_direct_message = event["trigger"] in ["direct_message", "private_message"] |
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.
Should we add a TODO/compatibility
comment here to remove private_message
in future? I don't see it included in
Zulip PyPI packages release checklist
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.
Yeah I think it would be valuable to put that kind of comment here to have a record why this is needed and to remove it at some point
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.
Added a comment:
# TODO/compatibility: Remove the support for "private_message" as a valid
# trigger value when one can no longer directly upgrade from 0.8.x to main.
Looks good to me |
651c8c9
to
eb0ce19
Compare
The JSON payload that Zulip server POST for outgoing webhooks has 'trigger' as one of the fields. In zulip/zulip@c4e4737, we renamed the 'private_message' value to 'direct_message'. This commit adds support to the botserver for handling 'direct_message' as a trigger value. It still supports 'private_message' for self-hosted server compatibility.
eb0ce19
to
ccda105
Compare
The compatibility comment was a great idea, but I changed it to state clearly the condition when we remove it -- namely when we no longer support pre-8.0 Zulip servers, since 8.0 will be the first Zulip server release with this change. I think we can rename the |
CZO Discussion
The JSON payload that Zulip server POST for outgoing webhooks has
trigger
as one of the fields.In zulip/zulip@c4e4737, we renamed the
private_message
value todirect_message
.This commit adds support to the botserver for handling
direct_message
as a trigger value. It still supportsprivate_message
for self-hosted server compatibility.