Commit Graph

622 Commits

Author SHA1 Message Date
Hemanth V. Alluri 48526b1fd6 webhooks: Fix small bug in the fixture_to_headers method of bitbucket3.
We should return an empty dictionary instead of None.
2019-07-25 16:14:14 -07:00
Tim Abbott daca742e9f email_gateway: Use html2text directly.
In the rare case that Zulip receives an email with only an HTML
format, we originally (code dating to 2013) shelled out to
html2markdown/python-html2text in order to convert the HTML into
markdown.

We long since added html2text as a reasonably managed Python
dependency of Zulip; we should just use it here.
2019-07-24 12:42:17 -07:00
Eeshan Garg 1579dc2fee webhooks/github: Add support for star events. 2019-07-22 18:20:53 -07:00
Eeshan Garg badaf28f21 webhooks/github: Ignore 'meta' events.
This event occurs when its corresponding webhook is deleted. This
isn't very useful information, so we should ignore it.
2019-07-22 18:20:53 -07:00
Hemanth V. Alluri fecf6a529e webhooks: Migrate gitlab tests to the headers fixtures system.
We use the same approach as was used for the GitHub integration.
2019-07-22 12:12:50 -07:00
Hemanth V. Alluri 24d66477ca webhooks: Migrate gogs tests to the headers fixtures system. 2019-07-13 16:02:27 -07:00
Rishi Gupta 628d9ad67d notification bot: Update error messages in send_pm_if_empty_stream. 2019-07-13 15:53:36 -07:00
Hemanth V. Alluri 9e6ab7f190 webhooks: Migrate reviewboard tests to the headers fixtures system. 2019-07-09 17:13:02 -07:00
Hemanth V. Alluri b609d25cda webhooks: Migrate netlify tests to the headers fixtures system. 2019-07-09 17:13:02 -07:00
Hemanth V. Alluri e42baff9e9 webhooks: Migrate groove tests to the headers fixtures system. 2019-07-09 17:13:02 -07:00
Hemanth V. Alluri 62bcbb433d webhooks: Migrate bitbucket3 tests to the headers fixtures system. 2019-07-09 17:10:28 -07:00
Vinit Singh 3cc790420a docs: Update docs to reflect the use of Ubuntu bionic in development. 2019-07-08 13:25:54 -07:00
Anders Kaseorg 5e97e58df3 webhooks/freshdesk/doc.md: Remove unescape_rendered_html kludge.
This reverts commit f476ec7fac (#10312)
and replaces it with a proper fix using Jinja2 raw blocks.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-03 15:05:45 -07:00
Hemanth V. Alluri ef52aa0fc1 webhooks: Eliminate the usage of a headers.py file.
For storing HTTP headers as a function of fixture name, previously
we required that the fixture_to_headers method should reside in a
separate module called headers.py.

However, as in many cases, this method will only take a few lines,
we decided to move this function into the view.py file of the
integration instead of requiring a whole new file called headers.py

This commit introduces the small change in the system architecture,
migrates the GitHub integration, and updates the docs accordingly.
2019-06-26 10:35:14 -07:00
Hemanth V. Alluri 4691028097 webhooks: Extract the '__' method of mapping to headers.
In the GitHub integration we established that for many integrations,
we can directly map the fixture filename to the set of required
headers and by following a simple naming convention we can greatly
ease the logic involved in fixture_to_headers method required .

So to prevent the need for duplicating the logic used by the GitHub
integration, we created a method called `get_http_headers_from_filename`
which will take the name of the HTTP header (key) and then return a
corresponding method (in a decorator-like fashion) which could then be
equated to fixture_to_headers in headers.py.

The GitHub integration was modified to use this method and the docs
were updated to suggest using this when possible.
2019-06-26 10:32:34 -07:00
Eeshan Garg daea9a543b webhooks/bitbucket2: Account for missing username in PR payloads.
Certain PR payloads do not have a username for the reviewer, in
such cases, we just return the reviewer's nickname or display
name.
2019-06-24 23:19:06 -07:00
Hemanth V. Alluri 37d90d9add webhooks: Migrate the GitHub integration to new http headers system.
Idea courtesy of tabbott. See PR #12515 for more details.
2019-06-20 16:37:42 -07:00
Hemanth V. Alluri b8268c66d5 webhooks/bitbucket3: Add the `diagnostics:ping` event.
Note: Unlike with the other events supported by this webhook so far,
to determine this event's event type, we need to use the X-Event-Key
HTTP Header.
2019-06-17 17:33:32 -07:00
Eeshan Garg f645de255c webhooks/jira: Avoid UnboundLocalErrors for event handler functions.
If the event key is None, the handler content_func never gets
defined, which leads to an UnboundLocalError. This can be easily
avoided by having a dedicated function that handles the case for
when the event key is None.
2019-06-16 15:19:53 -07:00
Hemanth V. Alluri 611808381f webhooks/stripe: Blacklist invoice changes under invoiceitem category. 2019-06-14 15:55:07 -07:00
Hemanth V. Alluri 325b1fd6c4 webhooks/stripe: Modify the invoice.updated event handling logic.
If the invoice was paid then the message should simply be
"Invoice is now paid." with a link to the invoice.

Also, suppress the "status_transitions" and "payment_intent"events.
2019-06-14 15:55:07 -07:00
Hemanth V. Alluri eaa89d47fa webhooks/stripe: Add fixtures for invoice and invoiceitem updates. 2019-06-14 15:55:07 -07:00
Eeshan Garg 0d519ab146 webhooks/bitbucket2: Account for missing username in user data.
Not all payloads contain the user's username. In such cases, we
should use the user's display name or nickname instead.
2019-06-03 20:00:17 -07:00
Eeshan Garg cf921d5981 webhooks/buildbot: Add missing "skipped" build result code.
The payload for when a build is cancelled was causing an error
because the build result code mapping was missing one of the
codes. This commit also fixes a minor typo in the result codes.
2019-05-31 16:59:42 -07:00
David Wood 2e9e653af1 webhooks/jira: Fix markup conversion of full links.
This commit modifies the regex used when parsing JIRA's full links of
the form `[text|link]` so that if you have two in a message, Zulip
markup conversion doesn't think that the first link extends to the
closing `]` of the second link.
2019-05-27 23:41:11 -07:00
Eeshan Garg 49ac516b50 webhooks/pivotal: Use proper punctuation. 2019-05-09 13:05:49 -07:00
Eeshan Garg 550ea64b4d webhooks/trello: Use proper punctuation. 2019-05-09 13:05:49 -07:00
Eeshan Garg b434cc7054 webhooks/taiga: Use proper punctuation and new style string formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg eaf1c4d8b2 webhooks/teamcity: Improve punctuation and message formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg 6d62522ff0 webhooks/raygun: Improve punctuation and message formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg 44038fc431 webhooks/raygun: Raise exception for unsupported event types. 2019-05-09 13:05:49 -07:00
Eeshan Garg 5a1f70f6e8 webhooks/opsgenie: Improve punctuation and message formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg 120937a1f4 webhooks/mention: Use proper message formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg 1948924cdb webhooks/jira: Improve punctuation and message formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg ef070ef019 webhooks/github: Improve punctuation. 2019-05-09 13:05:49 -07:00
Eeshan Garg 9516699c73 webhooks/front: Use proper punctuation and fix spelling errors. 2019-05-09 13:05:49 -07:00
Eeshan Garg 3af4b7d750 webhooks/freshdesk: Improve message formatting and punctuation. 2019-05-07 16:45:01 -07:00
Eeshan Garg c4e4ceadb5 webhooks/git: Use proper punctuation for branch creation templates. 2019-05-07 16:45:01 -07:00
Eeshan Garg f1228b3550 webhooks/bitbucket3: Use proper punctuation. 2019-05-07 16:45:01 -07:00
Eeshan Garg ab8aae6d0c git_webhooks: Use proper punctuation for PR/issue messages. 2019-05-07 16:45:01 -07:00
Eeshan Garg 2d4b734415 webhooks/solano: Improve message formatting and punctuation.
This commit also removes the conditional for when a build status
does not have a corresponding emoji. In such a case, it is better
to have no emoji than displaying some boilerplate text about no
appropriate emoji being available.
2019-05-07 16:45:01 -07:00
David Wood 16e9892ab2 webhooks/jira: Include issue title in messages. 2019-05-03 20:03:31 -02:30
Eeshan Garg 28109e0f9e webhooks/jira: Ignore comment_created message.
comment_created payloads may not contain the required issue data
to format a useful notification, therefore, it is better to handle
issue comments through issue_updated events (which we already do).

Fixes: #11995.
2019-05-01 16:32:58 -07:00
Mayank Madan 4c81474a4f webhooks: Add Buildbot integration.
With some minor changes by Eeshan Garg.

Fixes: #5639.
2019-04-27 15:19:16 -07:00
Eeshan Garg a73e8109b7 webhooks: Remove the legacy GitHub integration.
The github-services model for how GitHub would send requests to this
legacy integration is no longer available since earlier in 2019.
Removing this integration also allows us to finally remove
authenticated_api_view, the legacy authentication model from 2013 that
had been used for this integration (and other features long since
upgraded).

A few functions that were used by the Beanstalk webhook are moved into
that webhook's implementation directly.
2019-04-27 15:13:44 -07:00
Anders Kaseorg 9a9de156c3 lint: Fix calls to _() on computed strings.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 15:23:03 -07:00
Anders Kaseorg 643bd18b9f lint: Fix code that evaded our lint checks for string % non-tuple.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 15:21:37 -07:00
Eeshan Garg c012362fde webhooks/librato: Use proper punctuation. 2019-04-23 14:32:21 -07:00
Eeshan Garg d733cc500c webhooks/groove: Rewrite the integration and improve messages.
The initial goal was to improve message formatting and punctuation
but after a closer look, I realized that a larger refactor was
worth it for clarity and redability.
2019-04-23 14:32:21 -07:00
Eeshan Garg d8d9695087 webhooks/newrelic: Improve message formatting and punctuation. 2019-04-17 16:22:43 -07:00