Commit Graph

2532 Commits

Author SHA1 Message Date
Umair Khan
a1b894a786 user-groups: Add delete API endpoint.
Significantly modified by tabbott to fix some bugs.
2017-11-09 17:35:30 -08:00
Umair Khan
eeaf0f1742 user-groups: Add edit API endpoint.
Significantly modified by tabbott to fix some bugs.
2017-11-09 17:35:22 -08:00
Umair Khan
1bbe84af49 user-groups: Add create API endpoint.
Significantly modified by tabbott for better security structure.
2017-11-09 17:26:14 -08:00
derAnfaenger
7798aae6ca queue processors: Add full coverage for DigestWorker. 2017-11-09 16:01:24 -08:00
derAnfaenger
dac44dda92 Cover users without activity record in email queue digest tests. 2017-11-09 16:01:24 -08:00
derAnfaenger
970e8c5df2 queue processors: Add full coverage for FetchLinksEmbedData. 2017-11-09 16:01:24 -08:00
Tommy Ip
bcd575d8de bugdown: Rewrite links to local server to be relative links.
Fixes #7247
2017-11-09 15:59:31 -08:00
Tim Abbott
982bd9c38d Fix push notifications for soft-deactivated users.
Previously, these push notification events were being generated, but
then ignored in handle_push_notification because there was no
user_message object.
2017-11-09 15:52:29 -08:00
derAnfaenger
3ac09b3e9b queue processors: Add coverage for SlowQueryWorker. 2017-11-09 15:20:40 -08:00
Tim Abbott
64b4d83038 push_notifications: Improve debugging of lookup problems.
We're having this error being thrown often, and don't know why.
2017-11-09 15:20:24 -08:00
Steve Howell
531a3ee9de refactor: Fix parse.quote(force_str(s)) calls in bugdown. 2017-11-09 10:43:20 -08:00
Steve Howell
786e90d774 Removed unused imports of force_bytes. 2017-11-09 10:32:14 -08:00
Steve Howell
50e3285a0d tests: Remove force_text() in test_messages.py. 2017-11-09 10:27:30 -08:00
YJDave
de67bf81fd org settings: Allow users to delete their message.
Fixes #7049.
2017-11-09 10:20:34 -08:00
rht
5937141264 Remove usage of six.moves.string_types. 2017-11-09 10:00:00 -08:00
Harshit Bansal
65838bb825 email_gateway: Disable code block processor for email gateway.
Generally emails are not written with markdown in mind and hence
sometimes render in strange ways. This commit fixes a particular
issue that was causing whitespace before paragraphs to be treated
as code block due to which email content was being rendered in a
box that scrolls in right direction a lot.

Fixes: #7045.
2017-11-09 09:56:35 -08:00
derAnfaenger
19bc55aa45 Fix various typos.
The typos and their corrections were found with the
aid of https://github.com/lucasdemarchi/codespell.
2017-11-09 16:26:38 +01:00
rht
04f4f7166c zerver/tests: Use python 3 syntax for typing.
This patch was extracted by tabbott for just the files with no open
PRs modifying them.
2017-11-08 12:50:27 -08:00
Tim Abbott
5703b38ffb api: Move usage instructions to their own page. 2017-11-08 10:29:24 -08:00
Eeshan Garg
7c113f0447 api-docs: Render api_url in /api docs.
In templates/zerver/api/main.html, since the current context isn't
passed to render_markdown_path when rendering an article,
render_markdown_path doesn't have the context to render values such
as api_url. This commit makes sure that it does by passing a dict
called api_uri_context to render_markdown_path when rendering an
article.
2017-11-08 01:29:49 -03:30
Steve Howell
ae0b27a7ed Extract messages_for_ids. 2017-11-07 17:48:27 -08:00
Steve Howell
47c63217cc tests: Add test_include_history().
Before this test, we weren't really testing the logic to
get flags from UserMessage.
2017-11-07 17:48:27 -08:00
Steve Howell
8616a4ebc5 Use client_gratavar=True for users on in page_params.
This change affects realm_users and realm_non_active_users.

Note that we still send full avatar urls in realm_user/add
events, so apply_events has to do something mildly hacky to
turn the avatar_url to None in that case.

Fixing the event is probably not worth the trouble, as single
urls are not bandwidth hogs; we only need this optimization
for bulk data.
2017-11-07 16:38:14 -08:00
Steve Howell
a076581426 Use client_gravatar=True for avatar URLs in page_params.
This change affects these values:

    * page_params.avatar_url
    * page_params.avatar_url_medium

It requires passing the client_gravatar flag through this
codepath:

    * home_real
    * do_events_register
    * fetch_initial_state_data
    * avatar_url
2017-11-07 16:38:14 -08:00
Rishi Gupta
15b3a8e4ff email change: Use confirmation object user to determine changeability.
Seems like the more logical check. Also, the previous code makes it feel
like there is a potential vulnerability where one could get an email change
object in a realm where email changes are disabled, and then open that link
while logged in to a different realm.

