Commit Graph

4808 Commits

Author SHA1 Message Date
Sahil Batra 577abbd434 node_tests: Remove duplicated code in settings_org tests. 2022-08-12 18:09:53 -07:00
Sahil Batra 0c67c7d269 settings: Add checkbox for whether message editing is allowed or not.
This commit adds a checkbox for allow_message_editing setting and
thus we also remove the "Never" option from the time limit dropdown
as unchecking the newly added checkbox will mean the same.

We also disable the time limit input if message editing is not
allowed.

This commit also changes the label for time limit dropdown.

Fixes part of #21739.
2022-08-12 18:09:53 -07:00
Sahil Batra a1f40ccda5 message_edit: Make zero invalid value for message_content_edit_time_limit_seconds.
This commit changes the code to consider zero as an invalid value for
message_content_edit_time_limit_seconds. Now to represent the setting that
user can edit the message anytime, the setting value will be "None" in
database and "unlimited" will be passed to API from clients.
2022-08-12 18:09:53 -07:00
jai2201 aa700ff59d pm_list: Handle narrow functions separately for pm_section.
This commit is a preparatory commit for #20870, it introduces
`handle_narrow_deactivated` and `handle_narrow_activated`
functions in pm_list.js, separately from top_left_corner.js,
to reduce the complexity of handling private messages section
separately.
2022-08-12 15:26:00 -07:00
Anders Kaseorg 1f9573d527 Revert "pm_list: Handle narrow functions separately for pm_section."
This reverts commit 46b289cbda.

This commit didn’t pass Node tests independently of the PR #21726 that
it was split from, because pm_list is mocked.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-08-11 18:12:12 -07:00
jai2201 46b289cbda pm_list: Handle narrow functions separately for pm_section.
This commit is a preparatory commit which introduces
`handle_narrow_deactivated` and `handle_narrow_activated`
functions in pm_list.js, separately from top_left_corner.js,
to reduce the complexity of handling private messages section
separately.
2022-08-11 17:39:04 -07:00
jai2201 45c53d217e pm_list_data: Fix minor typos in comments on the tests. 2022-08-11 17:39:04 -07:00
Tim Abbott 40086c4406 puppeteer: Disable user deactivation test for now. 2022-08-11 17:19:41 -07:00
Riken Shah 7cda08445c puppeteer: Fix `test_narrow_public_streams` test in `message-basics.ts`.
It was introduced in
56b2b838ee commit.

It fixes `test_narrow_public_streams` test which checks
that, there are no bookends in ` /streams/public`. The
issue was there were no bookends by default when we
were checking in the Denmark stream. We fix this by
unsubscribing from the Denmark stream which will
create a bookend.
2022-08-10 16:16:50 -07:00
jai2201 1986b37a04 message_edit: Close message edit UI after message is moved.
Currently, if we navigate to some other topic/stream
while the message is being moved, the message edit UI
still remains open as we do not get its `row` in
`message_lists.current` since the message has not moved yet
to the stream/topic we navigated.

Hence the correct thing to do would be to delete
the message_id from `currently_editing_messages` if it
exists there but we cannot find the row.

Fixes #21724.
2022-08-09 16:24:44 -07:00
Adam Sah 56b2b838ee narrow: /streams/public should not have bookends.
Fixes #18280.
2022-08-09 16:21:39 -07:00
madrix01 c1b5021d84 stream_list: Sort muted to end of sections and add labels.
The stream list left sidebar currently has 3 sections:
* Pinned (+ Muted pinned streams)
* Active (+ Muted active streams)
* Inactive streams

Previously, these sections were separated by horizontal lines, which
did not provide an easy way to discern why there were sections. We add
labels to these section dividers to help with this.

Additionally, within each section, we now sort all muted streams to
the bottom, so that they general minimal clutter.

