Commit Graph

43290 Commits

Author SHA1 Message Date
sahil839 4df22564f4 settings: Use confirm_dialog for deactivating own account modal.
This refactor changes two things - position of the modal, as it
is moved up by some amount because of using confirm_dialog and
also loading spinner of confirm_dialog widget is used.
2021-06-23 08:05:25 -07:00
Priyansh Garg 6d39dd9d01 import_realm: Fix stream `rendered_description` not being set.
While importing a realm, the stream dictionaries in data['zerver_stream']
already contains the field named `rendered_description`, which is set to
`""`. This lead the code to assume that the stream rendered_description
was already set, due to which, it was not setting the rendered_description
field for any stream.
2021-06-23 08:03:43 -07:00
Suyash Vardhan Mathur 3129895818 openapi: Move stray custom emoji description into OpenAPI. 2021-06-22 17:39:29 -07:00
Suyash Vardhan Mathur 3f104c378b openapi: Move stray get messages description into OpenAPI. 2021-06-22 17:39:22 -07:00
Suyash Vardhan Mathur 570f3d350c apidocs: Move stray update message description to OpenAPI. 2021-06-22 17:39:17 -07:00
Suyash Vardhan Mathur f90b23b265 apidocs: Move stray upload file description to OpenAPI. 2021-06-22 17:39:12 -07:00
Suyash Vardhan Mathur 987b7206aa apidocs: Move stray display settings description to OpenAPI. 2021-06-22 17:39:06 -07:00
Suyash Vardhan Mathur 78910ec16a apidocs: Move stray message flags description to OpenAPI. 2021-06-22 17:38:51 -07:00
Suyash Vardhan Mathur 550e43bb9f apidocs: Move stray events description text to OpenAPI. 2021-06-22 17:38:34 -07:00
Suyash Vardhan Mathur d6ed38e0c9 apidocs: Move stray server settings description to OpenAPI. 2021-06-22 17:38:30 -07:00
Suyash Vardhan Mathur aedca6d6c6 apidocs: Move stray message history description to OpenAPI. 2021-06-22 17:38:10 -07:00
Suyash Vardhan Mathur 8d7634a572 apidocs: Move stray events description to OpenAPI. 2021-06-22 17:38:06 -07:00
Suyash Vardhan Mathur 8da27b8a5b apidocs: Move stray delete description reference to OpenAPI. 2021-06-22 17:37:44 -07:00
Suyash Vardhan Mathur bb175a1a32 openapi: Remove unnecessary URL encoding notes. 2021-06-22 17:36:27 -07:00
Aman Agrawal 1295b47e3b navbar_alerts: Don't ask spectator for notifications access. 2021-06-22 17:18:56 -07:00
Aman Agrawal 534d169ead people: Stop queries about current user in web_public_view.
Since we don't have any info on the spectator in web_public_view,
we avoid doing such queries.
2021-06-22 16:56:34 -07:00
sahil839 37bf160298 queue_processor: Add langauge to the events added to invites queue.
This is a prep commit for adding realm-level default for various
user settings. We add the language, in which the invite email will
be sent, to the dict added to queue itself to avoid making queries
in a loop when sending multiple emails from queue.

We also handle the case for old events in the queue.
2021-06-22 16:55:32 -07:00
sahil839 6a191a7bf0 queue_processor: Remove email_body from the invite email events.
We removed the use of email_body field in 47fcb27e39, but was
still passed in events from do_resend_user_invite_email and
in tests. So this commit removes the email_body field from
these places.
2021-06-22 16:55:32 -07:00
Priyank Patel 81e2c3825c js: Export variables instead of setting them on window. 2021-06-22 16:54:03 -07:00
Suyash Vardhan Mathur 5f07c06040 openapi: Auto render response descriptions.
This commit modifies the templates to
auto-generate general descriptions of
responses directly from the newly
added field of x-response-description
as a part of the goal of a common template.
2021-06-22 10:58:43 -07:00
Suyash Vardhan Mathur cc2aa41fae openapi: Auto render parameter descriptions.
This commit modifies the templates to
auto-generate general descriptions of
parameters directly from the newly
added field of x-parameter-description
as a part of the goal of a common template.
2021-06-22 10:58:43 -07:00
Suyash Vardhan Mathur 35ba5b8d6f openapi: Add markdown extension for parameter descriptions.
As a goal of a common template, there
is a need for a tool to auto-generate
general description for all parameters
directly from OpenAPI data.

This description is to be stored in
x-response-description field, and this
commit adds a markdown extesion to process the same.
2021-06-22 10:58:43 -07:00
Suyash Vardhan Mathur dbcffebf2c openapi: Add markdown extension for response descriptions.
As a goal of a common template, there
is a need for a tool to auto-generate
general description for all responses
directly from OpenAPI data.

This description is to be stored in
x-response-description field, and this
commit adds a markdown extesion to process the same.
2021-06-22 10:58:43 -07:00
Abhijeet Prasad Bodas 226ac4bd3b tornado: Use `UserMessageNotificationsData` for update_message.
This lets us simplify what had previously been somewhat duplicated
logic between the send and edit code paths.
2021-06-22 10:27:59 -07:00
Abhijeet Prasad Bodas c3fb413119 message edit: Don't send mentioned user_ids in event dict.
We already have this data in the `flags` for each user, so no need to
send this set/list in the event dictionary.

