Commit Graph

4764 Commits

Author SHA1 Message Date
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
Lani 5a9cba1bba emoji_picker: Allow filtering emojis by unicode characters in emoji picker.
This PR implements literal emoji match in the emoji picker (for reactions)
and in emoji typeaheads (in compose box)

Tested on mobile browser by opening the emoji picker with the
reaction button, selecting an emoji via the native keyboard, and
ensuring the selected emoji appears in the emoji picker’s search
result.

Fixes #21714.
2022-05-31 10:02:57 -07:00
Lani 986dbc44b7 composebox_typeahead: Make reaction_type available in composebox emojis.
In order to make it possible to search emojis with emoji literals,
we need to make the reaction_type of every emoji available in the
emoji objects used by the composebox.
2022-05-31 10:02:57 -07:00
Sahil Batra f38ab85f02 user_groups: Pass user group object instead of id to get_recursive_subgroups.
We directly pass the user group object to get_recursive_subgroups as we
already have the object in the caller. We can add separate function which
will accept id as parameter in the future if required.
2022-05-17 14:51:55 -07:00
Sahil Batra dfd7902c77 user_groups: Rename subgroups fields to direct_subgroup_ids.
This commit renames subgroups and subgroup_ids field sent in user
group objects to direct_subgroup_ids for better readability.
2022-05-17 14:51:45 -07:00
somesh202 b1cafb1280 org_settings: Add "Role" column in bot-list table.
This commit adds a new "Role" column for the bot-list table in the
org-settings, and removes the user_id column from the same.
The role of a bot is fetched using the `get_user_type` function inside
bot_info().
This also adds the `sort_role` in the sort_fields which sorts the role
column in the bot-list table.
2022-05-10 14:09:57 -07:00
yogesh sirsat 918c0b039b popovers: Hide "Send private message" if user not have PM permissions.
If an organization does not allow to send private messages, it will
not display the "Send private message" option in the profile popover.

Currently, there are only two options in settings, first is to allow
every type of user to send PMs and the second is to disable send PMs
for everyone, hence I am just checking that the second option is not
selected.

Fixes: #21888
2022-05-05 14:02:34 -07:00
Sahil Batra eebc776bf5 user_groups: Add is_user_in_group function.
This commit adds function to check whether a user
belongs to the user group or not.

Fixes part of #19525.
2022-05-05 13:51:57 -07:00
Sahil Batra 41880759cf user_groups: Add get_recursive_subgroups function in frontend.
This commit adds get_recursive_subgroups function to get all
subgroups of a user group.
2022-05-05 13:51:53 -07:00
Sahil Batra c52a135eb3 user_groups: Swap parameter order in is_direct_member_of function.
This commit swaps the parameter order in is_direct_member_of
function to have user_id followed by user_group_id since user_id
is a member of user_group_id and not the other way around.
2022-05-05 13:48:01 -07:00
Sahil Batra 6bca2453cf user_groups: Rename is_member_of function to is_direct_member_of. 2022-05-05 13:48:01 -07:00
Sahil Batra a5b3510cb3 user_groups: Add functions to update subgroups data on receiving events. 2022-05-05 13:48:01 -07:00
Sahil Batra e2b9d6ebeb user_groups: Add subgroups field to user group objects. 2022-05-05 13:48:01 -07:00
Ganesh Pawar 59e810790f user_groups: Convert inline form to modal.
Fixes part of #21298.
2022-05-04 17:46:30 -07:00
yogesh sirsat 42ca3a797a settings_users: Modal title clear assert error message. 2022-05-04 17:30:40 -07:00
yogesh sirsat 7b4f7b4a85 settings_bots: Confirmation modal for "Deactivate" bot.
In settings, clicking on deactivate bot button will lead to open
confirmation modal, and displaying all status update notifications
inside this confirmation modal.

This commit is a follow-up of zulip#21490.
2022-05-04 17:30:40 -07:00
Lauryn Menard 44c9b788f9 settings: Add realm setting for Zulip communities directory.
Adds `want_advertise_in_communities_directory` to the realm model
to track organizations that give permission to be listed on such
a site / directory on zulip.com.

Adds a checkbox to the organization profile admin for
organizations to give permission to be advertised in the
Zulip communities directory.

Adds a help center article about the Zulip communities directory
and uses a shared intro documentation file to create sections in
the articles on creating an organization profile and moderating
open organizations.

