Commit Graph

37 Commits

Author SHA1 Message Date
rht 969cc506d2 zerver/webhooks: Use python 3 syntax for typing.
Tweaked by tabbott to fix various line-wrapping issues.
2017-11-04 19:40:32 -07:00
Eeshan Garg aaaed74c3d webhooks: Import REQ, has_request_variables from zerver.lib.request.
We now import REQ and has_request_variables from zerver.lib.request,
which is where these methods are defined.

Fixes #7195.
2017-11-02 14:40:55 -07:00
derAnfaenger d1afab7199 Replace deprecated Logging.warn calls with Logging.warning. 2017-10-02 11:11:42 +02:00
Eeshan Garg 86c2c7ad34 webhooks: Migrate to check_send_stream_message.
This commit migrates all webhooks to use check_send_stream_message
instead of check_send_message. The only two webhooks that still
use check_send_message are our yo and teamcity webhooks. They
both use check_send_message for private messages.
2017-09-30 17:48:55 -07:00
rht 7115a29bee zerver/webhooks: Remove absolute_import. 2017-09-27 10:00:39 -07:00
Eeshan Garg 31986d1b94 github_webhook: Update "pull_request unassigned" event fixture.
The older fixture for this event assumed that the "assignee" key
had a value of '{}' if no one was assigned to a PR anymore.
However, that is no longer true because testing with requestbin
showed that in the latest JSON payload for this event, the key
"assignee" now has the value of 'null' (None when converted to
Python) when a user is unassigned from a PR. The current code
didn't handle this correctly. This commit makes sure it does!

Its unclear as to whether the old fixture was simply wrong or
whether GitHub changed its payloads in any way.
2017-08-24 16:48:00 -07:00
Jack Zhang e56b060ef4 github_webhook/doc.md: Add link to deprecated Github Services integration. 2017-08-10 10:21:53 -07:00
Eeshan Garg c16e4c7d32 github_webhook: Support "ping" events from organization webhooks.
In addition to "ping" webhook payloads from repository-specific
webhooks, we now also support "ping" events from organization-wide
webhooks.
2017-07-17 10:15:28 -07:00
Kenji Okimoto 2eb6c49a89 github_webhook: Fix a typo to handle issues event properly.
issue -> issues in the HTTP_X_GITHUB_EVENT.
2017-06-30 10:55:01 -07:00
Sadjad Fouladi 92fefa0e7e Fix a grammatical error in status change message. 2017-06-30 11:44:04 -04:00
Eeshan Garg dd15b2d997 github_webhook: Migrate docs to Markdown. 2017-06-05 11:20:49 -07:00
Eeshan Garg 5687b2cdc5 webhooks/github*: Support pushing a local branch without commits.
Changes made to get_push_commits_event_message in
zerver/lib/webhooks/git.py are common to all Git integrations
that use get_push_commits_event_message. These include github,
github_webhook, gitlab, gogs, bitbucket, bitbucket2. In some
cases (for instance, gitlab), no further changes to gitlab/view.py
will be required to support pushing a local branch without commits;
adding a fixture and tests should suffice.
2017-05-16 23:51:19 -02:30
Eeshan Garg 7227f488c8 webhooks: Add support for a GitHub push event deleting a branch.
Fixes: #4742.
2017-05-16 00:11:20 -02:30
Eeshan Garg 597db11a98 webhooks: Rename webhook fixtures to only include event type.
All webhook fixtures have now been renamed from
<webhook_name>/fixtures/<webhook_name>_<event_type>.json to
<webhook_name>/fixtures/<event_type>.json.
2017-05-13 20:07:40 -02:30
Eeshan Garg e87e246fcb zerver/decorator: Set request.client in api_key_only_webhook_view.
Previously, api_key_only_webhook_view passed 3 positional arguments
(request, user_profile, and client) into a function. However, most
of our other auth decorators only pass 2 positional arguments. For
the sake of consistency, we now make api_key_only_webhook_view set
request.client and pass only request and user_profile as positional
arguments.
2017-05-01 23:44:07 -07:00
Eeshan Garg 8ef18463d6 github_webhook: Use author's full name if username is not available.
In cases where the webhook payload doesn't have the username for the
author of a particular commit (this can happen if the author doesn't
have a GitHub account or the author's email is not associated with
their GitHub account), we now use the author's full name to format
messages.
2017-04-29 14:57:57 -07:00
Eeshan Garg aa12002be7 webhooks: Move all fixtures to zerver/webhooks/<webhook_name>/fixtures.
All webhook fixtures in zerver/fixtures/<webhook_name> have now
been moved to dedicated webhook-specific directories under
zerver/webhooks/<webhook_name>/fixtures, where <webhook_name> is
the name of the webhook.
2017-04-28 11:07:03 -07:00
Eeshan Garg ffdd5d3588 webhooks: Don't display "Commits by" when committer is the only author.
For our Git integrations, we now only display the number of commits
pushed when the pusher also happens to be the only author of the
commits being pushed.