Fixes #19812.
2022-08-06 21:59:23 -07:00
N-Shar-ma e671decd29 typeahead: Update characters allowed before @-mentions.
Now the following characters are allowed before @-mentions, stream
references (starting with #) and emojis (starting with :) - space, (,
{, [, ", ', /, <.

Earlier only the opening brace type characters and space was allowed.
2022-08-06 19:29:39 -07:00
yogesh sirsat 87ba3c1549 custom_profile_fields: Convert edit profile field form into a modal.
This allows this component to follow existing design patterns, rather
than being its own unusual element with various quirks.

The implementation is approximately the same as before I just migrated
"Edit custom profile field" form into modal, like "Add new custom
profile field" form modal.

Fixes: #21634
2022-08-05 17:26:56 -07:00
yogesh sirsat 526b55c6fc custom_profile_fields: Convert new profile field form to a modal.
This lets us remove this fairly ugly user interface widget, which was
inconsistent with the rest of the settings UI.

The implementation is approximately the same as before I just migrated
"Add new custom profile field" form into a modal, status update
notifications about these forms will be displayed inside their modal,
and made some little design changes as discussed on CZO.

Fixes part of: #21634
2022-08-05 17:26:56 -07:00
Anders Kaseorg 27eed09a84 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-08-04 13:52:06 -07:00
Sahil Batra f3e1b6eaa2 node_tests: Define locally echoed messages correctly in tests.
Currently locally echoed messages are checked using locally_echoed
field in get_editability. Previously it used local_id field but it
was changed in 0e25055c1d. Tests for get_editability used local_id
till now, but the tests were passing as the message was not allowed
to edit due to time limit. This commit fixes the tests to use
locally_echoed field instead.
2022-08-03 15:59:51 -07:00
N-Shar-ma 13ef0b5b04 left-sidebar: Use -, _ and / additionally as stream word separators.
Uptil now only space was used as a word separating character when
searching streams. This meant that searching for "xyz" would not turn
up a stream named "stream-xyz" as one would expect.

Since -, _ and / are likely to be used as word separators in stream
names, these 3 are added as word separators for streams. The utility
function `filter_by_word_prefix_match` is refactored by adding an
optional `word_separator_regex` argument.

Fixes: #19700.
2022-08-02 15:55:07 -07:00
Sahil Batra 1455f290f2 settings_bots: Use same modal that is used in admin bot-edit form.
We change the edit form opened from "Personal" settings section
to be same as the form opened from "Organization" section.
2022-07-31 16:56:03 -07:00
Anders Kaseorg b945aa3443 python: Use a real parser for email addresses.
Now that we can assume Python 3.6+, we can use the
email.headerregistry module to replace hacky manual email address
parsing.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-29 15:47:33 -07:00
Ivan Toymentsev cd0821084c upload: Locally verify file size before uploading the file.
With an extended comment by tabbott.

Fixes #21978.
2022-07-28 14:15:04 -07:00
yogesh sirsat f264795770 deactivate_users: Change submit button text of confirmation modal.
Change submit button text of both bot and user deactivation confirm
modal from "Confirm" to "Deactivate".
Calling `launch()` function from `dialog_widget.js` because
`confirm_dialog.js` set submit button text to "Confirm".
2022-07-27 17:09:48 -07:00
yogesh sirsat 9f21e34592 settings_users: Add ? in deactivate confirmation modal title. 2022-07-27 17:09:48 -07:00
yogesh sirsat d090347ea9 settings_bots: Change of text in bot deactivate confirmation modal.
Also, add `?` at the end of title of the this modal.
2022-07-27 17:09:48 -07:00
Nikhil Maske 249d2a5d55 confirm_deactivate_user: Provide additional information about user.
Providing additional information like number of invites and number of
bots owned by deactivating user in the confirm_deactivate_user modal
will help the administrator if they need to do any follow-up work.

Fixes #20973.

Completed-by: Ganesh Pawar <pawarg256@gmail.com>
2022-07-26 17:03:02 -07:00
Anders Kaseorg 0bf7d76fb2 zjsunit: Fix mock_esm call site detection.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-22 19:30:55 -07:00
Sahil Batra aa7bd76e5d compose: Show same error message everytime user is not allowed to post.
We do not show different error messages for different values of post
policy values if user is not allowed to post making it consistent with
other settings like wildcard mention settings and organization settings.

This also helps us deduplicate some code as we use almost same code
for excluding the streams to which user is not allowed to post from
the dropdown in moving messages UI.
2022-07-22 17:19:40 -07:00
Sahil Batra 18dda7b485 message_edit: Do not show streams to which user cannot post.
We do not show the streams to which user cannot post in the dropdown
list widget for moving messages between streams.
2022-07-22 17:19:40 -07:00
Lauryn Menard 35e9e4cd3b keyboard-shortcuts: Add class to arrow keys for Mac shortcuts.
The <kbd> elements in `static.templates.keyboard_shortcuts.hbs`
that are arrow keys have a class of "arrow-key". This adds that
class to arrow keys that are updated via `adjust_mac_shortcuts`.

Follow-up task due to changes introduced in #22330.
2022-07-20 11:05:15 -07:00
Sahil Batra 2bcd55dade settings_config: Remove stream-admins option for wildcard mention policy.
This commit removes the stream-admins option for wildcard mention policy
in webapp since we are not moving forward with stream administrator
concept and instead working on new permssions model as per #19525. There
is no functional change, we only remove the by_stream_admins_only key and
instead use by_admins_only with the correct code value.
2022-07-13 17:07:44 -07:00
Sahil Batra 093a74bd54 models: Remove "role" field from Subscription.
This commit removes "role" field from subscription
objects since we are not moving forward with stream
administrator concept and instead working on new
permssions model as per #19525.
2022-07-13 17:07:44 -07:00
Anders Kaseorg c520890f54 node_tests: Remove low-hanging uses of __Rewire__.
When we were preparing the conversion to ES modules in 2019, the
primary obstacle was that the Node tests extensively relied on the
ability to reach into modules and mutate their CommonJS exports in
order to mock things.  ES module bindings are not mutable, so in
commit 173c9cee42 we added
babel-plugin-rewire-ts as a kludgy transpilation-based workaround for
this to unblock the conversion.

However, babel-plugin-rewire-ts is slow, buggy, nonstandard,
confusing, and unmaintained.  It’s incompatible with running our ES
modules as native ES modules, and prevents us from taking advantage of
modern tools for ES modules.  So we want to excise all use of
__Rewire__ (and the disallow_rewire, override_rewire helper functions
that rely on it) from the tests and remove babel-plugin-rewire-ts.

Commits 64abdc199e and
e17ba5260a (#20730) prepared for this by
letting us see where __Rewire__ is being used.  Now we go through and
remove most of the uses that are easy to remove without modifying the
production code at all.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-13 16:27:30 -07:00
YashRE42 20f36431ec presence: Rename hbs templates to not have the word "user".
This is a prep commit for enabling a two section layout in the
buddy_list. The sections will be for "users" and "others".

Hence, this commit performs a simple rename of:
- `user_presence_row.hbs` -> `presence_row.hbs`
- `user_presence_rows.hbs` -> `presence_rows.hbs`
And then a search and replace of `user_presence_row` to
`presence_row` (which also handles the second rename).

It also makes one modification in buddy_list.js where it changes a
template variable we're passing from "users" to "row_members".
2022-07-13 14:34:44 -07:00
Aman Agrawal df6ad8154a default_language_modal: Add more space around languages displayed.
We use 3 columns on wide screens and come down to 1 column on
narrow screens to ensure that the languages are properly
displayed.
2022-07-12 17:23:15 -07:00
evykassirer 1b24bfcc31 mark as read: Fix banner not closing when x is clicked.
Previously, the X in the mark-as-read banner did nothing.
2022-07-12 16:34:26 -07:00
Lauryn Menard 32d396fdc7 help-docs: Remove `mac-cmd-style` CSS rule.
Removes the `mac-cmd-style` CSS rule that was introduced in
d3e8348 when support for updating keyboard shortcuts with
the `Ctrl` key to the Mac cmd key, `⌘`, was added.

Removing the rule makes the font-size and font-family CSS more
consistent with other keyboard shortcuts in the documentation.

Also, removes the parameter in `adjust_mac_shortcuts` that added
the CSS class / rule to these specific keyboard shortcuts.
2022-07-12 12:17:41 -07:00
Anders Kaseorg d3f2203459 input_pill: Remove random IDs.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-11 11:44:47 -07:00
Anders Kaseorg fc6b4ff6aa input_pill: Identify pills by DOM nodes, not random IDs.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-11 11:44:47 -07:00
Anders Kaseorg 4d0fca8285 zjsunit: Merge with_field, with_…_disallowed into with_overrides.
This increases consistency and saves a bit of code, but more
importantly, it makes it much easier to switch between these APIs
while refactoring tests.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-11 11:35:49 -07:00
N-Shar-ma 082e9adcea typeahead: Don't match descriptions for streams and user groups.
Uptil now, both names and descriptions of streams and user groups were
matched to show the typeahead suggestions. This led to unexpected
behaviour like for a clear mention of a certain stream, the typeahead
menu suggested a completely different stream which had a mention of
the first stream in it's description.

To prevent such bugs and also since description matching is not really
useful for streams and user groups, only names will be matched.
2022-07-08 14:28:29 -07:00
Lauryn Menard 24d1d08553 mac_shortcuts: Render shortcuts with `Fn` key correctly.
Updates the `adjusts_mac_shortcuts` function to render shortcuts
with the `Fn` key as a separate html element (e.g. `Fn` + `arrow`)
instead of rendering the shortcut as one block (e.g. `Fn + arrow`).

Also, because keyboard shortcuts should be rendered with each key
as a separate html element, updates `adjusts_mac_shortcuts` to
only change html elements that are an exact match to a keyboard
key. Html elements with whitespace will be ignored (e.g. `Enter`
becomes `Return`, but `Enter or Backspace` is not changed though
it previously would have been changed to `Return or Delete`).

Fixes #22112 (in combination with #22273).
2022-07-07 17:38:26 -07:00
Ganesh Pawar c6d636ef48 realm_domains_modal: Migrate modal to dialog_widget. 2022-07-07 14:56:45 -07:00
Anders Kaseorg 4ebcc9ba95 puppeteer_tests: Fix type errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-07-06 17:23:16 -07:00
Anders Kaseorg 706d96b22e templates: Simplify nested Handlebars conditionals using {{else if}}.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-06-30 11:24:44 -07:00
Gaurav Pandey 3aa9e4c553 recent_topics: Link timestamp to latest message.
Link the timestamp in recent topics to the
"near" link of the latest message within that topic.
Fixes #21356.
2022-06-28 13:31:27 -07:00
Anders Kaseorg 25f6b53e90 docs: Capitalize Handlebars consistently.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-06-27 13:35:10 -07:00
evykassirer 72166f1b03 puppeteer: Fix get_element_text including hidden text.
Previously, this function used the `textContent` property, which
includes hidden elements. Fix this by using innerText instead.
2022-06-02 16:44:24 -07:00
evykassirer e039bdd1e1 narrow: Replace pm_string() with _id and _email variants.
This makes the format returned by these functions more clear.
2022-06-02 16:41:06 -07:00
Aman Agrawal 66b80c8ae8 admin: Use language_selection_widget to set notification language.
Fixes #21948
2022-06-01 17:08:00 -07:00
Aman Agrawal 59e676b1f5 gear_menu: Allow spectators to select their default language.
Set the default_language as cookie and reload the page so that
the spectator can immediately see the language change in effect.

We can reload the page forcefully for spectators since there is
no chance of any work being lost. It is possible that the spectator
may lose the selected message on doing so.

This requires a new dependency, to be able to set cookies from
frontend JavaScript.

Fixes #21961
2022-06-01 17:08:00 -07:00