Co-authored-by: Alya Abbott <alya@zulip.com>
2022-05-04 11:13:28 -07:00
Anders Kaseorg f8d6290db5 zjsunit: Set browserslist target to current Node for Node tests.
Otherwise we run into this error:
https://github.com/zloirock/core-js/issues/1067

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-05-04 09:56:07 -07:00
Aman Agrawal 64ea9125f3 narrow_banner: Simplify empty narrow messages for spectators. 2022-04-29 16:35:49 -07:00
Aman Agrawal 43d789993f login_to_access: Change message displayed for empty narrows.
We change the generic message copy while we're at it.

Also, show login_to_access modal when a spectator tries to access
a stream that either does not exist is is not web-public.
2022-04-29 16:35:49 -07:00
Tim Abbott 627144b0c7 settings: Simplify setting organization default language.
The changes in the last few commits changed the semantics of the
organization default language to no longer be the primary source of
information for a user's language when creating a new account.

Here, we change the settings UI and /help/ documentation to reflect
this.
2022-04-28 15:03:26 -07:00
Dinesh 43107e1424 compose_box: Add button to go the narrow message is being composed to.
This'll be shown only when in a different narrow from what
you're composing to.

Takes care of updating display of the button on moving from
one narrow to another and also on changing inputs. This is
what contributes to majority of js code in this commit.

We are not displaying this for private messages since we do not
have a consistent design for both stream and private compose areas.
See https://chat.zulip.org/#narrow/stream/101-design/topic/narrow.20to.20topic.2Fpms.20when.20composing/near/1318548

Thanks to Vlad Korobov for the icon and for proposing various
designs.
2022-04-28 12:57:42 -07:00
Somesh Ranjan d00fa63aa4 compose: Fix sorting of wildcard mentions in case of PMs.
This commit attemts to fix the sorting of wildcard mentions by moving
them below the silent mentions in case of PMs.
It adds a condition in compare_people_for_relevance function to check
for private message type and sorts the wildcard mention below the silent
ones.
It also adds test for sort broadcast mentions and compare_people_for_relevance
function in case of private message types.

Fixes: #21643
2022-04-28 12:53:46 -07:00
Aman Agrawal 86a6318d30 public access: Fix in-app links to public access option.
We also update these links to the new dedicated article on the topic,
and also remove the zulip.com/zulipchat.com hardcoding.

Fixes #21941.
2022-04-28 12:09:08 -07:00
Aman Agrawal 00fffd1681 help: Rename `web-public-streams` page to `public-access-option`. 2022-04-28 12:09:08 -07:00
Anders Kaseorg 6331a314d4 Correctly hyphenate “non-”.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-04-27 22:10:31 -07:00
Anders Kaseorg d58fece832 Correctly hyphenate “web-public”.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-04-27 22:10:31 -07:00
Anders Kaseorg 175dd999ac dropdown_list_widget: Separate setup method from constructor.
This refactoring is required so the next commit can reorder the
constructor.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-04-27 22:09:10 -07:00
Anders Kaseorg 7e94e3b370 node_tests: Mock classes with classes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-04-27 14:36:00 -07:00
Lauryn Menard 1292338537 frontend: Add `org_type` to realm settings updates and events.
Adds a drop-down menu for updating the organization type in the
`organization_profile_admin` page. Implements front end for
this setting to work / update like other organization profile,
notification and permissions settings.

One special note about this dropdown is that the listed options
should change once an organization has successfully set a type
other than 'unspecified' in the database. To accomplish this
the initial settings overlay build checks the realm_org_type
value in the page_params to select the correct options list,
and when the dropdown value is reset, either for update events
or for discarding changes, the page_params value is again used
to check for whether the 'unspecified' value should be present
as an option in the dropdown menu.

Adds basic node test for the `server_events_dispatch`.
Also adds a new help center documentation article for this
organization setting that is linked to in the UI.

Fixes #21692.
2022-04-26 16:29:12 -07:00
Dinesh 1c0368c402 compose_state: Add is_topic_field_empty().
This is required for adding a narrow-to-recipient button which
we do not want to show when topic field is empty.
2022-04-26 12:58:28 -07:00
Sahil Batra da0b087962 user_groups: Add "subgroups" field to user group objects.
This commit also adds 'subgroups' field to the user_group present
in the event sent on creating a user group. We do not allow passing
the subgroups while creating a user group as of this commit, but added
the field in the event object to pass tests.
2022-04-25 10:24:03 -07:00
Aman Agrawal d0a697fba7 recent_topics: Disable filter buttons for spectator.
Instead of setting `disable` attribute to the elements, we make
them look like disabled and remove interactions with them. This
helps us keep the hotkey handling logic for navigation easier
to manage.

