Commit Graph

4741 Commits

Author SHA1 Message Date
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
Austin Riba 12c563cc94 Revert "shared: Match literal emoji in typeahead."
This reverts commit a8fd535955.
This reverts commit 944781e873.

In an attempt to introduce code from mobile into web to match literal
emojis, the author inadvertently introduced a buggy and smelly change.
Probably best to leave the implementation of this in mobile where there
is more context about the shape of the emoji object available. Web
doesn't actually benefit from the additional behavior anyway.

See https://github.com/zulip/zulip/pull/21723#pullrequestreview-937051603
2022-04-14 11:51:40 -07:00
somesh202 b4aeb7a622 compose: Remove "stream" mention in case of PMs.
This commits adds an wildcard_mention_array which would contain the
mention tokens according to the message type. In case of PMs, it uses
only "all" and "everyone" mentions.

Fixes part of #21643.
2022-04-13 16:06:05 -07:00
somesh202 5bddd8fa48 compose: Fix "Notify" string in wildcard mentions typeahead for PMs.
This commit attempts to fix the suggestions typeahead for wildcard
mentions in case of PMs by using a conditional which checks for the
current compose_state and changes the string in parentheses accordingly.
In case of PMs, it uses the "(Notify recipients)" string instead of
"(Notify stream)".
2022-04-13 16:06:05 -07:00
Anders Kaseorg a682530fd4 node_tests: Enforce 100% coverage for test files.
This makes it easier to find obsolete parts of the tests that should
be cleaned up.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-04-10 19:31:56 -04:00
Anders Kaseorg 8aed6321bd node_tests: Make localStorage mock common.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-04-10 19:31:56 -04:00
Austin Riba 944781e873 shared: Do not throw exception in parse unicode.
There is no guarantee that the code passed into parse_unicode_emoji_code
is valid unicode. In the case that it is not, it might be better to
return undefined instead of throwing an exception: to represent a
non-parseable code.

For context, mobile currently returns custom emojis as emojis with
string names in their code property, instead of actual unicode.
2022-04-07 17:23:55 -07:00
jai2201 c6f2b9c636 left-sidebar: Use same logic as of Topics view to render PMs.
Change the logic for rendering PM threads in PM section to
be in the same as that of topics view --
In default view, only recent 5 PM threads would be shown
and append the active conversation as the 6th one at last
if not present in those 5.

In PM section with unreads, a maximum of 8 conversations
would be shown and rest of them would be hidden behind
the 'more conversations' li-item, clicking on which takes
to the zoomedIn view of PM section where all the present
PM threads would be visible.

Co-authored-by: Tim Abbott <tabbott@zulip.com>
2022-04-06 16:51:15 -07:00
Tim Abbott 64cdb9a919 left sidebar: Rename convos => conversations variable names.
This name violated our policy against abbreviations.
2022-04-06 16:51:15 -07:00
Aman Agrawal 4a73fd9e10 overlays: Add `is_modal_open` check along with `is_active` check.
This applies the fixes we have when restoring scroll position and
marking messages as read in background for overlays to modals.
2022-04-06 14:27:20 -07:00
Austin Riba a8fd535955 shared: Match literal emoji in typeahead.
This PR implements checking for a literal emoji match in emoji
typeaheads. In other words, if you paste or type panda face into an
emoji typeahead, panda face should be presented as an option to choose
from.

This behavior is currently present in the mobile app, adding it to
shared will enable both platforms to utilize this logic.
2022-04-06 14:25:29 -07:00
Steve Howell b7e2f8dfa6 markdown: Have users report marked errors to Zulip.
marked.js provides a helpful error message asking for bugs to be
reported upstream, but since we're running a fork, we should redirect
such support requests to us.

We can triage as necessary.
2022-04-05 11:45:59 -07:00
Steve Howell c7ed21f891 markdown: Avoid blueslip dependency.
If katex throws an error that we can't deal with,
we just re-throw it now.
2022-04-05 15:22:53 +00:00
Steve Howell 918de49f6b markdown: Nest get_linkifiers_regexes().
This makes parse() more re-entrant.

