Commit Graph

49615 Commits

Author SHA1 Message Date
Lauryn Menard 19f2795e41 settings-account: Move tooltip for email change disabled to button.
Moves the tooltip when email changes are disabled to be shown on
hovering over the email button text and pencil icon. Removes the
question icon that previously showed the tooltip on hover.
2022-12-30 17:54:00 -08:00
Lauryn Menard c50de056c9 settings-account: Move disable change email logic out of template.
Moves the complicated logic in `account_settings.hbs` for whether
to disable the change email button (and show the tooltip) to
`settings_data.ts`.

This update mirrors how similar realm settings are handled,
such as `realm_name_changes_disabled`, and means that the
`realm_email_changes_disabled` bool is added to `page_params.ts`.

Prep commit for moving the email changes disabled tooltip from
a separate question icon to the disabled button itself.
2022-12-30 17:54:00 -08:00
Lauryn Menard 782cc80d99 account-settings: Refactor change email button and modal class names.
Prep commit for updating tooltip from info icon to disabled button.
2022-12-30 17:54:00 -08:00
Alex Vandiver 7613928e8a apps: Fix redirect from /apps -> https://zulip.com/apps/.
When this code was moved from being in zerver in 21a2fd482e, it kept
the `if ZILENCER_ENABLED` blocks.  Since ZILENCER and CORPORATE are
generally either both on or both off, the if statement became
mostly-unnecessary.

However, because tests cannot easily remove elements from
INSTALLED_APPS and re-determine URL resolution, we switch to checking
`if CORPORATE_ENABLED` as a guard, and leave these in-place.

The other side effect of this is that with e54ded49c4, most Zulip
deployments started to 404 requests for `/apps` instead of redirecting
them to `https://zulip.com/apps/` since they no longer had any path
configured for `/apps`.  Unfortunately, this URL is in widespread use
in the app (e.g. in links from the Welcome Bot), so we should ensure
that it does successfully redirect.

Add the `/apps` path to `zerver`, but only if not CORPORATE_ENABLED,
so the URLs do not overlap.
2022-12-30 17:47:16 -08:00
Alex Vandiver 13ad9e8323 corporate: CORPORATE_ENABLED is always true in corporate.views.portico.
This is a holdover from when the portico was moved from zerver in
21a2fd482e.
2022-12-30 17:44:23 -08:00
Alex Vandiver 0656d0d0bb help: Don't unnecessarily link to zulip.com/help instead of local /help. 2022-12-30 17:44:23 -08:00
Zixuan James Li 6d9aba8aff muted_users: Convert muted_users to typescript.
muted_users.js is another dependency of people.js to be converted into
typescript. Note that for filter_muted_users, we avoid typing persons
with a type that might get added to people.ts in the future, as it
otherwise might introduce cyclic dependency.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-30 11:21:23 -08:00
Zixuan James Li bec8e48616 muted_users: Pop muted_users from page_params.
This avoids accessing the global page_params directly.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-12-30 11:21:23 -08:00
khadeom 9c18641ec4
docs: Fix variable name typo in code-style.md. 2022-12-27 10:43:52 -08:00
Anders Kaseorg edab4ec997 rocketchat: Import timezone-aware datetimes.
The bson library creates naive datetime objects by default.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-27 10:34:30 -08:00
Anders Kaseorg 6e32684d09 export: Replace broken naive datetime warning with assertion.
‘logging.warning("Naive datetime:", item)’ is an invalid call that
crashes with “TypeError: not all arguments converted during string
formatting”.  I take that to mean this check has not been tripped in
the six years it’s been there, and can safely be replaced with an
error.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-27 10:33:47 -08:00
Anders Kaseorg 5f76fb16b7 styles: Add overflow: hidden fallback for overflow: clip.
overflow: clip is missing in Safari < 16.
https://caniuse.com/css-overflow

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-27 10:31:06 -08:00
Anders Kaseorg 9dbb43eb71 realm_logo: Add fallback for MediaQueryList.addEventListener.
MediaQueryList.addEventListener is missing in Safari < 14:
https://caniuse.com/mdn-api_mediaquerylist_eventtarget_inheritance

