Commit graph

2290 commits

Author SHA1 Message Date
Preet Mishra 9a4abb9f87 zulip: Add hash_util_decode() to decode server encoded URL excerpts.
This adds hash_util_decode() to decode a hash_util_encode() [present in
zulip/zulip's zerver/lib/url_encoding.py [1]] encoded string.

The intent is to facilitate code sharing among various python clients
(primarily, Zulip Terminal).

The string replacement before the `unquote` is to recoup for the custom
string replacements in zulip/zulip's zerver/lib/url_encoding.py [1].

Test added.

[1] See hash_util_encode() in https://github.com/zulip/zulip/blob/master/zerver/lib/url_encoding.py.
2020-08-25 16:08:32 -07:00
rht e992f14522 slack-bridge: Use WebClient to post message in Slack. 2020-08-25 15:55:25 -07:00
rht 47a4f258d7 slack-bridge: Update processing of members list according to new API. 2020-08-25 15:55:25 -07:00
rht 89d0dd56b9 slack-bridge: Fall back to real_name when display_name is empty.
This will intentionally raise exception when a real_name field of a user
is empty.
2020-08-25 15:55:25 -07:00
rht 02867979ee bridge: Initialize bridge_with_slack. 2020-08-25 15:55:25 -07:00
Kartik Srivastava 0e98533186 api: Implement GET /users/{user_id}/subscriptions/{stream_id} endpoint. 2020-08-14 16:22:12 -07:00
rht f529bc0d01 IRC bridge: Add documentation on nick password. 2020-08-10 17:12:04 -07:00
rht fe2a4d6fe8 [BUGFIX] IRC bridge: Use connection initialized from aio_reactor.
Additionally, pin the irc library version to 18.0 because the newer
version has an error in the AioReactor:
```
  File "/home/rht/code/venv/lib/python3.8/site-packages/irc/bot.py", line 108, in run
    self.bot.reactor.scheduler.execute_after(intvl, self.check)
AttributeError: 'AioReactor' object has no attribute 'scheduler'
```
2020-08-10 17:12:04 -07:00
Kartik Srivastava 36071821c3 api: Update type annotation in 'remove_subscriptions'.
This updates the type annotation for the 'principals' argument
to accept a list of email addresses as well as user ids.
2020-08-10 16:38:39 -07:00
Alex Vandiver 9745ec9ceb doc: Document the backoff class better. 2020-08-10 15:07:01 -07:00
Alex Vandiver 7a7cfe637e zephyr: Mark the infinite loops as NoReturn. 2020-08-10 15:07:01 -07:00
Alex Vandiver a20c9cc6d7 zephyr: Use exponential backoffs in retry loops.
This reduces the number of retries that might spam APIs.

There is some complexity here which is left un-managed -- for
instance, maybe_restart_mirroring_script does a number of restart
attempts, and then fails, but will be retried every 15s by the
surrounding `process_loop`.  Previously, it would merely have looped
forever inside maybe_restart_mirroring_script.

Three loops are intentionally left as infinite `while True` loops,
that merely cap their backoff at the default 90s.  Their callers do
not expect, or have any way to handle more gracefully, a failure of
the expected-infinite-loop in `process_loop` or `zulip_to_zephyr`.
They maintain their previous behavior of retrying forever, albeit more
slowly.
2020-08-10 15:07:01 -07:00
rht 8670cce8e9 Matrix bridge: Change the condition of not_from_zulip_bot. 2020-08-07 08:15:07 -04:00
Kartik Srivastava 20e7f197e3 api: Implement DELETE /realm/emoji/{emoji_name}. 2020-08-03 10:29:38 -07:00
Anders Kaseorg 396ef1d11a Update zulipchat.com emails to zulip.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 21:06:58 -07:00
Anders Kaseorg 5f81eb3a70 Update zulipchat.com links to zulip.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 21:06:58 -07:00
Aman Agrawal ad8a9dd56d requirements: Bump zulint. 2020-06-07 14:01:53 -07:00
Kartik Srivastava 9e9b1efdae api: Implement PATCH /realm/profile_fields/{field_id} endpoint. 2020-05-29 17:18:25 -07:00
Kartik Srivastava e25ebce27b api: Implement PATCH /realm/profile_fields endpoint. 2020-05-29 17:18:25 -07:00
Kartik Srivastava a85ac15d2d api: Implement DELETE /realm/profile_fields/{field_id} endpoint. 2020-05-29 17:18:25 -07:00
Kartik Srivastava 22392779a3 api: Implement POST /realm/profile_fields endpoint. 2020-05-29 17:18:25 -07:00
Kartik Srivastava 30fa7c5d2f api: Implement GET /realm/profile_fields endpoint. 2020-05-29 17:18:25 -07:00
Kartik Srivastava 16737e4ed3 api: Add get_members wrapper for get_users for backwards compatibility. 2020-05-14 11:37:23 -07:00
Kartik Srivastava d2b9976015 api: Rename get_members to get_users. 2020-05-14 11:36:17 -07:00
Anders Kaseorg 7870512de6 mailmap: Add Git .mailmap for zulipchat.com → zulip.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-13 09:56:35 -07:00
Lunatic Luna 3b1ef57694 bots: Support adding reactions to message for a bot.
It adds a react() function that allows a bot to react to a message in lib.py.
It adds an example of the use of react() function and its test.

The changes are in the following files:
  - lib.py
  - helloworld.py
  - tests/test_lib.py
  - test_lib.py
2020-05-08 10:46:56 -04:00
neiljp (Neil Pilgrim) 540d453237 setup.py: Add Source & Documentation project_urls.
The only existing url points to zulip.org -> zulipchat.com
2020-05-05 09:20:50 -04:00
neiljp (Neil Pilgrim) f2c8295fcb requirements: Remove unnecessary install dependency upon six & typing.
The latest release was fully python 3.5+, making these dependencies
redundant.
2020-05-05 09:20:50 -04:00
pemontto a9268a1947 jira: Add JQL search command. 2020-04-28 12:46:40 -07:00
pemontto a46dae37f5 jira: Add search command. 2020-04-28 12:46:40 -07:00
pemontto b0c2b1b9c8 jira: Use display_url in output. 2020-04-28 12:45:36 -07:00
pemontto 3ca336246d jira: Allow overriding https. 2020-04-28 12:45:36 -07:00
pemontto ae8a3516fb jira: Fix deprecation warning. 2020-04-28 12:45:36 -07:00
Rohitt Vashishtha bdf0c7ff5c bots: Use ids for sending message. 2020-04-28 11:56:16 -04:00
Rohitt Vashishtha 5c32054415 bots: Do not reply in group PMs unless explicitly mentioned.
Previously, if a bot was accidentally added to a group PM, we would
have no option but to leave that conversation because the bot would
reply to all the messages sent in that conversation. This also has
potential to cause infinite loops in case two bots are added to a
group PM since they could keep on replying to each other's messages.

Fixes #551.
2020-04-28 11:56:16 -04:00
Rohitt Vashishtha fe78a363b0 bots: Do not remove self from list of recipients in group PMs.
The origin of this line seems like an arbitary decision when writing the
wikipedia bot in ad25f27853. Removing self
doesn't have any other significance, and not making any changes to the
recipient list helps with https://github.com/zulip/zulip/issues/14228.

Fixes #552.
2020-04-28 11:56:16 -04:00
Eeshan Garg 1dac75f979 pypi: Release version 0.7.0. 2020-04-20 23:23:58 -02:30
Eeshan Garg d4ded1c5dd tools/release-packages: Stop generating universal wheels.
Since we recently dropped support for Python 2 in our PyPI packages,
we can no longer distribute them as universal wheels.
2020-04-18 20:33:17 -07:00
Eeshan Garg 4e0c963127 zulip/README.md: Add note clarifying Python 2 support. 2020-04-18 20:33:17 -07:00
Anders Kaseorg b573c1daf3 lint: Replace pycodestyle with Flake8.
Flake8 combines pycodestyle with pyflakes and automatically gives us
support for noqa comments, parallelism, configuration files, plugins,
and easy editor integration.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg f616b9259e irc_mirror_backend: Remove repeated dictionary key.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 17cf26aa1f cleanup: Move line breaks before binary operators.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 6f40bcf745 cleanup: Fix whitespace around parameter equals.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 562fe610b7 cleanup: Fix whitespace around function annotation arrows.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg bd9bb0a4e8 cleanup: Fix indentation.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 07c64673f7 test_jira: Remove redefined test_edit method.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg a01e5e37f4 cleanup: Remove more unused variables.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 54b2578204 cleanup: Remove unused variables.
Generated by autoflake.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg f5d96dbcce cleanup: Remove duplicate imports.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg adde59e5c3 cleanup: Remove more unused imports.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00