While we're at it, remove the unnecessary check that the user is
logged in when clicking the confirmation link; that creates
unnecessary trouble for users who use multiple browsers.
2017-11-07 16:26:27 -08:00
Rishi Gupta
1823d46236 unsubscribe: Use a custom confirmation error page.
Reverts a bit of 6e02ce8.
2017-11-07 16:02:49 -08:00
Tim Abbott
417f92c8e1 markdown: Remove now-obsolete bugdown_matches_marked.
Fixes #7099.
2017-11-07 12:01:57 -08:00
neiljp (Neil Pilgrim)
9655c4f122 mypy: Amend type of bad_stream_content within test_bad_narrow_stream_content. 2017-11-07 11:26:46 -08:00
neiljp (Neil Pilgrim)
8a0d4e6bff mypy: Improve typing of test_narrow.py:exercise_bad_narrow_operand.
- Add explicit Any type parameter to Sequence
- Specify compatible List type parameters for addition in function body.
2017-11-07 11:26:46 -08:00
neiljp (Neil Pilgrim)
6a1786dc1b mypy: Clarify return type of _check_messages_before_archiving. 2017-11-07 11:26:46 -08:00
rht
fa7016644e refactor: Remove six.moves.https_cookies import. 2017-11-07 10:51:44 -08:00
rht
9c7d5812ce refactor: Remove six.moves.urllib.parse import. 2017-11-07 10:51:44 -08:00
rht
de319b4558 refactor: Remove six.moves.StringIO import. 2017-11-07 10:51:44 -08:00
rht
6cce0e346e refactor: Remove six.moves.filter import. 2017-11-07 10:51:44 -08:00
rht
80a8d4f9f3 refactor: Remove six.moves.map import. 2017-11-07 10:46:42 -08:00
rht
549a26860f refactor: Remove six.moves.range import. 2017-11-07 10:46:42 -08:00
rht
ec5120e807 refactor: Remove six.moves.zip import. 2017-11-07 10:46:42 -08:00
rht
19bd335cbb Change urllib import to be Python 3-specific. 2017-11-07 10:46:42 -08:00
Steve Howell
2bbfda041a Support client_gravatar field for event registration.
This commit allows clients to register client_gravatar=True, and
then we recognize that flag for message events.  If the flag is
True, we will not calculate gravatar URLs and let the clients do
it themselves.  (Clients can calculate gravatar URLs based on
emails with just a little bit of code.)
2017-11-07 10:42:17 -08:00
Steve Howell
3462127ddb Improve test_client_info_for_normal_users().
We now test both possible values of apply_markdown.
2017-11-07 10:36:02 -08:00
Steve Howell
01777623a7 Improve test_get_events_narrow().
We now test message events with both possible value of
apply_markdown (False and True).
2017-11-07 10:36:02 -08:00
Steve Howell
88e1e284bb Restructure send-message code for gravatars.
This refactoring doesn't change behavior, but it sets us up
to more easily handle a register setting for `client_gravatar`,
which will allow clients to tell us they're going to compute
their own gravatar URLs.

The `client_gravatar` flag already exists in our code, but it
is only used for Django views (users/messages) but not for
Zulip events.

The main change is to move the call to `set_sender_avatar` into
`finalize_payload`, which adds the boolean `client_gravatar`
parameter to that function.  And then we update various callers
to supply that flag.

One small performance benefit of this change is that we now
lazily compute the client message payloads in
`event_queue.process_message_event` now, so this will improve
performance if all interested clients have the same value of
`apply_markdown`.  But the change here is really preparing us
for the additional boolean parameter, which will cause us to
have four variations of the payload.
2017-11-07 10:36:02 -08:00
Steve Howell
5be13fb066 Add cachify decorator. 2017-11-07 10:36:02 -08:00
derAnfaenger
0709033858 bugdown: Fetch complete data for tweet.
This makes an extended instead of a normal query,
resulting in the full text of a tweet being fetched
instead of just a truncated version.
2017-11-07 09:13:39 -08:00
rht
c7fa1d4146 zerver/tests: Remove inheritance from object. 2017-11-06 08:53:48 -08:00
neiljp (Neil Pilgrim)
42f5eea61f mypy: Improve typing of request.pyi (REQ).
This expands request.pyi to type-check the arguments passed into REQ.

Tweaked by tabbott to fix the report.py annotations.
2017-11-04 20:26:03 -07:00
neiljp (Neil Pilgrim)
0d31cb568c mypy: Broaden some types from Dict to Any based on context. 2017-11-04 19:47:45 -07:00
neiljp (Neil Pilgrim)
055dff9038 mypy: Clarify parameter types in test_decorators.py. 2017-11-04 19:47:45 -07:00
neiljp (Neil Pilgrim)
6e6b1ce0d5 mypy: Explicitly inherit test_[sequence|mapping] test classes from generic types. 2017-11-04 19:47:45 -07:00
neiljp (Neil Pilgrim)
3fd720d8f4 mypy: Broadly specify lambda type parameters in test_events.py. 2017-11-04 19:47:45 -07:00