Fixes #23915.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-27 10:28:20 -08:00
Anders Kaseorg 5fda9f3439 eslint: Clean up configuration.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-25 20:37:51 -08:00
Anders Kaseorg 753deab087 Revert "openapi: Declare items: {} for “inherited” array properties."
This reverts commit a503d19eae (#20755).

The openapi-core bug was fixed upstream.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-19 20:57:05 -08:00
Sebastian Noack d4d285fc43 bootstrap: Remove print media styles.
Bootstrap's print media styles do not improve the appearance of printed
pages of this website.
2022-12-16 00:01:25 -08:00
Sebastian Noack 177e51a900 css: Replace unnecessary figure element with div.
The figure element here was used for a text bubble rather than a
graphics (i.e. "figure"), hence a div element is more appropriate.

This change doesn't effect the visual styling as verfied by comparing
the rendered result visually, and comparing the applied styles in the
devtools.
2022-12-16 00:01:19 -08:00
Sebastian Noack be1ec77300 bootstrap: Remove figure element reset. 2022-12-16 00:01:16 -08:00
Josh Klar c15d066bf5 email-notifs: Use bracketed prefix to indicate a resolved topic.
Some email clients (notably, Gmail Web) support automatically threading
emails together if recipients and subjects match[1]. Manual testing
indicated that prefixing a subject with "[bracketed content]" does not
break this threading behavior, but the added checkmark in a resolved
topic's title does. Before sending an email notification, determine
whether the topic is resolved, and pass this information to the Jinja
template to properly format a threadable email subject.

Fixes: #22538

[1]: https://support.google.com/mail/answer/5900
2022-12-15 23:56:48 -08:00
Josh Klar 69c042bff6 email-notifs: Concatenate topic subject lines only in Jinja.
Previously, stream names and topics (without consideration for their
resolution status) were concatenated in Python-land and passed through
to the template. To more cleanly separate concerns, and to prepare for
accounting for topic resolution status being a third, independent,
component of a subject line, instead pass stream and topic strings
independently to the Jinja template, which can format them as it sees
fit.
2022-12-15 23:56:48 -08:00
Josh Klar 5a9b33fa94 tests: Add helper method to mark a message's topic as resolved.
Additionally, migrate existing EditMessageTest to use this helper
method, with the side effect of migrating the tested flow from a
/json/messages URL to a /api/v1/messages URL.
2022-12-15 23:56:48 -08:00
evykassirer 3d4374f2a6 streams: Return early from can_post_messages_in_stream for spectators.
This code path isn't currently reached for the logged out "spectator"
view, but it will be in upcoming commits. This makes sure that case
is handled properly.
2022-12-15 17:26:04 -08:00
evykassirer 763dfbdcfb composebox_typeahead tests: Use zrequire for compose_ui. 2022-12-15 17:26:04 -08:00
evykassirer 53d8abe79b compose_state: Use stream_name() and topic() universally.
This change ensures that every call to find the stream name or topic
in the composebox is calling compose_state functions instead of directly
taking a value from an HTML element specified by a classname.

This has better code readability and abstracts away the classname,
and also makes it easier to change which classname we use (which
will be happening in an upcoming change as part of switching the
stream name field to a dropdown).

Note that this change means that the stream name will always be
trimmed, whereas before it was whatever the user had written even
if it had trailing whitespace. This shouldn't be an issue as far
as we (me + Tim) can tell, and also it will become irrelevant as
soon as the dropdown changes land.
2022-12-15 17:26:04 -08:00
evykassirer 7f9989003a compose_state: Break out stream_name() into separate getter and setter.
This code is equivalent, because the keep_leading_whitespace parameter
of get_or_set was never used for the stream name.

This addresses an open TODO and makes the code more readable.
2022-12-15 17:25:36 -08:00
Tim Abbott 6200f0f734 narrow: Inline set_narrow_title helper.
Now that it only has a single caller, it's easier to read the code to
get rid of this tiny helper.
2022-12-15 13:09:35 -08:00
Lauryn Menard 7c083edb96 narrow: Update narrow title for undefined filter views.
Updates `compute_narrow_title` to cover the two cases for views
with undefined filters: "All messages" and "Recent conversations".

Also, moves the call to `notifications.redraw_title` from
`set_narrow_title` and to `update_narrow_title`.
2022-12-15 13:05:22 -08:00
Lauryn Menard 7686bca385 narrow: Refactor logic for getting narrow title for browser/tab.
Creates a new function, `compute_narrow_title`, that returns a
string for the narrow title based on the current filter, so that
`update_narrow_title` can call that function, and then use the
returned string to set the narrow title.

Adds a node test for the new `compute_narrow_title` function for
cases that differ from the title generated by `filter.get_title`.
2022-12-15 13:05:22 -08:00
Mateusz Mandera b6067b63b8 docs: Mention the reset_authentication_attempt_count command.
The authenticate_by_username limit of 5 attempts per 30 minutes can get
annoying in some cases where the user really forgot their password and
should be allowed to keep trying with admin approvial - so we should
document the command that allows unblocking them.
2022-12-15 12:56:51 -08:00
Mateusz Mandera f016ab4396 rate_limit: Add comments documenting how each rate limit rule works.
This avoid the need for spelunking the code to figure out the details of
how/when the rule is applied.
2022-12-15 12:56:51 -08:00
Anders Kaseorg c7851d9a00 node_tests: Fix failing stream_data test.
Commit 0bc47b1c77 (#23529) broke this.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-14 21:30:53 -08:00
Alya Abbott 1176f1e674 contributor docs: Add guidance on claiming a second issue. 2022-12-14 21:11:47 -08:00
Tim Abbott 0bc47b1c77 invite: Display globe icon for web-public streams.
This requires both passing through the is_web_public parameter to the
template, and a bit of CSS to make the globe not huge.
2022-12-14 21:04:12 -08:00
SameepAher ebd0908ae6 invite_users: Add globe icon in web public streams.
This is implemented by reusing the stream_privacy handlebars helper.

We can't use it in the public stream case, because the design of the
invite users modal uses no space between the `#` and the stream name.

Fixes part of #23496.
2022-12-14 20:58:29 -08:00
SameepAher 7e4b9a3c01 invite_users: Discard "#" in private streams.
Added an if statement which renders "#" only when it's not "invite only".

Fixes part of #23496.
2022-12-14 20:51:43 -08:00
evykassirer 1b0a14bf40 compose banner: Add specific functions to clear warnings and errors.
Instead of removing all compose banners, we now remove only warnings
and errors -- this makes no difference right now, but this change
will allow us to add other compose banners that are cleared at
different times.
2022-12-14 20:36:07 -08:00
Josh Klar 2e825f637d css: Apply negative spread radius to message box-shadows.
This fixes a visual regression in newer Electron builds (without
regressing Firefox) for which I still don't entirely know the root
cause, where extra "borders" were being applied to messages in both
streams and PMs. Applying a negative "spread radius" to the box-shadow
properties of these elements, and moving that pixel to the "horizontal
shadow" aspect of the property (which is used to create the left-side
"ruler" effect), restores the expected look and feel.

Tested in qutebrowser (Chromium 87-based), Electron v18+v19, and Firefox
107.

Refs (and should unblock) zulip/zulip-desktop#1251
2022-12-14 17:28:37 -08:00
Anders Kaseorg b0c1b2c37f styles: Delete useless rules for stream and topic names.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-14 17:20:07 -08:00
Anders Kaseorg 34306ba1f3 styles: Don’t clip tall characters in stream and topic names.
Fixes #23867.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-12-14 17:20:07 -08:00
Alya Abbott ec32ee6964 help center: Create a dedicated page for All messages. 2022-12-14 14:42:15 -08:00
Rishant Rokaha eed13cecff
stream_settings: Fix invisible view stream btn for private streams.
If new stream is created as one of the two private options, the view stream button was not visible 
immediately, but does appear after a page refresh. This bug turns out to be caused by the wrong
selector being used in the code intended to make the button visible.

Fixes: #22556.
2022-12-14 12:44:00 -08:00
N-Shar-ma 38587b79b9 compose: Always preserve cursor position post replacement in a textarea.
Refactored (moved) the code for preserving the cursor's initial logical
position from `quote_and_reply()` in `compose_actions.js` which calls
`replace_syntax()` directly into `replace_syntax()` in `compose_ui.js`.
This ensures that anytime text in a textarea is replaced, the original
cursor position is always restored.

Earlier, this was needed to be done separately, and missing that would
lead to bugs with the cursor unexpectedly jumping on replacement.

Fixes: #23863.
2022-12-14 12:40:51 -08:00
Rohitt Vashishtha 8d539cff8f css: Remove unneeded 35px right margin from recipient row.
This margin doesn't make sense in a wider view, and is actually
a hinderance to the layout on narrower screens, and removing it still
keeps more than enough separation from the buttons on the right.
2022-12-14 12:27:23 -08:00
Rohitt Vashishtha f6f2f9e70a css: Prevent composebox to_text from getting wrapped.
Even when there is space, the to_text was getting wrapped in languages
that have more than one word for "To:", like Korean.
2022-12-14 12:27:23 -08:00
Sahil Batra d0626bbaef message_edit: Remove get_editability function.
This commit removes get_editability function and we can instead
use is_content_editable and is_topic_editable/can_move_message
functions to check the permissions. We can remove get_editability
since there is no longer a sort order to the possibilities and
it is not necessary that if a user has permission to edit content
then they can edit the topics also.

So, this commit adds is_message_editable_ignoring_permissions
check to is_content_editable and also modifies the tests accordingly.
2022-12-13 23:11:50 -08:00
Sahil Batra 98c4e11d0b settings: Organize message editing and message moving settings.
We separate the message editing and message moving settings
into different sections.

We do not change the help-links for the section headings and keep
both of them same linked to "Configure message eiditng and deletion"
as we would anyway be changing or spliting this page and can update
the links at that time.
2022-12-13 23:11:50 -08:00
Sahil Batra 939a6edf0f settings: Rename helper function to check who can edit topics.
This commit renames "can_edit_topic_of_any_message" function
in models.py to "can_move_messages_to_another_topic" and
"user_can_edit_topic_of_any_message" function in settings_data.js
to "user_can_move_messages_to_another_topic".

This change is done since topic editing permission does not
depend on message sender now and messages are considered same
irrespective of whether the user who is editing the topic had sent
the message or not. This also makes the naming consistent with
what we use for the label of this setting in webapp and how we
describe this action in help documentation.
2022-12-13 23:11:50 -08:00
Sahil Batra ac96db2d95 settings: Update labels of settings for moving messages.
This commit updates the labels for "edit_topic_policy" and
"move_messages_between_streams_policy" settings.

The label for topic editing setting is changed to
"Who can move messages to another topic" since the topic
edit permissions do not depend on message sender now and
messages are considered same irrespective of whether the
message was sent by the user editing the topic or by
someone else.

The label for stream editing setting is changed to
"Who can move messages to another stream".

These changes also makes the labels consistent with how these
actions are described in help center documentation.
2022-12-13 23:11:50 -08:00
Sahil Batra 24a1f7b792 message_edit: Topic editing permission should not depend on message sender.
This commit changes the topic edit permssions in webapp to not depend
whether the user editing the message had sent the message or it was sent
by someone else. Backend changes were done already in previous commits.

Previously, we always allowed topic edits when the user themseleves had
sent the message not considering the edit_topic_policy and the 3-day time
limit. But now we consider all messages as same and editing is allowed only
according to edit_topic_policy setting and the time limit of 3 days in
addition for users who are not admins or moderators.
2022-12-13 23:11:50 -08:00
Sahil Batra cbdb4e98e5 message_edit: Topic editing permission should not depend on message sender.
This commit changes the topic edit permssions to not depend whether the user
editing the message had sent the message or it was sent by someone else.
We only do backend changes in this commit and frontend changes will be done
in further commits.

Previously, we always allowed topic edits when the user themseleves had
sent the message not considering the edit_topic_policy and the 3-day time
limit. But now we consider all messages as same and editing is allowed only
according to edit_topic_policy setting and the time limit of 3 days in
addition for users who are not admins or moderators.
2022-12-13 23:11:50 -08:00