This also drives out a change to the linkifiers
test, where I no longer couple the linkifiers
logic to markdown concerns. I probably should have
done this in an earlier commit, but better late
than never. I didn't bother to split out a commit
for the test stuff, since it's just tests and
the commit is still fairly atomic in nature.
2022-04-05 12:42:15 +00:00
Steve Howell 17b60efdc7 markdown: Inject function for emoticon translations.
We want our parser to be as re-entrant as possible.
2022-04-04 14:07:18 -07:00
Steve Howell 214ec099bb markdown: Eliminate setup() call.
It has always been pretty arbitrary what we did inside
of setup() vs. parse(), and we want to avoid unpredictable
results from other platforms neglecting to call setup().

On my machine you can parse a simple message in about
25 microseconds, based on a trial of a million messages
with the content of "**bold**".  Whatever portion of
that time is related to setup-related things like
compiling regexes should be negligible from the user's
perspective, since we never run parse() in a loop.
2022-04-04 14:07:18 -07:00
Steve Howell 2bfdbbe7dc markdown: Extract get_topic_links. 2022-04-04 14:07:18 -07:00
Steve Howell 326dbfb934 markdown: Use options, not rules, for linkifier regexes.
This avoids the need to set a global from linkifiers.js.
2022-04-04 14:07:18 -07:00
Steve Howell 3884710033 markdown: Inject linkifiers helper. 2022-04-04 14:07:18 -07:00
Steve Howell 1156001840 markdown: Inject emoji helpers.
Note that we try to avoid the helpers global, but we
still need a future commit to further clean things up.
2022-04-04 14:07:18 -07:00
Steve Howell 06ba05b44d markdown: Extract parse_non_message().
The zcommand code was calling directly into the "marked"
library, which was extremely misleading, since you don't
get a vanilla parse of the markdown due to the fact
that markdown.js calls setOptions at initialize time.

This commit shifts the responsibility to markdown.js
as well as adding a bit of test coverage, but it is
otherwise just a pure code-move refactoring.

The next commit will tweak things further.
2022-04-04 14:07:18 -07:00
Steve Howell c943447c6e emojis: Un-share the emoji.js module.
The mobile app was never able to use the shared
version of emoji.js, because, among other problems
with our code organization, the emoji.js module
is strongly based on a mutate-the-data paradigm
that doesn't play nice with React.  The way
that we mutate data and violate encapsuation
here is something that we would mostly want to fix
without even trying to shared code with mobile, so
subsequent commits will try to extract some pure
functions into a shared module.
2022-04-04 13:28:49 -07:00
Steve Howell 8d9e6d6b87 markdown: Clean up API for future reuse.
This gets us closer to having an API that can
be used my mobile.

The parse() function becomes a subset of
apply_markdown() that is no longer coupled
to the shape of a webapp object, and it can
be supplied with a new helper_config for each
invocation. Mobile will likely call this directly.

The setup() function becomes a subset of
initialize() that allows you to set up the
parser **before** having to build any kind of
message-specific helpers. Mobile will likely
call this directly.

The webapp continues to call these functions,
which are now thin wrappers:

    * apply_markdown (wrapping parse)
    * initialize (wrapping setup)

Note we still have several other problems to
solve before mobile can use this code, but we
introduce this now so that we can get a head
start on prototyping and unit testing.

Also, this commit does not address the fact
that contains_backend_only_syntax() is still
bound to the webapp config.
2022-03-30 14:31:00 -07:00
yogesh sirsat c5bb9cb08a settings_users: Confirmation modal for "Reactivate" user.
The implementation closely follows `handle_deactivation()`.

Using the same existing reactivate confirmation modal.

Also, this commit will also lead to open confirmation modal
to reactivate bots in settings > bots, and currently there is no
existing confirmation modal for deactivating bots.

This commit is a follow-up of #21436.
2022-03-24 12:39:12 -07:00