Commit Graph

50395 Commits

Author SHA1 Message Date
Anders Kaseorg bd272149e6 dependencies: Add missing direct dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg 61f91f8503 tests: Mock autosize.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg d5b2a667c5 message_view_header: Remove unused value for absent i18n placeholder.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg 13066e6406 styles: Fix dark-theme mixin in zulip.css.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg ecde9066d7 stylelint: Fix declaration-block-no-redundant-longhand-properties.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg 790c8a1582 stylelint: Fix at-rule-empty-line-before.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Lauryn Menard a9b3a9c673 narrow: Use dict to map operator to by_* method in NarrowBuilder.
Updates the logic for identifying the method to use to extend the
query for the given term from a narrow to use a dictionary that
maps the operator string to the by_* method in the NarrowBuilder
class.

Previously, the by_* method was determined by building a string
based on the operator string and replacing dashes with underscores.
2023-03-20 15:37:09 -07:00
Joelute ff6ff1e014 integration: Add branch names to Azure Devops merged PR event.
This is a follow up to #24673, we want to modify every webhook
events to follow the same pattern and consistency where branch name
should only show on opened and merged events.
2023-03-20 12:33:47 -07:00
Anders Kaseorg cd3c4cd991 styles: Extend help sidebar heading links like list links.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 11:35:53 -07:00
Alex Vandiver 33b61d9dc4 invite: Be more fair about the no-messages-sent warning flag.
The RealmCount statistics will be empty if the realm was created since
the last daily aggregation.  In cases where the daily stats have no
rows, it is likely fast enough to do the real count in the messages
table.  This stops unduly penalizing folks who have actually sent
messages, and are just inviting people within the first day.
2023-03-20 11:35:19 -07:00
Alex Vandiver e6eaa9a7f6 webhooks: Handle explicit null context_line in Sentry. 2023-03-20 11:34:17 -07:00
Lauryn Menard 8fb001ce92 docs: Add tip about cross-linking between GitHub and dev community.
Adds a point in the "Tips and best practices" section of the
article on writing reviewable pull requests about cross-linking
between GitHub pull requests and conversations in the Zulip
development community.
2023-03-20 11:33:44 -07:00
Satyam Bansal 6323fc9571
api_docs: Fix outdated python code snippet for webhook integrations.
The python code snippet referred to exactly doesn't exists.
This commit changes it to the exact code present in
"zerver/lib/integrations.py", which has a type annotation.
2023-03-20 11:30:38 -07:00
Alex Vandiver 311a76ed1c Move QOS configuration into connection, not queue verification.
Prior to aa032bf62c, QOS prefetch was set on every `publish` and
before every `start_json_consumer` -- which had a large and
unnecessary effect on publishing rates, which don't care about the
prefetch QOS settings at all, much less re-setting them before every
publish.

Unfortunately, that change had the effect of causing prefetch settings
to almost never be respected -- since the configuration happened in
`ensure_queue`s re-check that the connection was still live.  The
initial connection is established in `__init__` via `_connect`, and
the consumer only calls `ensure_queue` once, before setting up the
consumer.

Having no prefetch value set causes an unbounded prefetch; this
manifests itself as the server attempting to shove every event down to
the worker as soon as it starts consuming; if the client cannot keep
up, the server closes the connection.  The worker observes the
connection has been shut down, and restarts.  While this does make
forward progress, it causes large queues to make progress more slowly,
as they suffer from sporadic restarts.

Shift the QOS configuration to when the connection is set up, which is
a more sensible place for it in general -- and ensures that it is set
on consumers and producers alike, but only once per connection
establishment.
2023-03-20 11:28:29 -07:00
Anders Kaseorg ad357b18c0 bootstrap: Remove CSS hacks for IE.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 11:27:39 -07:00
Anders Kaseorg 70e9fc8b12 postcss: Enable postcss-preset-env.
This gives more comprehensive support of new and future CSS features
that can be transpiled for older browsers.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 11:26:30 -07:00
Anders Kaseorg 5cdf38b1f7 styles: Use standard CSS nesting syntax.
CSS nesting is being standardized with the syntactic restriction that
the nested selector cannot start with an identifier.  This was
necessary to allow the syntax to be parsed without lookahead.

https://webkit.org/blog/13813/try-css-nesting-today-in-safari-technology-preview/
https://www.w3.org/TR/css-nesting-1/#syntax

