Commit Graph

6435 Commits

Author SHA1 Message Date
rht 296835351d zerver/views: Text-wrap long lines exceeding 110.
Tweaked by tabbott to fix various minor issues.
2017-11-07 17:24:09 -08:00
rht 22e1456c4d zerver/tornado: Text-wrap long lines exceeding 110. 2017-11-07 17:24:08 -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
rht 8242c15b48 zerver/lib: Remove unused imports (F401). 2017-11-07 16:37:13 -08:00
rht 926f0a7b45 zerver/tornado: Remove unused imports (F401). 2017-11-07 16:36:57 -08:00
rht d6aa7f7738 zerver/management: Remove unused imports (F401). 2017-11-07 16:36:54 -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 4fc8aa2b53 email change: Refactor confirmation path for readability.
Removes an assert, which at this point is there just for readability, since
the second argument to
get_object_from_key(confirmation_key, Confirmation.EMAIL_CHANGE)
ensures that the returned object is of the correct type.
2017-11-07 16:02:49 -08:00
Rishi Gupta 6fbb7e8046 email change: Remove confirmation_key.lower() from confirm_email_change.
Not sure why it is here, and it adds confusion.
2017-11-07 16:02:49 -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
Rhea Parekh 34667e7b64 markdown_test_cases: Clean bugdown_matches_marked from the tex cases. 2017-11-07 11:55:25 -08:00
neiljp (Neil Pilgrim) 4194dcfff1 mypy: set SubSuiteList to inherit from typed List.
Modified by tabbott to add the `type: ignore`, which is basically
required by the monkey-patching we're doing here.
2017-11-07 11:39:21 -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) 1dcc981af8 mypy: Add explicit Any type parameters for embedded data Dicts. 2017-11-07 11:26:46 -08:00
neiljp (Neil Pilgrim) d038bf89ac mypy: Adjust pivotal/view.py function parameter type based on 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
neiljp (Neil Pilgrim) 88424bed0b mypy: Clarify types in add_missing_messages in soft_deactivation.py. 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 01eb22abd9 refactor: Remove all the remaining six.moves 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 ccf2792c1c refactor: Remove six.moves.configparser 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 6b12fe24b6 refactor: Remove six.moves.input import. 2017-11-07 10:51:44 -08:00
rht 14671fc7b9 refactor: Remove six.moves.zip_longest 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 8450f0ec69 Register client_gravar=True for the webapp. 2017-11-07 10:42:18 -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 2a6c6518fc refactor: Don't shadow message_dict in process_message_event(). 2017-11-07 10:36:02 -08:00
Steve Howell 5be13fb066 Add cachify decorator. 2017-11-07 10:36:02 -08:00
derAnfaenger c8e87a322d queue processors: Exclude TestWorker from coverage. 2017-11-07 09:38:58 -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 8990b1046d zerver: Remove inheritance from object. 2017-11-06 08:53:48 -08:00
rht 2ceb0b45b3 zerver/tornado: Remove inheritance from object. 2017-11-06 08:53:48 -08:00
rht c7fa1d4146 zerver/tests: Remove inheritance from object. 2017-11-06 08:53:48 -08:00
rht 864e16f30d zerver/migrations: Remove inheritance from object. 2017-11-06 08:53:48 -08:00
rht e311842a1b zerver/lib: 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