Fixes #21279
2022-04-22 15:33:26 -07:00
Greg Price ce2014bfef typeahead: Normalize spaces for sorting emojis, just like for filtering.
And add a pair of tests.  The first one (with an underscore) passed
already; the second (with a space) passes only with this change.
2022-04-21 17:59:28 -07:00
Greg Price 866a523e55 typeahead tests: Test sort_emojis with capitalized query.
We have logic that handles this.  Best to test it.
2022-04-21 17:59:28 -07:00
Greg Price 5e109aaa4d typeahead tests [nfc]: Tighten sort_emojis test data. 2022-04-21 17:59:28 -07:00
Greg Price 66f47791e4 typeahead: Test spaces equivalent to underscores in get_emoji_matcher.
We already correctly treat spaces equivalent to underscores here.
But we don't do so when we then go on to sort the same results.
(We'll be fixing that shortly.)  So it seems worth testing for it
explicitly.
2022-04-21 17:59:28 -07:00
Greg Price dc6e9df43a typeahead: Don't stop midphrase matching when a second word is typed.
For example, if a user's name is "Simon Peyton Jones", we'll already
match that name on the queries "Pey" or "Peyton", as well as on
"Simon P".  We should do so on "Peyton J" or "Peyton Jones", too.

Similarly, if the user is looking for an emoji of a face in the moon
and they start by typing ":moon", we'll show them both 🌝 "moon face"
and 🌚 "new moon face", along with some other moon-related results.
If they go on to make it ":moon " or ":moon f", though -- as one very
naturally would in order to eliminate things like "waxing moon" and
"moon ceremony" -- then we mysteriously eliminate 🌚 "new moon face".
Instead, the query "moon f" should match both 🌚 and 🌝.

Found this while comparing the web/shared implementation with the
mobile implementation of emoji search.  The new behavior here
reflects what we already do for emoji search in mobile, both in the
compose box's typeahead and in the add-a-reaction screen.  The
existing behavior here seems pretty annoying, so fixing it will be
part of switching on mobile to the shared code (zulip/zulip-mobile#4636)
without regressing the user experience.

The current behavior was introduced, more or less, in 245d65eb9; then
revised in 5edbcb87f to make the logic more clear, and a fix made in
542f4766d, all 2018.  The PR thread was #8286, following issue #8279.
The old behavior before those changes was pure substring matching,
plus a trailing space was ignored (which is the part the issue was
about.)  None of the discussion touches on this question; as far as I
can tell, the fact that "Peyton J" doesn't match "Simon Peyton Jones",
nor "moon " match "new moon face", was entirely an unintentional
side effect of those changes.
2022-04-21 17:59:28 -07:00
Greg Price 6690f79c80 typeahead tests [nfc]: Split up get_emoji_matcher test function.
The better to add more cases here, and to keep them organized.
2022-04-21 17:59:28 -07:00
Greg Price 38eb3f5764 typeahead tests: Add more Unicode emoji to the test data.
We'll use these in upcoming tests.
2022-04-21 17:59:28 -07:00
Greg Price efc26eacec typeahead tests [nfc]: Simplify writing down test Unicode emoji.
This will make it more comfortable to add more.
2022-04-21 17:59:28 -07:00
Greg Price ba1b55cd59 typeahead tests: Fill in emoji_code consistently on test Unicode emoji.
Also delete a comment about what properties are used.  The comment
isn't true: `sort_emojis` looks at `emoji_code` as well as
`emoji_name`, when identifying popular emoji.

And in any case, over here in a test isn't the right place for an
interface description like that to live, if it were true -- rather,
it should be next to the code itself.  That'd make the information
more discoverable when trying to use the code, and would also
increase the chances of getting updated when things change that
would make it untrue.

(For this specific kind of interface information, of course, better
yet would be to be in machine-checkable form right on the code -- in
other words, to be a type annotation.)
2022-04-21 17:59:28 -07:00
Greg Price e91e05d187 typeahead tests [nfc]: Tighten up list of test emoji.
This will make it more comfortable to add a good bit more of these.
2022-04-21 17:59:28 -07:00
Greg Price e7858e094d typeahead tests [nfc]: Simplify expected data to just names.
This will let us stop making individual variables for the different
test emoji, which will make it more comfortable to add more of them.
2022-04-21 17:59:28 -07:00
Anders Kaseorg 1db591de54 node_tests: Add test covering display_emoji_reaction_users setting.
Commit 22a5d008c1 incorrectly left this
out.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-04-19 19:46:36 -07:00