The postcss-nesting plugin used by postcss-preset-env enforces this
restriction.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 11:26:30 -07:00
Anders Kaseorg f03b609bfd Revert "minor: Add `z-index` to `message_time` class."
This reverts commit e16e7630e6 (#19542).

This was compiling to

    a.messagebox-content .message_time {
        z-index: 1;
    }

which did nothing, because .messagebox-content is a <div>, not an <a>.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 11:26:30 -07:00
Anders Kaseorg 182969fba1 integrations_dev_panel: Fix unsafe use of innerHTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 10:31:15 -07:00
Anders Kaseorg b21d93cdd2 help: Fix import-self-hosted-server-tips indentation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-18 00:09:43 -07:00
Anders Kaseorg 14352547cd install-transifex-cli: Upgrade Transifex CLI from 1.6.4 to 1.6.5.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-17 13:11:02 -07:00
Anders Kaseorg d4cc50c468 web: Remove inappropriate $ prefix from HTML variables.
Only jQuery object variables should be prefixed with $.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-17 11:35:43 -07:00
Alex Vandiver fa6daee4e1 markdown: Fix use of pure_markdown for non-pure markdown rendering.
`render_markdown_path` renders Markdown, and also (since baff121115)
runs Jinja2 on the resulting HTML.

The `pure_markdown` flag was added in 0a99fa2fd6, and did two
things: retried the path directly in the filesystem if it wasn't found
by the Jinja2 resolver, and also skipped the subsequent Jinja2
templating step (regardless of where the content was found).  In this
context, the name `pure_markdown` made some sense.  The only two
callsites were the TOS and privacy policy renders, which might have
had user-supplied arbitrary paths, and we wished to handle absolute
paths in addition to ones inside `templates/`.

Unfortunately, the follow-up of 01bd55bbcb did not refactor the
logic -- it changed it, by making `pure_markdown` only do the former
of the two behaviors.  Passing `pure_markdown=True` after that commit
still caused it to always run Jinja2, but allowed it to look elsewhere
in the filesystem.

This set the stage for calls, such as the one introduced in
dedea23745, which passed both a context for Jinja2, as well as
`pure_markdown=True` implying that Jinja2 was not to be used.

Split the two previous behaviors of the `pure_markdown` flag, and use
pre-existing data to control them, rather than an explicit flag.  For
handling policy information which is stored at an absolute path
outside of the template root, we switch to using the template search
path if and only if the path is relative.  This also closes the
potential inconsistency based on CWD when `pure_markdown=True` was
passed and the path was relative, not absolute.

Decide whether to run Jinja2 based on if a context is passed in at
all.  This restores the behavior in the initial 0a99fa2fd6 where a
call to `rendar_markdown_path` could be made to just render markdown,
and not some other unmentioned and unrelated templating language as
well.
2023-03-17 08:46:25 -07:00
Zixuan James Li 24f24d236d cache: Use QuerySetAny for isinstance check.
Previously, `QuerySet` does not support isinstance check since it is
defined to be generic in django-stubs. In a recent update, such check is
possible by using `QuerySetAny`, a non-generic alias of `QuerySet`.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-03-17 08:38:20 -07:00
Alex Vandiver f2a20b56bc puppet: Enable sentry hooks for production and staging. 2023-03-17 08:10:31 -07:00
Aman Agrawal c4903fe85a message_row: Fix rewrapping message lines after receiving ack.
Since the message time of locally echoed messages were not displayed
and their width was restricted by `notvisible` CSS class, it
resulted in width available to message text changing after the message
was successfully sent and the time was displayed.

To fix this, we just try to set opacity of the message time to 0
for locally echoed messages.
2023-03-17 08:10:13 -07:00
Tim Abbott 93d0a6b1ba version: Add missing API feature level bump.
This should have been done in
042bbf2936.
2023-03-16 14:55:48 -07:00
Anders Kaseorg 3109ee8015 eslint: Enable @typescript-eslint/recommended plugin.
This is not automatically enabled by
@typescript-eslint/recommended-requiring-type-checking for some
reason.

https://typescript-eslint.io/linting/configs/#recommended

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-16 13:24:27 -07:00
Anders Kaseorg 96e657a954 install-node: Upgrade Node.js from 18.14.1 to 18.15.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-16 12:32:28 -07:00
Alex Vandiver 330141f55d invites: Switch new LIMITED-plan heuristic to enforcing. 2023-03-16 11:41:49 -07:00
Alex Vandiver 50a2a54393 test_invite: Rework and expand invitation limit tests.
This adds tests for more corner cases, in exchange for dropping the
query count tests, which were of dubious utility.  It also adds the
time-machine library to mock the current time to test that the limits
do expire.
2023-03-16 11:41:49 -07:00
Alex Vandiver 6971c6d62d test_invite: Just import django.core.mail and use it. 2023-03-16 11:41:49 -07:00
Alex Vandiver 9e972bc82c test_invite: Clarify by filters that no *new* ScheduledEmails are made. 2023-03-16 11:41:49 -07:00
Alex Vandiver 83fdc59304 test_invite: Remove a totally uninteresting assert. 2023-03-16 11:41:49 -07:00
Alex Vandiver 566806fb41 test_invite: Fix a docstring. 2023-03-16 11:41:49 -07:00
Alex Vandiver 695730b609 test_invite: Explicitly test that no emails are actually sent. 2023-03-16 11:41:49 -07:00
Alex Vandiver 34c8cd1b74 tests: Split out test_invite from test_signup.
There is no good reason for this single test file to be more than 6k
lines.
2023-03-16 11:41:49 -07:00
Joelute 869cb6dc34 integration: Modify branch names on pull request events.
Previously when Github bot receives an update pull request event,it
will produce the following message:

user updated PR #1 Start writing unit tests from test to main

"from test to main" is improper and causes unnecessary confusion.
These changes will update the logic to remove the phrase from
update events. These changes will also include the org: prefix to
the branch names to keep it consistent with Github and further
reduce confusions on branch names.

Fixes #24536.
2023-03-16 11:31:48 -07:00
Lauryn Menard c446f86173 rendered-markdown: Move `pre` element CSS reset rules.
Moves CSS reset rules for `pre` elements to the `rendered_markdown`
class block.

Adds the `rendered_markdown` class to the scrollbar rules.
2023-03-16 11:30:04 -07:00
Lauryn Menard 2d8283e579 rendered-markdown: Move inline code CSS reset rules.
Moves the CSS reset rules for inline code elements to be in the
`rendered_markdown` class block.
2023-03-16 11:30:04 -07:00
Lauryn Menard d98ba32588 rendered-markdown: Copy anchor tag CSS rules from bootstrap.
Prep commit for moving CSS reset rules for inline code elements
in `rendered_markdown.css` to the `rendered_markdown` class rules.
2023-03-16 11:30:04 -07:00
Anders Kaseorg 83b6866018 templates: Replace unnecessary {{#tr}} blocks with {{t}} helper.
`{{#tr}}` supports HTML and allows translators to accidentally
introduce HTML, so it’s safer to use the `{{t}}` helper unless HTML is
needed.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-16 11:26:45 -07:00
Anders Kaseorg 8cd78d356f templates: Allow the same line-wrapping in {{t}} as in {{#tr}}.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-16 11:26:45 -07:00
Anders Kaseorg ba5a2c8866 templates: Support context variables in Handlebars {{t}} helper.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-16 11:26:45 -07:00
Prakhar Pratyush 042bbf2936 UserTopic: Set visibility_policy or delete UserTopic row without error.
This commit updates 'set_user_topic_visibility_policy_in_database'
to not raise an error when deleting a UserTopic row and the user
doesn't have a visibility_policy for the topic yet, or when setting
the visibility_policy to its current value.

Also, it includes the changes to not send unnecessary events
in such cases.
2023-03-16 10:55:54 -07:00
David Rosa f783e8b6ca help: Add a dedicated page on how to add emphasis to text.
- Adds "Via Markdown" instructions block.
- Adds "Via compose box buttons" instructions block.

Fixes part of #24209.
2023-03-16 10:51:57 -07:00
David Rosa 2e2747dfac help: Update Message formatting documentation.
- Updates intro paragraph in Message formatting page.
- Change Markdown syntax -> Markdown formatting.
- Reorders items in the Writing messages section of the left sidebar.
2023-03-16 10:51:57 -07:00
David Rosa b66d8dfd90 help: Add new "Writing messages" section.
Moves pages from "Sending messages" to a new help center section
to document what you can do in a Zulip message, and make this
information easy to find.

Fixes #24208.
2023-03-16 10:51:57 -07:00
Prakhar Pratyush 80a50741e5 help: Update 'Include organization name in subject line' documentation.
Document new "Automatic" configuration option.

This commit updates the help page 'email-notification.md' to reflect
the change in zulip#24075 from a checkbox to a dropdown for the
'Include organisation name in subject line' setting.
2023-03-16 10:49:07 -07:00
Zixuan James Li ee26590528 util: Implement a safer type narrowing helper for arrays.
This implements a helper that parses an array that possibly contains
falsy elements into undefined when it does have at least one falsy
element, or returns a type narrowed array of non-undefined elements.

We use this in people.js, which achieves the same check we have using
"arr.every(Boolean)", but with type safety since it is not based on
validation.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-03-16 10:47:12 -07:00