The `flags` in the event dict represent the after-message-update state,
so we can't avoid sending `prior_mention_user_ids`.
2021-06-22 10:27:55 -07:00
Tim Abbott 71d5d64086 node_tests: Use module_path as local variable name. 2021-06-22 10:21:07 -07:00
Anders Kaseorg 6dbe03c54b zjsunit: Undo mock_cjs abstraction violation.
There is still no need for mock_template to reach into the internals
of mock_cjs.  Make it a normal caller of mock_cjs.

This is basically the same as 60f5a00c09
(#18804), because the same abstraction violation was since
reintroduced in the same way.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-22 10:19:56 -07:00
Mateusz Mandera 85e19b2bde upload: Use URL manipulation for get_public_upload_url logic.
This is much faster than calling generate_presigned_url each time.

```
In [3]: t = time.time()
   ...: for i in range(250):
   ...:     x = u.get_public_upload_url("foo")
   ...: print(time.time()-t)
0.0010945796966552734
```
2021-06-22 09:35:56 -07:00
Mateusz Mandera e883ab057f upload: Cache the boto client to improve performance.
Fixes #18915

This was very slow, causing performance issues. After investigating,
generate_presigned_url is the cheap part of this, but the
session.client() call is expensive - so that's what we should cache.

Before the change:
```
In [4]: t = time.time()
   ...: for i in range(250):
   ...:     x = u.get_public_upload_url("foo")
   ...: print(time.time()-t)
6.408717393875122
```

After:
```
In [4]: t = time.time()
   ...: for i in range(250):
   ...:     x = u.get_public_upload_url("foo")
   ...: print(time.time()-t)
0.48990607261657715
```

This is not good enough to avoid doing something ugly like replacing
generate_presigned_url with some manual URL manipulation, but it's a
helpful structure that we may find useful with further refactoring.
2021-06-22 09:35:19 -07:00
Priyank Patel 043b0c6ef3 ts: Convert spoilers module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel 91573531bb ts: Convert color_data module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel adf83c6eb7 ts: Convert color_class module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel d660f512fa ts: Convert list_util module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel 6ed635b5ed ts: Convert night_mode module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel 31abcaafb8 ts: Convert ready module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel c862c673af ts: Convert blueslip module to TypeScript.
We turn off the eslint no-use-before-define for TypeScript files
because it does not work correctly for types. There is already
a typescript-eslint version of it that is enabled for TS.

We also update the error handler on window to use instanceof check
for ErrorEvent instead of checking the error property.
2021-06-22 09:09:36 -07:00
Priyank Patel f7235912ff ts: Convert ui_report module to TypeScript. 2021-06-22 09:09:36 -07:00
Priyank Patel 8a6f57d750 ts: Convert common module to TypeScript.
We also update the tippy.js mock in tests to expect a element
(zjquery FakeElement function) instead of zjquery instance, and get
rid of setting _tippy property itself to a noop function.
2021-06-22 09:09:36 -07:00
Priyank Patel 9418ae51fa ts: Convert i18n module to TypeScript.
We update our tsconfig target to ES2020 so that we don't get type
errors related to some properties not being in Intl that is used by
@formatjs/intl.
2021-06-22 09:09:36 -07:00
Priyank Patel f1a0a790fe ts: Convert page_params module to TypeScript.
The plan for type annotating the page_params is to set it to
Record<string, unknown> for now and then annotate individual
properties on it as we use it in typescript modules.
2021-06-22 09:09:36 -07:00
Priyank Patel ec2ab1eb8d lint: Correctly detect the use of style attribute.
We add a exclude pattern that makes sure we don't catch two edge
cases: a variable declaration `const style =` and setting a
variable ending in style such as `require_cmd_style =`. We don't add
and exclude pattern for let declaration because it will catch lines
that modify it later in the code.

(Removed other files from exclude list that no longer needed to be
excluded from this lint rule.)
2021-06-22 09:09:36 -07:00
Priyank Patel 43da43701b refactor: Use variables to get TypeScript type narrowing.
We also add an explicit undefined check for the these return value
of the Map.get calls. This makes the TypeScript conversion diff
cleaner.
2021-06-22 09:09:36 -07:00
Priyank Patel 2a21f626a7 refactor: Use object destructuring for function parameter.
This make type annotating easier.
2021-06-22 09:09:36 -07:00
Priyank Patel fd45ef57fa ui_report: Do not pass jQuery element to the html method.
Although it works, this feature is not documented.
2021-06-22 09:09:36 -07:00
Priyank Patel 9e08c6db93 ui_report: Correctly check if remove_after is passed.
We use a simpler approach here which is to let it be undefined if
nothing was passed and use that in the if condition. This has two
benefits. There is no edge case where the condition will evaluate to
false if 0 was passed and it is easier to type annotate.
2021-06-22 09:09:36 -07:00
Priyank Patel 5ae523891b ui_report: Use numerical check for request status code. 2021-06-22 09:09:36 -07:00
Priyank Patel 97c8987e02 blueslip: Declare log properties directly on the Logger class.
This makes TypeScript type annotation easier (and maybe looks
cleaner.)
2021-06-22 09:09:36 -07:00
Tim Abbott 67fd5585f9 help: Briefly document new tabs in full profile. 2021-06-21 17:21:24 -07:00
Tim Abbott fcb2f66725 popovers: Show user profile popover for all humans. 2021-06-21 17:16:50 -07:00
Anders Kaseorg b4a26bcafd lightbox_overlay: “Pan and Zoom” → “Pan & zoom”.
The ‘t’ helper operates on text strings, not HTML.  The ‘&’ works
fine, and is correctly escaped for output by Handlebars, like any text
string interpolated with ‘{{}}’.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-21 16:38:11 -07:00