Part of #3968.
Follow-up to #4006.
2017-04-26 18:26:09 -02:30
Eeshan Garg b7ca533315 webhooks: Add a space between author and number of commits for Git messages.
For Git push messages, we now have a single space character between
the name of a commit's author and the number of commits by that
author, plus a period at the end.

Part of #3968.
Follow-up to #4006.
2017-04-26 18:26:09 -02:30
Eeshan Garg af69faafc9 webhooks: Use author's name to format Git push messages.
We now use the name of the author of a commit as opposed to the
committer to format Git messages with multiple committers.

Part of #3968.
Follow-up to #4006.
2017-04-26 18:26:09 -02:30
Eeshan Garg 8900e99ae5 github_webhook: Use branches.find to filter Git notifications. 2017-04-25 10:46:21 -07:00
Eeshan Garg dded73ec6f webhooks: Stop overriding build_webhook_url for URL query parameters. 2017-04-21 22:06:11 -02:30
Siddharth Mahapatra e7455e276b git integrations: Expand details in commit push notifications.
We now show a few new things:
(1) The number of commits pushed.
(2) Who authored the commits (just counts, not which specific ones, for brevity).

Add tests for case of multiple committers.

Part of #3968.
2017-04-21 11:07:44 -07:00
Eeshan Garg 8933b5b31d github_webhook: Filter specific GitHub branches.
Fixes: #4000
2017-03-26 13:32:24 -07:00
Tomasz Kolek 09f5180da9 github_webhook: Return 200 OK if event is not supported.
Change raising exception when event is not supported to just logging it.
2017-03-23 23:26:55 -07:00
Akash Kothawale edfb9c21bc github_webhook: Send test message sent by GitHub webhook integration.
Fixes #3994.
2017-03-17 11:47:04 -07:00
wizsid11 19d1f4cab7 git integration: Change push commits message to show url at the end. 2017-03-16 11:06:03 -07:00
wizsid11 f066e3e8d6 git integrations: Change the limit of shown commits from 10 to 20. 2017-03-14 13:24:45 -07:00
Tim Abbott ae12f3dfd0 github: Fix URL in GitHub webhook documentation. 2017-03-08 23:25:30 -08:00
Tomasz Kolek e1d73ea36f github: Add list and fixtures for ignored events to webhook. 2017-02-26 19:17:53 -08:00
Tomasz Kolek 349835e619 Add PR edited, assigned and unassigned to github webhook integration. 2017-02-26 19:16:12 -08:00
Tim Abbott 28a123f00e webhooks: Fix spelling of GitHub webhook client name.
This will make the Zulip analytics on /stats be consistent with the
old integration.
2017-02-05 16:26:12 -08:00
Tomasz Kolek 7bcba19e99 Add handling synchronize PR event to github webhook integration. 2017-02-02 12:33:08 -08:00
Tomasz Kolek 3f1b21fe61 Add ping event handling to github webhook integration. 2017-02-01 00:38:16 +01:00
Tomasz Kolek d598fae52e docs: Add missing configuration step to github webhook doc. 2017-01-30 13:02:48 -08:00
Tomasz Kolek 6e6cbeb89d Split webhooks doc and move to particular directories. 2017-01-26 11:56:45 -08:00
Tomasz Kolek 7de45951e2 Make webhooks as separate modules with view and tests.
Create python packege for every webhook with view.py and tests.py
2017-01-25 23:14:19 -08:00