Commit Graph

12134 Commits

Author SHA1 Message Date
nikhilmaske-2001 32bde79b61
confirm_dialog: Use the Confirm and Cancel labels.
Long labels like "Yes, Unsubscribe this stream" can
be confusing for translators and it can also create bad
strings that can end with like 4 long words in German.
It is better to have the simple options like "Confirm"
and "Cancel". This commit fixes this issue by changing
the text to "Confirm".

Fixes #17926.
2021-04-26 16:36:21 -07:00
Tim Abbott c3247128ff lint: Fix prettier issues with last commit. 2021-04-26 14:50:58 -07:00
aryanshridhar 29df7dc9c1 realm_emoji: Add warning modal before overriding default emoji.
Previously, realm emojis can override default emojis in emoji-picker,
if the user sets an exisitng emoji name to his/her custom emoji.

For clear understanding--
If a user sets an realm emoji with name `smile`, this leads to the
newly realm emoji override the existing default emoji `smile`.

To address such behaviour, Added a warning modal which requires
the user confirmation before overriding the default emoji.

Fixes #16913.
2021-04-26 14:42:10 -07:00
aryanshridhar 747209a8ca realm_emoji: Shift realm_emoji request call in a function.
Relocated the post request in a new `add_realm_emoji`
function to built an better abstraction for `settings_emoji`.
2021-04-26 14:41:49 -07:00
Tim Abbott 3fd33fdcce templates: Move user_groups_admin to settings/. 2021-04-26 09:37:38 -07:00
aryanshridhar 8c43c4a9aa template: Move `admin_user_list` template to `settings` folder.
Moved `admin_user_list` template to `/templates/settings/` folder as
earlier, it was inaccurately placed within the `/templates` folder
rather than the `/templates/settings` folder.

Fixes #18227
2021-04-26 09:37:34 -07:00
aryanshridhar c199229aa9 template: Move `admin_user_group_list` template to `settings` folder.
Moved `admin_user_group_list` template to `/templates/settings/` folder
as earlier, it was inaccurately placed within the `/templates` folder
and should have been within the `/templates/settings` folder.
Also modified the node tests to reflect the new changes.
2021-04-26 09:37:30 -07:00
aryanshridhar a82827ca75 template: Move `admin_tab` template to `settings` folder.
Moved `admin_tab` template to `/templates/settings/` folder as
earlier, it was inaccurately placed within the `/templates` folder
and should have been within the `/templates/settings` folder instead.
2021-04-26 09:37:27 -07:00
aryanshridhar 63d34500b0 template: Move `admin_settings_modals` template to `settings` folder.
Moved `admin_settings_modals` template to `/templates/settings/` folder as
earlier, it was inaccurately placed within the `/templates` folder
and should have been within the `/templates/settings` folder.
2021-04-26 09:37:24 -07:00
aryanshridhar 17133b5b1e template: Move `admin_profile_field_list` template to `settings` folder.
Moved `admin_profile_field_list` template to `/templates/settings/` folder
as earlier, it was inaccurately placed within the `/templates` folder
rather than the `/templates/settings` folder.
Also modified the node tests to reflect the new changes.
2021-04-26 09:37:20 -07:00
aryanshridhar 19699720bc template: Move `admin_linkifier_list` template to `settings` folder.
Moved `admin_linkifier_list` template to `/templates/settings/` folder as
earlier, it was inaccurately placed within the `/templates` folder
rather than the `/templates/settings` folder.
2021-04-26 09:37:17 -07:00
aryanshridhar 27934dca7e template: Move `admin_invites_list` template to `settings` folder.
Moved `admin_invites_list` template to `/templates/settings/` folder as
earlier, it was inaccurately placed within the `/templates` folder
and should have been within the `/templates/settings` folder instead.
2021-04-26 09:37:14 -07:00
aryanshridhar 19ffacf05d template: Move `admin_human_form` template to `settings` folder.
Moved `admin_human_form` template to `/templates/settings/` folder as
earlier, it was inaccurately placed within the `/templates` folder
and should have been within the `/templates/settings` folder.
2021-04-26 09:37:11 -07:00
aryanshridhar 983762726d template: Move `admin_export_list` template to `settings` folder.
Moved `admin_export_list` template to `/templates/settings/` folder as
earlier, it was inaccurately placed within the `/templates` folder
rather than the `/templates/settings` folder.
2021-04-26 09:37:08 -07:00
aryanshridhar 6b58fdb39d template: Move `admin_emoji_list` template to `settings` folder.
Moved `admin_emoji_list` template to `/templates/settings/` folder as
earlier, it was inaccurately placed within the `/templates` folder
and should have been within the `/templates/settings` folder.
2021-04-26 09:37:05 -07:00
aryanshridhar 54d46c27d6 template: Move `admin_default_stream_list` template to `settings` folder.
Moved `admin_default_stream_list` template to `/templates/settings/`
folder as earlier, it was inaccurately placed within the `/templates`
folder and should have been within the `/templates/settings` folder
instead.
2021-04-26 09:37:01 -07:00
aryanshridhar 0e1c0d8be0 template: Move `admin_bot_form` template to `settings` folder.
Moved `admin_bot_form` template to `/templates/settings/` folder as
earlier, it was inaccurately placed within the `/templates` folder
and `settings` folder is specifically for storing administrative
UI templates.
2021-04-26 09:36:54 -07:00
Anders Kaseorg 6060d0d364 docs: Add missing space to compound verbs “log in”, “set up”, etc.
Noun: backup, checkout, cleanup, login, logout, setup, shutdown, signup,
timeout.

Verb: back up, check out, clean up, log in, log out, set up, shut
down, sign up, time out.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-26 09:31:08 -07:00
Anders Kaseorg e3f2ffa681 docs: Capitalize “Markdown” consistently.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-26 09:31:08 -07:00
Anders Kaseorg 178736c8eb docs: Fix spelling errors caught by codespell.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-26 09:31:08 -07:00
PIG208 7b60ce1d70 js: Make alert_popup shared.
It allows the click handler for the "x" button, and the stacktrace
toggler to be shared between webapp and the portico pages.

Reimplements #17801.
2021-04-26 09:27:49 -07:00
PIG208 a84eea9b84 static: Make alert.css shared between app and portico.
This involves in two changes for styling.
1. The alert class is moved from alert.css to app_components.css as this
class serves nothing but to default .alert elements to be hidden. This
is only required in the webapp but not portico pages (where .alert
elements are preferred to be shown by default).
2. The import statement for alert.css is moved from app.js to common.js,
so that both the webapp and the portico pages can share the styles. This
will be fine to share the styles as .alert-display, .alert-animations,
.alert-box are more specific then .alert and they use nested class to
define styles for inner elements.

Undoes #17936 properly.
2021-04-26 09:27:05 -07:00
Aman Agrawal 4c4c2e46fb stream_creation_form: Fix footer padding overlapping with text. 2021-04-25 08:54:08 -07:00
Aman Agrawal 384156c307 stream_create: Use ListWidget to render list of all users.
This improves the UX of creating a stream for atleast 1000+ users
realm by showing the the stream creation form much faster than
before.

Search, user addition, scrolling worked smoothly on 15k+
users realm as tested on dev setup.

Also, simplebar is used to replace the default scrollbar.

Fixes #16805
2021-04-25 08:54:08 -07:00
scjess 7a58446c82 message_events: Support undefined stream_name.
When moving a topic within a stream that is deactivated, the stream
may not be present in stream_data.  Avoid throwing an exception in
this situation by leaving stream_name as undefined; existing logic
seems to anticipate that as a possibility, so we don't need a broader
change.

Longer term, we may want to just send to clients basic data about
archived streams that the user has access to.

Fixes: #17271
2021-04-25 08:44:21 -07:00
Anders Kaseorg bf056c8990 js: Extract password_quality module; remove zxcvbn from globals.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-24 13:08:52 -07:00
Anders Kaseorg 2864c93ba8 copy_and_paste: Use ES module from Turndown.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-24 13:08:52 -07:00
Anders Kaseorg 41dd50948a js: Consistently use ES module from SimpleBar.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-24 13:08:52 -07:00
Anders Kaseorg cef2ecf004 i18n: Pass language name with every response.
With a comment added by tabbott on live-update considerations.

See https://chat.zulip.org/#narrow/stream/9-issues/topic/FormatJS.20error.20in.20standalone.20pages/near/1168413 for context.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-24 13:00:27 -07:00
akshatdalton 1229945add refactor: Add helper function to handle muting/unmuting of a topic.
This commit adds a helper function: `mute_or_unmute_topic`
in `click_handlers.js` to mute and unmute a topic. This function
is called when a user mutes/unmutes a topic from its recipient bar
or `recent topics`.

This is a prep commit for `Allow unmuting of a topic from its recipient bar`.

Related issue: #15223.
2021-04-24 12:21:43 -07:00
Nikhil Maske 9f5efd208f topic_edit: Fix the behaviour of always_visible_topic_edit button.
The bug happens in the case when the topic name is not set and the
user clicks on always_visible_topic_edit button results into unusual
behaviour of the always_visible_topic_edit button. To fix this, this
commit fix the behaviour by hiding and showing the
always_visible_topic_edit button in the appropiate situations, at the
same time we hide/show similar buttons.

Fixes #17813.
2021-04-23 15:04:17 -07:00
Tim Abbott 78c7d749d9 passwords: Set title/aria-label attributes dynamically.
This allows us to use different "Show password" and "Hide password"
for these labels, which is more consistent with how other products
implement this.

It also lets us delete N duplicate copies of these strings in the HTML.
2021-04-23 15:01:37 -07:00
Tim Abbott ebcd587ee5 settings: Use consistent width for account settings modals.
The password change modal, in particular, was way too narrow to
display its error messages comfortably.
2021-04-23 15:01:37 -07:00
Tim Abbott 1d575007a3 settings: Improve error message for password change.
The "Save failed" standard text is appropriate for many of our
settings, but for changing one's password, we can go with just the
"Wrong password" part provided by the server.
2021-04-23 15:01:37 -07:00
Gaurav Pandey e80ddfe4e6 settings: Add show password feature to forms in settings modal.
Fixes part of #17301.
2021-04-23 15:01:37 -07:00
Gaurav Pandey a9fcafc433 reset_confirm: Add show password feature to reset confirm page.
Fixes part of #17301.
2021-04-23 15:01:37 -07:00
Gaurav Pandey 91c73025d2 register: Add show password feature to password fields.
Fixes part of #17301.
2021-04-23 15:01:37 -07:00
Gaurav Pandey fa235e60ff login: Add show password feature to login page.
The show password feature is a functionality to
toggle the visibility of the password fields in forms
so that one can check if they have entered the correct
password or not. We implement this using an eye icon
toggling which converts input field type from password
to text and vice-versa.
Fixes part of #17301.
2021-04-23 15:01:37 -07:00
Aman Agrawal 2ceda13e31 tippy: Fix weird looking arrow for playground and copy code tooltips.
They were taking the height of the code block, we don't want them to,
hence we explicitly set their height to 0.
2021-04-23 11:59:18 -07:00
Aman Agrawal 9350bbd976 tippy: Fix font-family for copy code and playground tooltips. 2021-04-23 11:59:18 -07:00
Aman Agrawal 489daa7f7c tippy: Append tooltips to the parent of the `reference`.
This allows us to hide tooltips automatically when the
parent container is hidden while tooltip is active.

In an overlay, when a tooltip is active and `esc` is pressed,
the tooltip will remain active without this commit.

This has side effects of some properties of parent applying to
tooltips if property is directly set to `div`. Through manual testing,
only area where this was found was fixed.
2021-04-23 11:59:18 -07:00
Aman Agrawal 3410ff2e64 buddy_tooltips: Destroy tooltips if `reference` is not visible.
We destroy the tooltips for which `reference` was either removed
from DOM or is hidden.

We only need to do this for tooltips
contained in simplebar containers for which tooltips can
overflow the boundary of the simplebar container.

There are 4 approaches we could have done this:
1. Asked tippy.js maintainers to do this for us.
In https://github.com/atomiks/tippyjs/issues/938 the
maintainer said that it is the responsibility of
the user to do so.

2. Tracked whenever we update the DOM for such elements and hide
tooltips when we were hiding the `reference` elements. This had
various problems like it is hard trigger events when certain elements have
been removed from DOM when `html()` method is used to render
new content.

3. Run an `optimized` periodic job to destroy tooltips when
`reference` elements are hidden. This isn't a good method to
do this since it sucks power and adds latency.

4. Use a `MutationObserver` on the parent element and watch
for changes. This methods seems to work well with no bad
side effects. We use this approach.
2021-04-23 11:59:15 -07:00
Aman Agrawal fc18ec4c04 tippy: Insert tooltip element directly in `.message_reaction`.
Instead of inserting tooltip inside `body`, we directly insert
it inside the `reference` element. This helps us to automatically
hide the tooltip when we hide the `reference` element.

This avoids the bug of tooltip persisting when the message reaction
is removed while the tooltip is active.

To reproduce:
* React 👍 to a message.
* Hover over the reaction.
* Press `+` from keyboard.

You will see reaction tooltip persisting while the reaction is hidden,
also "Add emoji" icon is displayed with tooltip.

Doing the same for elements which are inside a simplebar container
and for which tooltips can span outside the simplebar container,
makes the tooltips not visible or cut at the edges of simplebar
container since simplebar containers have overflow set to `hidden`.
This is something that cannot fixed as per
https://github.com/Grsmto/simplebar/issues/347

So, for simplebar contained elements we insert the tooltip to
`body`.

`reference` element: Element for which tooltip is displayed.
2021-04-23 11:56:22 -07:00
Abhijeet Prasad Bodas bbbaa109ec settings: Add UI page for managing muted users.
This page is temporarily hidden except in the development environment,
because the "muted users" feature is incomplete.
2021-04-21 10:17:44 -07:00
Abhijeet Prasad Bodas e56db79af4 mute user: Add dev-only UI to mute/unmute a user.
Since the "mute users" feature isn't complete yet,
this UI is shown only in development setups.
Ideally we should have had this commit after the whole
feature was completed and merged, but doing so makes it
difficult to test and merge subparts of the feature one by
one (which is a better workflow, while we still decide what
exactly we want this feature to do).

This commit adds a new button in the user info popover
to mute or unmute the user, and uses a confirmation
dialog while muting, because muting a user accidently can lead
to the muter losing out on a lot of information.

TODOs when making this UI visible in production-
1. Make a /help page and link to it from the confirmation
dialog and the API docs.
2021-04-21 10:14:27 -07:00
Mateusz Mandera 977a2f7fa0 emails: Rename "missed message email" to "message notification email". 2021-04-21 10:10:54 -07:00
Anders Kaseorg dd3fa4ac52 templates: Mark all void tags as self-closing.
This reverses the policy that was set, but incompletely enforced, by
commit 951514dd7d.  The self-closing tag
syntax is clearer, more consistent, simpler to parse, compatible with
XML, preferred by Prettier, and (most importantly now) required by
FormatJS.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-21 09:49:34 -07:00
Sumanth V Rao a6d950f73e templates: Move admin_playground_list inside templates/settings. 2021-04-20 14:40:43 -07:00
Anders Kaseorg d381b4463e templates: Fix <br> → <br /> to be parseable by FormatJS.
Fixes #18220.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-20 14:39:53 -07:00
Wesley Aptekar-Cassels 367cf897fa shared: Bump version to 0.0.5. 2021-04-20 17:19:12 +08:00
m-e-l-u-h-a-n be7021268a setting(stream): Support user group pills when typeahead is unused.
This extra commit adds support for creating user group pills
in cases that do not use typeahead like, pasting the group
name, copying it from the user group pill.

This completes the remaining work required to support
addition of all members of a user groups to stream.

Fixes #15186.
2021-04-19 17:41:50 -07:00
m-e-l-u-h-a-n ce4cf66f3f setting(streams): Add pill support to subscribe all members of group.
We update the pills typeahead logic to also include user group
results and pass the "user_group" key in `opts` to enable this
option for Add subscriber form.

The changes includes:
* Exporting the `query_matches_name_description` function, to
  deduplicate the typeahead `matcher` logic.
* Creating a `people.is_known_user` function, to deduplicate
  the typeahead `sorter` logic.
* Add a new `user_group_pill.js`, to allow adding user group
  pills in input widgets that support pills.

This has been tested manually as well as by adding some new
node tests.
2021-04-19 17:41:50 -07:00
ryanreh99 e4d5ea69a0 refactor: Remove redundant typeahead_helper.sort_recipientbox_typeahead.
This commit removes`typeahead_helper.sort_recipientbox_typeahead`
which was introduced in 639ec9380a
for the private message recipient box when it used to accept comma
separated text input for recipients. All it doew was cleaning away
invalid recipients from string, like:
"a, , b" was cleaned to [a, b].

This can be now removed because it was now used only in
pill_typeahead.setup code path, and the pills code already handles
invalid cases by filtering out all falsy (invalid) recipients.
2021-04-19 17:41:50 -07:00
Aman Agrawal 57c657962e compose: Move control buttons into a file of their own.
These buttons are common with message_edit_form.hbs, we will
be sharing this file among compose and message_edit_form.
2021-04-19 16:54:54 -07:00
Aman Agrawal 11b09bba83 compose: Replace `message-control-button` with `compose_control_button`.
This is both more correct and also fixes this element having had a
name very similar to message_control_button, which refers to an
element in the message_controls section of a rendered message.
2021-04-19 16:54:10 -07:00
Aman Agrawal 70d444a8eb compose: Move to `hbs` file and append it to DOM on init.
We move compose.html to compose.hbs file while keeping
`#compose` still in `home.html` as a hanger
where append rest of the elements.

This will provide us with two benefits:
* We could share common elements between message_edit_form and
compose.
* We can insert compose directly in any element. We may decide to
do it for recent topics.
2021-04-19 16:53:30 -07:00
Aman Agrawal 4472986fae click_handlers: Delegate compose events to body.
This allows us to not rely on compose elements being present in
the DOM when we register these events.
2021-04-19 16:49:53 -07:00
Sumanth V Rao 0ecf5d0e83 settings_playground: Add UI to list all playgrounds.
Adds a setting UI to list all configured playgrounds
in a realm. The filter functionality can be used to
search playgrounds by its name or language.

Default sort is provided on the 'pygments_language'
field.

Front tests added to maintain server_event_dispatch
coverage. The `settings_playgrounds.js` file is added
to coverage exclusion list since it is majorly UI
based and will be tested using puppeteer tests (in
following commits).
2021-04-19 12:54:59 -07:00
Sumanth V Rao 32390e0c87 playgrounds: Hook up configured playgrounds to be used in code blocks.
To prevent breaking of the hardcoded playgrounds, we resort
to checking if realm_playgrounds is empty and falling back
to the hard-coded list if so. This logic is removed in the
followup commit which introduces the UI to add a playground.
2021-04-19 11:23:10 -07:00
Wesley Aptekar-Cassels da0c616b69 shared: Move PollData into shared. 2021-04-19 06:34:08 -04:00
Wesley Aptekar-Cassels 42f328fec6 PollData: Pass in function for rendering user names.
This will make it easier to share this code with the mobile app, which
does not use people.js.
2021-04-19 06:34:08 -04:00
Wesley Aptekar-Cassels 331927bbbe PollData: Use options object, rather than positional args. 2021-04-19 06:34:08 -04:00
Wesley Aptekar-Cassels bef67d7bf1 PollData: Pass in current user ID.
This will make it easier to share this code with the mobile codebase,
which does not use the people.js logic.
2021-04-19 06:34:08 -04:00
Wesley Aptekar-Cassels 7718d2b137 PollData: Change error reporting to be generic.
This is in preparation for moving this code to @zulip/shared for use in
the mobile app, where we will want to use Sentry for reporting errors,
rather than blueslip.

The way I've done this only allows for reporting one type of error
(currently, blueslip.warn), but seeing as we only have one place we
report an error, that seems like something we can fix if we want more
error levels at a later date.
2021-04-19 06:34:08 -04:00
Abhijeet Prasad Bodas 1ffd8b0205 ui: Use unicode U+2026 instead of literal "..." characters.
The unicode horizontal ellipsis is visually nicer.
b40e50f295 removed many of these,
by changing the text itself.
This commit handles the remaining few.
2021-04-17 09:07:46 -07:00
Vishnu KS ab771e4b19 support: Show the first human user in realm search result. 2021-04-16 13:22:02 -07:00
Tim Abbott f89af5b2b4 css: Add block comment for reaction button logic. 2021-04-16 12:20:54 -07:00
Aman Agrawal c3211b652f reaction_button: Hide if it is the first child.
Since all the message reactions are inserted before the
add reaction button, if it is the first child, we can safely
remove it.

We changed this from `only-child` to be `first-child` because
we append tooltips as siblings of `reaction_button` but since
they are appended, they are always appended after the `reaction_button`.
Thus, if there were tooltips present the reaction_button won't hide.
2021-04-16 12:17:54 -07:00
Steve Howell 173ce9a3fc refactor: Use sub_store for get/validation.
This reduces the complexity of our dependency graph.

It also makes sub_store.get parallel to message_store.get.
For both you pass in the relevant id to get the
full validated object.
2021-04-15 17:26:17 -07:00
Steve Howell d2bbb7d521 refactor: Extract sub_store module.
This is a prep commit to break dependencies.

The sub_store module is a thin layer on top of
our map of stream_id -> sub.
2021-04-15 17:26:17 -07:00
Steve Howell 12650c1bec refactor: Extract stream_topic_history_util.
This breaks an indirect dependency of stream_data
on the channel module.

It's a verbatim code move, apart from the one-line
helper `has_history_for`. It's not totally clear
to me why the original code doesn't call into
`is_complete_for_stream_id` to early-exit, but
figuring that out is outside the scope of my
change.

It's possible that we will eventually just subsume
this tiny module into topic_list once we finish
breaking all dependencies, but we may want to
reuse this for something like Recent Topics
or other similar UIs.

It's also possible that we'll want to rename
stream_topic_history -> stream_topic_history_data
sometime soon, possibly after we clean up its
dependency on message_util soon.
2021-04-15 17:26:17 -07:00
Adam Birds 545cd961f4 integrations: Add docs for GitHub Actions integration.
I have added a documentation page for the GitHub Actions integration to
`/integrations/doc/github-actions` with a link to the Zulip GitHub
Actions repository.

Tweaked by tabbott to add cross-links with the main GitHub integration.
2021-04-15 16:42:31 -07:00
Adam Birds 576702fbeb
integrations: Update generated bot avatars.
I have updated any missing bot avatars after running the tool whilst
creating integrations. These needed adding otherwise the tool creates
them whenever it is ran.
2021-04-15 16:37:31 -07:00
Tim Abbott b40e50f295 settings: Fix elements incorrectly labeled as searches. 2021-04-15 15:36:05 -07:00
Aman Agrawal e41fffc43e pm_list: Show correct unread unread counts.
We only update the `.private_messages_header` here since
unread_counts of `.expanded_private_message` are updated
via `pm_list.update_private_messages`.

This fixes the bug of PMs in `.expanded_private_message` having
the same unread count as `private_messages_header`.

Since we rerender the DOM of `.expanded_private_message` every
time we update unread count of PMs, we don't need to manually
update them here. Also, we always keep them on display since
there is no real need to toggle them. They are not visible
when they have 0 unread counts via `.zero_count`.
2021-04-15 10:08:50 -07:00
Aman Agrawal e5acbf9498 activity: Fix buddy_list unread count not being updated instantly.
While rest of the app has ported to the new system of updating
unread_counts `activity` was not ported. This resulted in
unread count in buddy list not being updated when new
PMs arrive.
2021-04-15 10:08:50 -07:00
Steve Howell 06af1715cb bug fix: Fix today's regression with topic counts.
The series of commits to consolidate CSS classes
for the various unread-count spans across our app
created a bug where the stream_list.js code's selector
starting capturing the unread spans in topic list items.

Suppose you had a stream with these topics:

    Foo 10
        a 3
        b 3
        c 4

If another unread came in, you would briefly see:

    Foo 11
        a 11
        b 11
        c 11

Now we just use subscription_block to find the
element that we want to tweak.

I remove a convoluted node test here. Part of the
reason the node test was convoluted was that the
original implementation was overly complex. I will
try to re-introduce a simpler test soon, but this
is a bit of an emergency fix.
2021-04-14 16:29:49 -07:00
Steve Howell 2126478867 refactor: Simplify recent_senders code.
This reduces our dependency on message_list code (via
message_util), and it makes moving streams/topics and
deleting messages more performant.

For every single message that was being updated or
deleted, the previous code was basically re-computing
lots of things, including having to iterate through
every message in memory to find the messages matching
your topic.

Now everything basically happens in O(1) time.

The only O(N) computation is that we now lazily
re-compute the max message id every time you need it
for typeahead logic, and then we cache it for
subsequent use. The N here is the number of messages
that the particular sender has sent to the particular
stream/topic combination, so it should always be quite
small, except for certain spammy bots.

Once the max has been calculated, the common operation
of adding a message doesn't invalidate our cached
value. We only invalidate the cache on deletes.

The main change that we make here from a data
standpoint is that we just keep track of all
message_ids for all senders. The storage overhead here
should be negligible.  By keeping track of our own
messages, we don't have to punt to other code for
update/delete situations.

There is similar code in recent_topics that I think can
be improved in similar ways, and it would allow us to
eliminate functions like this one:

    export function get_messages_in_topic(stream_id, topic) {
        return message_list.all
            .all_messages()
            .filter(
                (x) =>
                    x.type === "stream" &&
                    x.stream_id === stream_id &&
                    x.topic.toLowerCase() === topic.toLowerCase(),
            );
    }
2021-04-14 16:28:07 -07:00
Anders Kaseorg f4d902e0cd i18n: Ignore missing translation errors from FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-14 14:17:44 -07:00
Tim Abbott 85a7325757 css: Delete orphaned starred messages CSS.
This CSS stopped being used in
84afc67369.
2021-04-14 11:50:07 -07:00
Tim Abbott b7cfefc213 css: Add custom styling for starred message counts.
We use an inverted color scheme to what we use for unread messages, so
that one's eyes scan these as different from unreads.

We also need to introduce a 1px offset because the border takes up space.

Fixes #17938.
2021-04-14 11:43:38 -07:00
Aman Agrawal 97496088c9 recent_topics: Use `unread_counts` class for showing unread count. 2021-04-14 10:57:16 -07:00
Aman Agrawal 6744522229 user_presence_row: Use `unread_counts` class for showing unread count. 2021-04-14 10:57:16 -07:00
Aman Agrawal ab87325fea pm_list_item: Use `unread_counts` class for showing unread count. 2021-04-14 10:57:16 -07:00
Aman Agrawal 019afcd40d topic_list_item: Use `unread_counts` class for showing unread count. 2021-04-14 10:57:16 -07:00
Aman Agrawal b6d9577b48 stream_list: Use `unread_counts` class for showing unread count. 2021-04-14 10:57:16 -07:00
Aman Agrawal 84afc67369 top_left_corner: Directly use `span.unread_count` to display unreads.
In an effort to use a common class to display unread counts across
the app, we simplify the elements used to show unreads and use a
single `span` with `unread_count` class to do so.
2021-04-14 10:57:16 -07:00
Aman Agrawal 79bf740dcb top_left_corner: Extract function which updates unread count.
This is a common element that is being used both by pm_list and
top_left_corner, hence extraction makes sense.
2021-04-14 10:57:16 -07:00
Aman Agrawal b1f8041c31 giphy: Use simplebar to replace browser scrollbar. 2021-04-14 10:50:47 -07:00
Aman Agrawal 35bd44ed2a giphy: Add clear search button.
Make the input more square looking to match with our other
input boxes.
2021-04-14 10:50:47 -07:00
Aman Agrawal 84f7bb85f6 giphy: Make footer background black to match to with attribution.
Adjust border-radius to make edges smooth.
2021-04-14 10:50:47 -07:00
Aman Agrawal caa9720064 giphy: Directly use `Number` value of the breakpoint. 2021-04-14 10:50:40 -07:00
Aman Agrawal f9e0ed98b8 buddy_list_tooltip: Directly trigger tooltip on parent of elements.
Instead of listing all the elements in `.selectable_sidebar_block`,
we directly use it to trigger showing tooltip.
2021-04-14 10:15:58 -07:00
Aman Agrawal 6271a7db9c message_controls: Don't set css properties for all `div`s in it.
This tends to behave badly when we add new elements which don't
want these properties.
2021-04-14 10:15:58 -07:00
Signior-X 0a4eabd3e0 message-edit: Show the edited content on editing message failure.
This commit replaces the "echo_data.orig_raw_content" with
"echo_data.raw_content" in "message_edit.js". If the user is editing
a message and it fails, all the edited data used to get lost. Now, the
new edited content appears so that the user does not lose his edited
content.

This bug has been present since the original #12145, where a
refactoring error resulted in using the pre-edit data.

Fixes #18142.
2021-04-14 09:42:22 -07:00
Steve Howell 50bbbaea6a emoji typehahead: Fix render_emoji.
If you have two emojis of the same name, we were
trying to render the non-realm emoji without an
emoji_code, since the condition that I changed
here was erroneously just seeing if the name was
among the realm emojis.

This fix prevents a funny symptom that is reported
in #18135.  The symptom is that the non-realm
emoji causes us to render the top-left emoji in
our sprite sheet, since we didn't put emoji_code
into the args.

This doesn't fix the fundamental problem that
having two emojis of the same name is extemely
confusing. Our markdown parser obviously can't
distinguish ":thank_you:" from ":thank_you:".  For
the the typeahead case I suppose we could add some
kind of suffix.

So, this fix only simplifies debugging; it doesn't
get to the root of the problem.
2021-04-14 09:35:31 -07:00
Tim Abbott c30a4c5466 settings: Standardize on "video call provider" (not "video chat").
We had a mix of the two names, and "video call provider" both feels
more professional and more clear about precisely what it does.

We don't change the API fields, since it doesn't seem worth an API
migration.
2021-04-14 08:48:21 -07:00
m-e-l-u-h-a-n dd308528c2 docs(integrations): Document zoom video provider in /integrations.
Moves documentation about using zoom as video call provider
to /integrations. This documentation was earlier present
at /help/start-a-call and is moved as asked in issue #17588.
2021-04-14 08:44:00 -07:00
m-e-l-u-h-a-n 4077673da7 docs(integrations): Add Big Blue Button video provider on /integrations.
Moves documentation about using Big Blue Button as video call
provider to /integrations. This documentation was earlier
present at /help/start-a-call and is moved as asked in issue #17588.
2021-04-14 08:44:00 -07:00
m-e-l-u-h-a-n 13e43917db docs(integrations): Document jitsi video provider in /integrations.
Moves documentation about using jitsi as video call provider
to /integrations. This documentation was earlier present
at /help/start-a-call and is moved as asked in issue #17588.
2021-04-14 08:44:00 -07:00
Tim Abbott 940927910f logo: Add README for logo directory with format conversion advice. 2021-04-14 08:39:23 -07:00
Tim Abbott 0dac331c17 css: Adjust scope for main overlay CSS and click handlers.
KaTeX makes use of a "span.overlay" element for the little vector
arrow symbol on top of a `\vec` object. This conflicts with Zulip's
CSS for our overlays, which are divs with the `overlay` CSS class.

While KaTeX may rename their class
(https://github.com/KaTeX/KaTeX/issues/1456), we can work around this
issue by scoping our own overlay CSS and click handlers to
"div.overlay" rather than ".overlay".

Fixes #18068.
2021-04-14 08:27:18 -07:00
akshatdalton 5d35892bc9 linkifiers: Add helper function to handle API errors.
This commit adds a helper function named `handle_linkifier_api_error`
to `static/js/settings_linkifiers.js`. As the name suggests, this
function handles the error returned from the API, specifically
for operations on linkifiers (like adding linkifier).

This is a prep commit for `Add setting to edit linkifiers`.
Related issue: #10830.

The main motive to add this helper function is to avoid copying
substantial blocks of code, as it tends to result in someone later
fixing bugs in only one of the two places.
2021-04-14 01:33:29 -07:00
Siddharth Asthana 7c485c1302 integrations page: Add "Create your own" button.
This commit adds a "Create your own" button on the integrations page. It
redirects to "api/integrations-overview" page and is placed by the side
of "Request an Integration" button.

Fixes #7935
2021-04-13 21:03:48 -07:00
majordwarf 4b3290566b docs: Document integration request process.
There was no proper documentation to guide user to request an integration.
The following changes documents the whole process and links it from the
`/integrations/` page making it visible to the end-user.

Fixes #7935
2021-04-13 20:48:34 -07:00
Anders Kaseorg 5fed442bb1 templates: Remove context argument from {{#tr}} block helper.
It only had one nontrivial use, and it’s easily replaced using the
builtin {{#with}} block helper.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 18:59:46 -07:00
Anders Kaseorg d8a36d0702 i18n: Remove i18next.
Fixes #17890.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 0892e98012 i18n: Convert Handlebars messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 5bff97e7d9 upload_widget: Fix units in maximum file size message.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 768f54c3f9 i18n: Convert commented JavaScript messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 2004a85fb1 i18n: Automatically convert remaining JavaScript messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 24646907dc notifications: Convert capitalization-exempt messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 7974007fa6 settings: Convert translate_emoticons message to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 9985ce077b stats: Convert total message to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 00db22ee76 rendered_markdown: Convert spoiler message to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 00fb1aaadc confirm_dialog: Convert heading, yes button messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg a397d51670 ui_report: Convert messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 073ec04335 settings_account: Convert error messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg a33ee8c36f info_overlay: Convert note_html messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 70bf9914b2 message_list: Convert bookend_content messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg a70061d91f compose: Convert show_preview messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg d761077dac compose: Convert compose_error messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 4b4cea90a3 i18n: Initialize FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 6cf398f157 narrow_banner: Escape preamble message.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 88d901a078 timerender: Escape time strings used as HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg b0c07d433f Revert "templates: Add {{#let}} block helper."
This reverts commit f81cc16a0f (#17999).

The {{#tr}} helper now includes the functionality that we wanted from
this.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg b7093a93dc templates: Fix reference to nonexistent oneself variable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 912daa2f6c templates: Remove revoke_invite_modal from admin_settings_modals.
This modal is rendered on demand and inserted into
revoke_invite_modal_holder.  We don’t need another hidden copy here,
and having one just causes id conflicts.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 7045465553 bundles: Remove redundant i18n import.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 2293b01a75 i18n: Fix uses of i18n.t on computed strings.
We don’t extract either of these strings correctly at present, but I’m
about to replace the entire frontend extraction system.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
tushar912 f872c95c65 message_edit: Fix copy paste bug on local-echo/pending message.
Previously, when viewing the source of a locally-echoed (pending)
message, if one tried to copy-paste using the copy button, the
"Copied!" status was displayed but the message was not copied.

This was because as we use message ids with a . in then for locally
echoed messages, which ClipboardJS considered an error (invalid
selector).

To solve this
* Remove the data-clipboard-target attribute of copy button.
* Dynamically set target in ClipboardJS config
  the based on message id using querySelector
  with the message id written with CSS.escape.

Fixes #18053.
2021-04-13 12:57:20 -07:00
Abhijeet Prasad Bodas 3947b0c80a linkifiers: Update API to send data using dictionaries.
* This introduces a new event type `realm_linkifiers` and
a new key for the initial data fetch of the same name.
Newer clients will be expected to use these.

* Backwards compatibility is ensured by changing neither
the current event nor the /register key. The data which
these hold is the same as before, but internally, it is
generated by processing the `realm_linkifiers` data.
We send both the old and the new event types to clients
whenever the linkifiers are changed.
Older clients will simply ignore the new event type, and
vice versa.

* The `realm/filters:GET` endpoint (which returns tuples)
is currently used by none of the official Zulip clients.
This commit replaces it with `realm/linkifiers:GET` which
returns data in the new dictionary format.
TODO: Update the `get_realm_filters` method in the API
bindings, to hit this new URL instead of the old one.

* This also updates the webapp frontend to use the newer
events and keys.
2021-04-13 12:16:07 -07:00
akshatdalton 5eff43f5d9 bots settings: Add puppeteer test for edit bot setting. 2021-04-13 11:42:36 -07:00
akshatdalton b9a318485c bots settings: Stop modal from getting closed when an error is shown.
This commit fixes the issue of error message not getting
displayed when the `Full name` field, in bots settings, is given
a duplicate name of an already created bot with the same name.

We were closing the modal each time whether the request is
successful or not. Hence, we now close the modal only
when the request is successful and error is displayed on
the modal otherwise.

Fixes #18091.
2021-04-13 11:42:36 -07:00
Anders Kaseorg 1fc26f31e9 drafts: Fix restore draft button.
It was broken by commit 9c2ec9d7d7
(#17434).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-12 22:03:00 -07:00
Anders Kaseorg c4b60acf9c compose: HTML-escape errors from server for compose_error.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-11 09:56:17 -07:00
Tim Abbott 4a3ad0da06 api: Improve encoding of stream/topic max field lengths.
Previously, you had to request the `stream` event type in order to get
the stream-level parameters; this was a bad design in part because the
`subscription` event type has similar data and is preferred by most
clients.

So we move these to the `realm` object.  We also add the maximum topic
length, as an adjacent parameter.

While changing this, we also fix these to better match the names of
similar API parameters.
2021-04-10 10:07:57 -07:00
Aryan Shridhar 1b5a16bd1f
click_handlers: Prevent compose opening when copying code blocks.
Previously, clicking the codeblock copy button also
triggered the compose box to open.

This is because of the fact that ClipBoard.js lacks the
ability to stopPropogate the event when clicked.

Rectified by explicitly defining the copy click event
within `is_clickable_message_element`, which disallows
the triggering of reply box.

Effectively a workaround for
https://github.com/zenorocha/clipboard.js/pull/475.

Fixes #17861.
2021-04-09 18:06:27 -07:00
Tim Abbott 93c28f8c7b settings: Remove unnecessary JSON-encoding of integers.
We'll get the same result by letting jQuery stringify these; so
explicit JSON encoding here is likely to just encourage contributors
to cargo-cult JSON-encode strings in the future.
2021-04-09 16:27:30 -07:00
Tim Abbott cdbcb43706 api: Fix encoding of strings in realm endpoint.
* Don't require strings to be unnecessarily JSON-encoded.
* Use check_capped_string rather than custom code for length checks.
* Update frontend to pass the right parameters.

With a much simplified populate_data_for_request design suggested by
Anders; we only support a handful of data types, all of which are
correctly encoded automatically by jQuery.

Fixes part of #18035.
2021-04-09 16:27:30 -07:00
Rutvi Sharma 71edbd47d5 style: Increase width of gear menu to avoid distracting hover.
The comment explains the reasoning, but this should make it a lot
easier for users to visually focus on the menu items in the sidebar.

Changed by tabbott to use the same width as the right sidebar itself.

Inspired by #17169.
2021-04-09 15:52:37 -07:00
TylerPham2000 4dacbfdc82
panels: Adjust opacity value for the exit widget.
This makes this icon less invisible.

Once the user hovers over the "x" it will become brighter to notify the user.
2021-04-09 14:49:50 -07:00
guptaprakhariitr 720d27be6d tippy: Tranfer subs-sort tooltip to tippyjs.
As zulip is tranfering its tooltip to tippy the
tooltips for subs sort options are tranfered to
use tippy instead of title. Placement is bottom.
Refer https://github.com/zulip/zulip/pull/17434.
2021-04-09 08:25:33 -07:00
Aman Agrawal 40acc9b27c browser_history: If changing_hash, don't set to hash_before_overlay.
If we are changing_hash, it means `window.location.hash` is the
new_hash, so we don't want to change hash further now.

This used to create a loop of changing hashes as we used to close
and open overlays if `hash_before_overlay` was an overlay.

Fixes #18011
2021-04-09 08:24:02 -07:00
Aman Agrawal bd17d98e94 hashchange: Set `changing_hash` state while changing overlays.
This gives us information that browser hash has already changed
and now we are just showing the correct overlay. This can help us
make informative decision that if we want to change the hash back
to the last hash after closing the overlay or not.
2021-04-09 08:24:02 -07:00
Aman Agrawal fd2e0e7a1f hashchange: Store `changing_hash` in browser_history state.
This will allow us to more widely access this variable and use it
outside of hashchange as well.
2021-04-09 08:24:02 -07:00
Wesley Aptekar-Cassels e0b1818780
compose: Don't escape usernames in quote-and-reply.
This fixes a bug that breaks quote-and-replying to users with characters
like apostrophes in their usernames.

The bug was introduced in def1e01512.
2021-04-08 13:51:17 -07:00
Aman Agrawal 700cfd648c giphy: Add GIPHY picker to message edit form.
We try to keep only one instance of GIPHY popover active.
2021-04-08 10:17:20 -07:00
Aman Agrawal d4fa938a23 giphy: Convert `compose_giphy_logo` from id to class.
Since there are multiple `compose_giphy_logo` elements, we should
use it as a class as per HTML spec.
2021-04-08 10:03:51 -07:00
Aman Agrawal a2140eb9b5 giphy: Delegate `compose_giphy_logo` click handler to `body`.
This will allow us to use use this handler in places like message
edit where elements are added to the DOM later on.
2021-04-08 10:03:51 -07:00
Aman Agrawal 9c2ec9d7d7 drafts: Use tippy for tooltip.
With a tweak from tabbott to not use tippy on the entire message
content; this was a correct port of the apparent old bootstrap-tooltip
logic; however, that logic didn't actually work, so we just had
`title` behavior.

Given that showing a tooltip when hovering over the entire message
body feels wrong, we preserve the weird title behavior (which also
feels a bit off, but less so).
2021-04-08 09:52:03 -07:00
Aman Agrawal 39bcf8c55a copy_invite_link: Use tippy for tooltip. 2021-04-08 09:50:43 -07:00
Aman Agrawal 265cc17c6e tippy: Place message reaction tooltip at bottom.
This doesn't hide the message content and other reactions.
2021-04-08 09:48:44 -07:00
Aman Agrawal 0fd5bf49d6 buddy_list: Use tippy for showing tooltips.
There is no significant visual change other than arrows being
visible and the tooltip being a little darker.
2021-04-08 09:40:10 -07:00
Aman Agrawal 14d3385bfd css_variables: Directly export number values for breakpoints.
Since we need to use number values for these breakpoints directly
in some places, having `px` values exported for them is not
great as we have to write weird looking code to convert it into
number.
2021-04-08 09:40:10 -07:00
Sumanth V Rao 164506d950 css: Fix vertical alignment mismatch for view_in_playground button.
We'll be changing the icon and probably even doing the alignment in
a better fashion in the future, so this is just a temporary fix
till then.
2021-04-07 21:06:36 -07:00
Anders Kaseorg 566695d6e3 logos: Golf harder with svgo 2.3.0.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2021-04-07 21:05:01 -07:00
Nikhil Maske 50cd868749 confirm modal: Use Confirm and Cancel label options.
Long labels like "Deactivate xyz" or "Delete xyz" can
be confusing for translators and it can also create bad
strings that can end with like 4 long words in German.
It is better to have the simple options like "Confirm"
and "Cancel". This commit fixes this issue by changing
the text to "Confirm" in their respective template files.

Fixes #17926.
2021-04-07 18:27:22 -07:00
Nikhil Maske 66fa31f85c confirm_dialog_modal: Use Confirm and Cancel label options.
Long labels like "Unstar messages" can be confusing for
translators and it can also create bad strings that can
end with like 4 long words in German. It is better to
have the simple options like "Confirm" and "Cancel".
This commit fixes this issue by changing such text
to "Confirm" as default in confirm_dialog_modal.

Part of #17926.
2021-04-07 18:27:18 -07:00
Aman Agrawal 66c359b1d5 settings: Use tippy for tooltip. 2021-04-07 17:58:56 -07:00
Aman Agrawal 0e32454b1d message_reaction: Calculate and render tooltip using tippyjs.
Tippyjs automatically places it to bottom.

NOTE: placement of tooltip is changed from 'bottom' to `auto`.
Custom css was set here to avoid tooltip being partially hidden
on small screens. This change automatically takes care of it
by showing the tooltip on right side of message_reaction on
small screens if it is partially hidden from the left or
vice versa.
2021-04-07 17:38:40 -07:00
Aman Agrawal 487fcb6a3c reaction_button: Use tippy for tooltip.
Tippyjs automatically places it to bottom.
2021-04-07 17:38:40 -07:00
Aman Agrawal dd35c3ba05 message_controls: Use tippy for tooltip. 2021-04-07 17:38:40 -07:00
Aman Agrawal 3ef6655e79 message_view_header: Remove not used tooltip dataset.
We certainly don't need a tooltip for narrow description.
2021-04-07 17:38:40 -07:00
Aman Agrawal 533d011292 message_view_header: Use tippy for tooltip. 2021-04-07 17:38:40 -07:00
Aman Agrawal ffeb29db6a stream_settings: Use tippy for tooltip. 2021-04-07 17:38:40 -07:00
Aman Agrawal 93b852ea37 stream_types: Use tippy for tooltip. 2021-04-07 17:38:40 -07:00
Aman Agrawal 2f18cb51ac subscription: Use tippy for tooltip.
We no longer need to add_tooltip_to_left_panel_row since
tippyjs.delegate will automatically do that for us.

Tippyjs automatically places it to left on small widths and bottom
for large widhts.
2021-04-07 17:38:40 -07:00
Aman Agrawal b783cb468b view_code_in_playground: Use tippy for tooltip. 2021-04-07 17:38:40 -07:00
Tim Abbott e2dc74b3e8 profile_field_choice: Improve label for new option. 2021-04-07 17:38:38 -07:00
Aman Agrawal e6a133d105 profile_field_choice: Remove not required tooltip. 2021-04-07 17:37:02 -07:00
Aman Agrawal dc432d0b6f message_edit_tooltip: Use tippy for tooltip.
Tippyjs automatically places it to left.
2021-04-07 17:37:02 -07:00
Aman Agrawal 84d705b6b9 copy_code_button: Use tippy for tooltip. 2021-04-07 17:11:23 -07:00
Aman Agrawal d5e28eb3e2 copy_message: Use tippy for tooltip. 2021-04-07 17:11:23 -07:00
Aman Agrawal 52eeb7bc68 streams_nav: Use tippy for tooltip.
Tippyjs automatically places it to right, placement can change to
bottom if there is no space available to right.
2021-04-07 17:11:23 -07:00
Aman Agrawal e0c9c92cf1 userlist_search: Use tippyjs for showing tooltips.
Placement is set to `auto` which is based on space available.
Hence, it varies based on browser width and the current narrow.
2021-04-07 17:11:23 -07:00
Aman Agrawal 2e2ff568ba stats: Show tooltips using tippyjs.
We don't want to import tippyjs module here
along with its dependencies, so we just copied
over tippyjs defaults here. They should be
work fine for /stats page even if we decide to change
defaults for the app in tippyjs and forget to do
it here.
2021-04-07 17:11:23 -07:00
Ganesh Pawar a3e36ac830 settings_ui: Use `overlays.open_modal` in user deactivation settings.
Hiding and instantly showing a modal causes a race condition in
Bootstrap since `hide` and `show` calls are asynchronous.
See https://getbootstrap.com/docs/4.0/components/modal/#methods

Instead, use `overlays.open_modal` which prevents background
mouse events when a modal is present.

This prevents a user from maybe accidentally clicking on another deactivate
button while a modal is present. This also prevents a black screen
caused due to this race condition.

And since a user can't click on the button while the modal is present,
it doesn't make sense to hide it before showing it.
So, remove the `hide` call.

Fixes #17297
2021-04-07 15:19:41 -07:00
yasiruRathnayaka97 abcfd40b29 color picker: Fix colorpicker stream settings.
This color picker did not hide even after exiting stream settings.

Fix by adding logic to auto-close any open color pickers when closing
stream settings.

Tweaked by tabbott to use the existing on-close handler, which is
important if one clicks outside the modal or otherwise navigates
another way.

Fixes #17334.
2021-04-07 14:48:30 -07:00
Anders Kaseorg 8f0f0b9e91 styles: Slightly increase monospace font size.
Commit d84727ce7f (#17970) slightly
decreased the apparent size on some platforms depending on which font
was in use before, and some users complained that it was a bit hard to
read.  Based on experiments with multiple platforms and monitors and
resolutions, this appears to be a good compromise that increases the
rendered height without increasing the width more than necessary.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-07 13:17:20 -07:00
Riken Shah 793feb4539 buddy_list: Show `(you)` in the tooltip.
When the user's full name is long, the full name + `(you)`
in the buddy list starts to truncate, but when hover, the
tooltip displays the full name but not `(you)`.

This commit fixes this by adding `(you)` in the tooltip.
2021-04-07 12:17:56 -07:00
Nikhil Maske 2e7aaba0dd topic_sidebar_actions: Remove "Narrow to topic" option.
"Narrow to topic" option do exactly the same thing as
clicking the topic name does. So therefore decided to
remove that option from the popover. This commit removes
all the code related to .narrow_to_topic including it's
template code, on click event and a function used for it.

Fixes #18027.
2021-04-07 11:06:50 -07:00
sahil839 90a85ab442 subs: Disable the retention dropdown in stream creation form also.
We should disable the stream message retention dropdown for owners
of realm with limited plans. The behavior is correct in other
places, will also just explain the behavior in other places -

For limited plans-
1. Owners can see the dropdown in stream creation form but others
cannot, and in stream privacy modal, the modal is visible to all.
But the modal is disabled in all cases since the realm is on
limited plan.

For standard plans -
1. Owners can see and edit the dropdown in both stream creation
form and stream privacy modal. Non-owners cannot see the modal
in stream creation form but they can see the dropdown in stream
privacy modal and it will be disabled.

Thus, the only change in this commit is to disable the dropdown
in the stream creation form for owners and in limited plan realms.
The other behavior mentioned above was already there.
2021-04-07 10:37:52 -07:00
sahil839 04a856fa5b invite: Fix bug when button is not enabled after error in sending invite.
There is a bug where invite button is not enabled again after sending
invite is failed, but it is enabled on successful completion of invite.

I am not able to figure out why it is behaving differently in success and
error cases, even when the code to enable button is in complete() function
and it is called in both the cases.

But, I can confirm that adding .button('reset') fixes this bug as button
is disabled using the .button('loading') call and this is according to the
bootstrap docs only. But the bootstrap docs mention that the .button(string)
method has been removed in v4.0 as mentioned here
https://getbootstrap.com/docs/3.4/javascript/.

So, as we would want to avoid using depereceated or removed methods, this
commit simply changes the code to disable the button and set the loading
text using simple jquery and this also solves the above mentioned bug.
2021-04-07 09:05:16 -07:00
sahil839 c6e553427a settings: Hide invite users link in settings overlay based on settings.
There was a bug where invite users link is shown in the Invitations
section of settings overlay, irrespective if the user is allowed to
invite or not based on the realm settings. So here we just use the
'can_invite_others_to_realm' field of page_params, that was added in
previous commit itself to hide the link accordingly.

Also added the code in server_events_dispatch.js for this field.
Though it doesn't do live update when the overlay is opened similar
to other policies like create_stream_policy, but it ensures that the
visibility of link is correct if the overlay is opened after the
settings has changed.

We should probably do the complete live update in future of the
elements related to such realm settings.
2021-04-07 09:05:16 -07:00
sahil839 4c8339fa8c settings: Replace invite_by_admins_policy with invite_to_realm_policy.
This commit replaces invite_by_admins_policy, which was a bool field,
with a new enum field invite_by_realm_policy.

Though the final goal is to add moderators and full members option
using COMMON_POLICY_TYPES, but this will be done in a separate
commit to make this easy for review.
2021-04-07 09:02:33 -07:00
Aman Agrawal d4248cf060 keyboard-icon: Use tippyjs for tooltip.
Tippyjs automatically places it to left.
2021-04-07 01:24:52 -07:00
Aman Agrawal 18907eac33 tippy: Set default font size to 12px.
The default font size for tippy before was 14px and it appears large
for a tooltip compared to rest of the content.
2021-04-07 01:16:29 -07:00
Aman Agrawal 9c6f5d5946 tippyjs: Add library to be used for showing tooltips.
Our aim is to use this library to remove use of bootstrap-tooltip
for showing popovers and tooltips. This will remove our
dependency on bootstrap for showing tooltips. Thus, bootstrap
can be upgrade more independently.
2021-04-07 01:16:28 -07:00
Aman Agrawal eb72f77d0a settings: Allow switching between user and org settings manually.
Since the base hash for org settings and user settings are
different (organization and settings), the hashchange module
gets confused that we are going from one overlay to other.

A reproducer for this flow is to visit the organization "Bots" page,
click on your own profile as the owner of a bot, and then click "Edit
profile" from there.

So, we fix this by making an exception for this particular case
in the module.

Fixes part of #18011.
2021-04-07 01:02:03 -07:00
Dinesh dba21d201c typing: Display several people are typing...
Displays "Several people are typing..." when more than 3 users
are typing to avoid typing notifications in streams being too noisy.

A side effect is it shows the same message in pms too.
2021-04-07 00:17:30 -07:00
Dinesh 2077c24a3c typing_indicators: Use unicode … instead of 3-dots.
This looks nicer for __username__ is typing... typing indicator.
2021-04-07 00:17:25 -07:00
Megamind 3e5e89991d
frontend: create-stream button should match current design pattern. 2021-04-06 22:47:14 -07:00
Abhijeet Prasad Bodas 1de9444242 mute user: Add frontend functions to maintain data.
Muted users are stored in a map with key as user ID and
the value as the timestamp of muting.
Names can be easily fetched from existing functions
in `people.js` and hence not stored.
2021-04-06 18:44:09 -07:00
Anders Kaseorg 3c41db7f1a dependencies: Upgrade to webpack-bundle-tracker 1.0.0-alpha.1.
This also seems unmaintained, but is, at least, released.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-06 09:31:35 -07:00
aryanshridhar 04797d8653 stream_popovers: Use page_params.is_admin while building popover.
Within 9c9d74fd6d, page_params.is_realm_admin was incorrectly
stated while building popover which lead to admin actions not
being populated within popover.
This is so beacuse `is_realm_admin` is not a valid object
of page_params.

Rectified by renaming `is_realm_admin` to `is_admin`.
2021-04-06 08:10:43 -07:00
Abhijeet Prasad Bodas 95663693df refactor: Extract time calculation logic for topic muting.
This is a prep change for implementing the mute users
feature, so that this code can be reused.
2021-04-05 18:04:31 -07:00
Abhijeet Prasad Bodas 586f8fe9e0 refactor: Rename settings/muted-topics code to be specific.
This is a prep change for implementing mute
users feature, which will add another settings
page with similar naming conventions.
2021-04-05 18:04:31 -07:00
Abhijeet Prasad Bodas 3a9dfc02e6 refactor: Rename MessageList.update_muting_and_rerender.
This is a prep commit for implementing mute users feature, which
renames this function to be more specific.  This function cannot be
used as-is for user mutes, because for user-muted messages, we always
want to rerender the message list, irrespective of what
`excludes_muted_users` is.

In muting_ui.js, we also remove an unnecessary conditional that is
already handled by update_topic_muting_and_rerender itself.
2021-04-05 18:03:58 -07:00
Abhijeet Prasad Bodas f725711ff2 recent topics: Fix live update on muted_topics events.
Previously, the recent-topics view did not update when the webapp
received `muted_topics` events.

The final state was correct **only** on the client which was used to
mute/unmute the topic, because we update the UI even before sending
the request to the server to mute/unmute the topic.

This commit fixes that by rerendering the recent-topics table when the
client receives `muted_topics` events.  While doing so can be
expensive, it is likely unavoidable, because we may want to even
remove the topic from the recent-topics table, and we don't know
exactly which topic was affected (we just get an updated list of all
muted topics from the event).

Even though rerendering is expensive, it should not affect the user
experience, because a rerender will be trriggered only in the clients
which did not do the (un)muting (and hence, the user was probably not
interacting with these clients when the event was received). The
`last_topic_update` variable makes sure that this is the case.
2021-04-05 18:02:00 -07:00
Abhijeet Prasad Bodas ace54f3c3b recent topics: Fix duplicate muting requests sent to server.
Previously, on clicking the "bell" icon from a recent
topics topic row, two click handlers were triggered-
1. The one for the bell in the recent-topics topic
   row.
2. The one for the bell in the floating recipient bar.
   This is intended to be triggered only when the user
   clicks on the bell icon in the floating recipient
   bar to mute a topic, but this was triggered on
   clicking the recent-topics topic row bell too,
   because it wasn't specific and we use the same
   HTML class for both the bells.

Because both these click handlers were triggered,
the webapp sent back-to-back duplicate requests to
the server to mute the topic, which caused the sever
to throw "HTTP 400: Topic already muted" error.

This commit fixes this by making the recipient bar
click handler more specific, so that it is triggered
only when the recipient bar bell icon is clicked.

There is also the issue that the recipient bar bell
icon only allows a user to mute the topic, not unmute.
So, when someone mutes a topic, and then clicks on
the recipient bar bell icon, the webapp sends a
request to mute the topic again (not to unmute),
leading to the same error as above.
This commit does not fix that. See #15223.
2021-04-05 17:58:38 -07:00
aryanshridhar c630b888e5 dropdown_list_widget: Add a `include_current_item` parameter.
Added a `include_current_item` parameter to dropdown_list_widget
which behaves as follows:

- Has a default value of `true`, which includes the current value
in the dropdown list items.
- If set to false, it excludes the current value from dropdown
list items.
2021-04-05 17:51:59 -07:00
Tim Abbott 46c72fd17d stream_popover: Specify topic when opening compose.
This fixes a bug I introduced when merging
86eccfd20f, by not using the "new topic
button" trigger.

It would probably be wise to replace that "trigger" system with just
passing actual options, as it's pretty confusing.
2021-04-05 17:40:08 -07:00
Signior-X 86eccfd20f left-sidebar: Add the new topic button in stream popover.
This commit adds an option to create new topic in stream
popovers. Then adds a click listener on them which triggers
the compose start function with the stream specified.

Fixes #13480.
Fixes #2507.
2021-04-05 17:32:44 -07:00
Anders Kaseorg f81cc16a0f templates: Add {{#let}} block helper.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-05 17:24:09 -07:00
Kenny e83538167f message_edit: Add label for edit topic button.
Rewritten by tabbott to add the label in the right places, set ARIA
settings consistent with the title, etc.

Fixes #17309.
2021-04-05 17:20:57 -07:00
Anders Kaseorg d84727ce7f styles: Use Source Code Pro as our monospace font.
Fixes #15993.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-05 15:18:41 -07:00
Anders Kaseorg 236e114870 styles: Consistently use generic fallback font families.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-05 15:18:41 -07:00
Aman Agrawal 1a83112cf9 giphy: Register click events inside giphy module.
Primary reason for this is to allow us more control over
creation of giphy popover as will be evident in future commits.
2021-04-05 15:04:50 -07:00
Aman Agrawal 4593ca9ed7 click_handlers: Export convert_enter_to_click from ui_util.
This allows us to use this function in other places without
importing click_handlers which depends on a lot of other modules.
2021-04-05 15:04:50 -07:00
Aman Agrawal 5e83965e80 giphy: Use GIPHY web SDK to allow inserting GIFs in compose box.
We use GIPHY web SDK to create popover containing GIFs in a
grid format. Simply clicking on the GIFs will insert the GIF in the compose
box.

We add GIPHY logo to compose box action icons which opens the GIPHY
picker popover containing GIFs with "Powered by GIPHY"
attribution.
2021-04-05 15:04:49 -07:00
Steve Howell d50462568b refactor: Avoid update_calculated_fields() calls.
This change should make live-update code less brittle,
or at least less cumbersome.

Instead of having to re-compute calculated fields for
every change to a stream message, we now just compute
the fields right before we render stream settings UI.
2021-04-05 09:52:19 -07:00
Steve Howell 36632637dc refactor: Remove foo_display fields on subs.
Also add a helpful comment explaining how these work.
2021-04-05 09:52:19 -07:00
Steve Howell 5624ed2afe refactor: Extract stream_data.clean_up_description().
We use this in the few places where update_calculated_fields()
could plausibly be dealing with a new rendered description.
2021-04-05 09:52:19 -07:00
Steve Howell 99b177dc7d minor: Avoid reliance on is_old_stream. 2021-04-05 09:52:19 -07:00
Steve Howell 430fadfb0b refactor: Extract stream_data.can_subscribe_others(). 2021-04-05 09:52:19 -07:00
Steve Howell 36fd76dc20 refactor: Extract can_view_subscribers().
We also remove some needless uses of the calculated
field in the node tests.
2021-04-05 09:52:19 -07:00
Steve Howell ea972569a3 refactor: Extract stream_data.can_change_permissions(). 2021-04-05 09:52:19 -07:00
Steve Howell b27ff978c7 minor: Extract can_preview() helper. 2021-04-05 09:52:19 -07:00
Steve Howell 93471ed3e4 refactor: Extract can_toggle_subscription(sub).
We don't want to rely so much on calculated fields,
and the `should_display_subscription_button` name
is a bit misleading in certain contexts.
2021-04-05 09:52:19 -07:00
Steve Howell 9c9d74fd6d minor: Use page_params.is_realm_admin.
We don't need to get this off the sub.
2021-04-05 09:52:19 -07:00
Steve Howell 4380fe4eaf refactor: Extract stream_settings_data.
This is mostly a pure code move.

In passing I remove an unneeded call to
update_calculated_fields in the dispatch code,
plus some tests that don't need them.
2021-04-05 09:52:19 -07:00
Ganesh Pawar 5262ca7621 hotkey: Map numpad navigation keys to close compose when empty.
This maps pageup/pagedown/home/end to close compose when used in empty
compose box, matching the existing behavior for the Up/Down arrow keys.

Currently, these keys do nothing when used in an empty compose box.
Typically, a user intends to navigate when pressing these keys (and
with empty compose, they can't be expecting to navigate within the
compose box), so it makes sense to map them to navigate the message
feed just to save users from needing to hit `Esc` in these contexts.

Fixes #17917
2021-04-05 07:21:57 -07:00
Tim Abbott e7e2340eda hotkeys: Move copy_with_c shortcut definition and improve comments.
The `copy_handler` function that this shortcut calls is not useful
unless the body of a Zulip message is selected, so we shouldn't try
running it in other situations.
2021-04-05 07:20:32 -07:00
Tim Abbott 4462df64da hotkey: Fix incorrect preventDefault for recent_topics hotkeys.
This logic correctly prevents the hotkeys implemented below it from
being active when "Recent topics" is open.  We expect to change some
parts of that soon (see #17685), but in any case, we should always
return false in the hotkey code when we don't process a key, so that
default browser behavior works.

This fixes browser shortcuts like Ctrl+C, Ctrl+V, etc. when recent
topics is loaded.

This bug was introduced in 1eafb1d8b3.

Thanks to ganpa3 for noticing this bug.
2021-04-05 07:20:32 -07:00
Aman Agrawal 1d12fb0bb9 recent_topics: Extract function to check `table` focus. 2021-04-04 18:01:06 -07:00
Anders Kaseorg 6dc783e562 eslint: Enable sort-imports for member sorting.
This sorts the members imported within each individual declaration; we
use import/order for sorting multiple declarations.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-03 15:54:14 -07:00
Steve Howell 5fe8bbd9da node tests: Clear message_user_ids.
This defends against future intra-test leaks.
2021-04-03 15:03:00 -04:00
Tim Abbott 53adf889e5 popovers: Change label for "Copy link to conversation".
"Copy link to message" is both a clearer label, and also more likely
to be what someone is looking for.  (It also avoids adding the
"conversation" terminology to the product).

The previous label was also somewhat inaccurate, because it actually links
to a specific message in the conversation.
2021-04-03 07:47:07 -07:00
Mandeep Singh ea3cb941d4 settings: Replace user groups delete button with fa-trash-o.
This makes this settings page a bit more consistent with the rest of
the site.
2021-04-03 07:43:33 -07:00
Aman Agrawal f7f5308986 recent_topics: Don't change background color on thead hover.
We expect to give recent topics a cleaner look by doing so.

Fixes #17934
2021-04-03 07:41:01 -07:00
Tim Abbott 4488254da9 streams: Adjust confirmation message for stream deactivation. 2021-04-02 22:09:48 -07:00
Mateusz Mandera 82b43a8cfe streams: Use "archive stream" phrasing instead of "delete stream".
The previous phrasing was misleading in relation to what the action
actually does.
2021-04-02 22:06:48 -07:00
Palash Singh Raghuwanshi 7c43f1e2f7 static: Fix setting gear to be not active when app loads.
From the commit history, this typo has always been there; because it
had the same priority as the `opacity: 0.5` for that element,
it can be nondeterministic whether the bug appeared.

Fixes #17476.
2021-04-02 18:15:00 -07:00
Anders Kaseorg ceb7e2d2bd Revert "markdown: Add support to shorten GitHub links."
This reverts commit 9c6d8d9d81 (#16916).

This feature has known bugs, and also wants some design changes to
make it customizable like linkifiers, so we’re retargeting this to
post-4.x.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-02 15:52:34 -07:00
Aman Agrawal 0267ba54b2 filter: Return false for invalid filters.
For filter values which don't exist or are invalid in some
way, we return false to show user that there are no messages
in the filter user is trying to render. Our previous behaviour
was to show all the messages and ignore the filter which
isn't good.
2021-04-01 21:53:22 -07:00
aryanshridhar f19c7a2f69 emoticon_translation: Update comment for precise object length. 2021-04-01 16:52:32 -07:00
yashika 0fc3aa3a11 muting: Make topic muted notifications clearer.
The popup that appears when you mute a topic is a bit hard to read,
since nothing makes the topic and stream names jump out from the rest
of the paragraph.  Fix this by using bold around the stream/topic and
also cutting a bunch of unnecessary verbiage.

Tweaked by tabbott to further simplify the language.
2021-04-01 16:25:12 -07:00
Anders Kaseorg 0868641ea4 Revert "static: Make alert-box available for portico pages."
This reverts commit a00f5dd90e (#17801).

That commit introduced a regression in the portico pages as described
in commit 85b3157b47.  Since that fix
introduced a regression of its own, we need to revert both commits for
now.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-01 15:25:23 -07:00
Anders Kaseorg 6a877890b8 Revert "css: Fix webapp alert styling incorrectly applying to portico."
This reverts commit 85b3157b47.

This broke the × button on Blueslip alert boxes, because @extend does
not work across different PostCSS compilation units.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-01 15:25:23 -07:00
Anders Kaseorg 2595fa88a0 setup: Use the number of completed password changes for race detection.
The start time of the last password change was the wrong time to use,
because we could start a password change, start another request,
finish the password change, and then observe that the other request
failed due to the password change.

We could use the end time, but a counter is more robust to
sub-millisecond race conditions.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-01 13:49:02 -07:00
Tim Abbott b8eb3d676a recent topics: Clarify label for filter box.
* We shouldn't use "Search" when we mean "Filter".  Filter is correct
  here, since we are just showing a subset of what's otherwise shown,
  and won't find anything that's older (or whatever).
* The stream/topic wording was unnecessary; the things we're filtering
  are topics (E.g. "Filter users" might look at name/email, and is the
  right label, not "Filter name/email").
2021-04-01 13:27:30 -07:00
YashRE42 dc02d4550f narrow_banner: Refactor first_operand conditionals to use switch/case. 2021-04-01 07:38:39 -07:00
YashRE42 f85f0c4b0b narrow_banner: Refactor empty banner is: operands to use switch/case. 2021-04-01 07:38:39 -07:00
aryanshridhar 00c493a75a dropdown_list_widget: Properly handle reset button text.
There can be several cases when we don't require a reset button
with the dropdown_list_widget.
Hence, Added an abstraction for dropdown_list_widget that
renders the button only if it's corresponding text is passed.
2021-03-31 17:57:56 -07:00
Riken Shah bfc1e45a91 password_change: Avoid unnecessary redirect to the login page.
This commits adds on to 9884226f, which was added to
handle a rare race condition that occurs when the
session hash is not updated by the backend during the
password change process.

It handles a variant race situation where the request was initiated
before/during the password change event and completed after it was
completed. Hence, forcing the page to redirect to the login page.
2021-03-31 11:03:09 -07:00
Tim Abbott 85b3157b47 css: Fix webapp alert styling incorrectly applying to portico.
In a00f5dd90e, we needed to move the
`alert-box` styles from alerts.css to be visible in portico pages.
However, when doing so, we incorrectly moved all of alerts.css, which
also has styles for `alert` and` alert-error` designed to make it
convenient to include hidden elements for potential errors in the
webapp settings UIs directly in the HTML template (and then use
show/hide to manage them).

We fix this by moving just the alert-box scope to the common
components.css module, which is designed as the place for styles
shared between the webapp and portico pages.

This fixes an issue where the error messages for wrong password and
the like were invisible :(.
2021-03-31 10:06:40 -07:00
Signior-X 66d7e711b2 refractor: Replace manual autosize of textarea with compose_ui autosize.
This commit make compose_ui.autosize_textarea handle most of the autosize
logic of the textarea. It audits for any logic that is trying to do
autosize manually and replace it with compose_ui.autosize_textarea.
This allows to have better check for when the textarea is autosized.

Mainly done this so that we can have a check on #compose-textarea when
to autosize and when not to, thus helping to have all the logic in only
one function.
2021-03-31 07:49:47 -07:00
sahil839 f73d101854 stream: Use 'hidden.bs.modal' event for enabling mouse background events.
We now unconditionally enable backgroung events when 'hidden.bs.modal'
event is triggered on closing of modal. We do not need to handle them
separateley for closing modal by close_modal, data-dismiss or escape.
We handle this by single handler for modals in settings and subscription
overlay.

Fixes #16688.
2021-03-30 17:02:46 -07:00
sahil839 7489213768 modals: Do not remove modal element from DOM after closing the modal.
This commit changes the code to not remove the modal element from DOM
after closing the modal for the deactivation stream modal and stream
privacy modal.

This is a prep commit for enabling background mouse events
unconditionally using 'hidden.bs.modal', because removing element
using '.remove' remove all events attached to it and this will also
remove the 'hidden.bs.modal' event which we do not want.

This remove behavior is inconsistent as we remove some of the modals
but do not remove some, so for now we are not removing the modal
after closing but it is anyway removed before opening a modal to handle
case of having two elements of same id and avoids any bugs.
This behavior of when to remove the element from DOM and when to not
remove needs to be discussed and may be modified in future.
2021-03-30 17:02:46 -07:00
sahil839 677ba4bc25 streams: Show warning when unsubscribing a private stream.
We show a modal as a warning when unsubscribing a private stream
because it is a irreversible action and one cannot re-subscribe
tovit until added by other member of stream.

Fixes #9254.
2021-03-30 17:02:44 -07:00
sahil839 60f486d941 confirm_dialog: Add close-modal-btn class to cancel buttons.
This commit adds "close-modal-btn" class to cancel button in
the modal and cross icon.

We do this change because we would add a modal for unsubscribing
from private stream in further commit using confirm_dialog module.
We would need to avoid the unexpected closing of stream settings
on closing the modal which can be done by calling 'e.stopPropagation'
to prevent propagating of events in other elements.
Thus, adding this class will mean that the handler used for stream
privacy modal for this same task will be used for unsubscribe modal
also.
2021-03-30 16:51:42 -07:00
sahil839 208f3d7f1b confirm_dialog: Focus on the yes_button after opening the modal.
This commit adds the code to focus the confirmation/yes button
after opening the modal such that the user can just confirm by
pressing Enter.
2021-03-30 16:51:42 -07:00
sahil839 2e6723f337 stream: Add close-modal-btn class to cancel btn in deactivate stream modal.
This commit adds 'close-modal-btn' class to cancel button and cross icon
in the deactivation stream modal.

This change is a prep commit for enabling background events on
'hidden.bs.modal' event. As we would enable background events in furhter
commit using the 'hidden.bs.modal' event, we would need to remove the
'hide.bs.modal' event of deactivation_stream_modal which removes the
element from DOM.
When we remove this event we would need a e.stopPropagation call to avoid
unexpected closing of stream settings which was not a problem previously
because the element was being removed from DOM before actual closing of
modal.
So instead of adding a different handler, we can use the handler used
for stream privacy modal here by adding this new class.
2021-03-30 16:51:42 -07:00
sahil839 4d3a2c10fb stream_edit: Rename class of cancel btn in stream-privacy modal.
This commit renames the class of both cancel button and the cross
icon to close-modal-btn.

This change is a prep commit for enabling background events on
'hidden.bs.modal' event. As we would enable background events in
furhter commit using the 'hidden.bs.modal' event, we would need to
remove the 'hide.bs.modal' event of deactivation_stream_modal which
removes the modal element from DOM.
When we remove this we would need a e.stopPropagation call to avoid
unexpected closing of subscription settings, which was not a problem
before as the element was removed from DOM before the actual closing
of modal.
So instead of adding a separate `e.stopPropagation' call, we can use
the same handler that is being used for stream privacy modal and this
is the reason the class name of cancel button of privacy modal is
being changed.
2021-03-30 16:51:42 -07:00
sahil839 0fb4045807 subs: Do not remove stream row when unsubscribing using hotkey.
We do not remove the stream row instantly from the subscribed list in
subscription overlay when unsubscribing from public streams in most
of the cases but we do so when unsubscribing using hotkey.
This commit makes it consistent by not removing the stream row on
unsubscribing using hotkey.

We also not remove the 'active' class as streams settings is still
open in the right seciton and this behavior is also consistent with
the other ways of unsubscribing.

Note that this behavior is only for public streams, we remove the
stream row in case the stream is private, as user cannot
resubscribe himself and this behavior is consistent across all ways
of unsubscribing.
2021-03-30 16:51:42 -07:00
aryanshridhar ce148ce770 frontend: Fix broken label tag and removed label expression.
- Rectifies broken label tag having a misleading 'for' attribute.
- Removed 'name' attribute from unlabelled span tag.
- Removed label expression from DropdownListWidget to built an,
  abstraction for control group only.

Fixes #17311.
2021-03-30 16:14:42 -07:00
aryanshridhar 134a6f8bba edit_bot: Fix dropdown username capitalization.
Restructured dropdown_list_widget template to unwrap label tag
from the control group, hence defaulting the edit_bot
dropdown items to their original text size.
2021-03-30 16:14:42 -07:00
Sumanth V Rao e12f682e2e markdown: Include text & url in `topic_links` parameter of our API.
The linkifier code now includes both the shortened text and the expanded
URL, sorted by the order of the occurrence in a topic. This list is passed
back in the `topic_links` parameter of the /messages and the /events APIs.

topic_links earlier vs now:

earlier: ['https://www.google.com', 'https://github.com/zulip/zulip/32']

now: [{'url': 'https://www.google.com', 'text': 'https://www.google/com},
      {'url': 'https://github.com/zulip/zulip/32', 'text': '#32'}]

Similarly, the topic_links local echo logic in the frontend now returns
back an object.

Fixes: #17109.
2021-03-30 15:53:07 -07:00
Steve Howell ec80d2d5db sidebar toggles: Lift code to display PM counts.
We now consistently set the PM counts for the right
sidebar toggle in unread_ui, similar to what we
do for the overall counts in the left sidebar toggle.
(Use a thin window to see the code in action.)

This breaks a dependency cycle.

In passing I improve the test coverage for the
actual job that pm_list still does (updating its
own total count in the "Private Messages" section).
2021-03-30 12:07:51 -07:00
Aman Agrawal fe27fe5555 message_events: Don't update data structures for unavailable msgs.
For messages which we don't have stored locally, we don't update
our data structures. This was actually our behaviour before
59e5f2d8fc, which introduced this
bug.

Not doing this caused a major bug where we ran into errors
moving messages for topics for which we didn't have all
the messages available.
2021-03-30 09:00:23 -07:00
Anders Kaseorg 6f764ce4b3 message_list: Downgrade message_list.all to MessageListData.
This data structure has never been one that we actually render into
the DOM; instead, its role is to support clicking into view that
contain muted streams and topics quickly.

This downgrade makes that situation much more explicit, and is also
useful refactoring to help simpify the upcoming changes in #16746.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-30 08:33:47 -07:00
Aman Agrawal e8b7ad886d recent_topics: Don't revive focus when RT is not in focus.
When there is any overlay or popover open or user is focused on
any other input, we don't revive focus within recent topics.

Fixes #17875
2021-03-30 07:53:37 -07:00
Anders Kaseorg d43ac7357a js: Move current_msg_list, home_msg_list to ES6 module message_lists.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-29 18:23:47 -07:00
jagansivam28 4143189381 users: Show correct role of owners in the 'Your account' page.
This commit fixes the 'Your account' settings page to show
correct role of organization owner. Previously it was
incorrectly displayed as administrator.

Commit message tweaked by sahil839.
2021-03-29 17:37:31 -07:00
Steve Howell e08bd9b1af refactor: Move all_topics_in_cache.
This is a pure code move.

The diff is bit cluttered by the necessity
to add with_field when we moved the test.
2021-03-29 14:53:57 -07:00
Steve Howell 415e6a486f refactor: Extract echo.update_message_lists.
We lift the code out of message_store.reify_ids
into its only calling module (echo.js).
2021-03-29 14:53:57 -07:00
Steve Howell 6bad6c8837 refactor: Move pm_conversations.process_message.
I lift this function out of message_store to
break some dependencies, and it's also more
consistent with the rest of the codebase:

    alert_words.process_message
    pm_conversations.process_message
    recent_topics.process_messages
    recent_senders.process_message_for_senders

We can do further cleanup to make these names
consistent (and possibly have them all work in
bulk), but that's out of the scope of the current PR.
2021-03-29 14:53:57 -07:00
Steve Howell 45d806d9aa refactor: Extract message_helper.process_new_message.
We move the message_store.add_message_metadata function
(and all its dependencies) into a new module called
message_helper and rename the function to process_new_message.
(It does a bit more than adding message metadata, such
as updating our message store.)

We also have a "protected" interface now in message_store,
so that message_helper can access the message store:

    update_message_cache
    get_cached_message

Because update_message_cache is identical to
the former create_mock_message, we just renamed it
in the tests.

Most callers should use these functions:

    message_helper.process_new_message (setting)
    message_store.get (getting)

It's slightly annoying that the setter interface
is in a different module than the getter interface,
but that's how you break a bunch of dependencies.

We also extract the tiny message_user_ids class:

    user_ids()
    add_user_ids()

All the code moves here are pretty trivial, and
the code that was moved maintains 100% line
coverage.

The module name `message_helper` is not ideal, but it's a single
function and it'll save time to just do the topology change now and
leave thinking through the right name to later.
2021-03-29 14:53:57 -07:00
Tim Abbott a092e96bff message_edit: Rename start_inline_topic_edit.
This function should be named similarly to the well-named
end_inline_topic_edit; previously the main hint that this was the
inline code path was just that the recipient_row was the parameter.
2021-03-29 09:39:28 -07:00
Anders Kaseorg e642b8e777 rendered_markdown: Add horizontal scrollbar to overflowing ```math.
Fixes #14422.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-28 19:03:40 -07:00
tushar912 5c50732008 user groups: Add remove event.
Before this we did not have remove event in server_events_dispatch.js
for the user group delete event even though server had. This was
leading to blueslip errors. Extracted the logic which was used in
 success() of channel.del for user_groups into the remove case in
server_events_dispatch. Also removed the redundant reload call as
we already do that in server events.
2021-03-28 16:18:09 -07:00
Aman Agrawal ca9f6e3402 recent_topics: Remove beta label.
Since recent topics is now the default view and all of the
known bugs have been fixed, we remove the beta label from it.
2021-03-28 16:16:48 -07:00
Steve Howell d9e4c2285c refactor: Break stream_data's dep on stream_color.
We simply lift the DEFAULT_COLOR constant to stream_data.
2021-03-28 15:55:55 -07:00
Steve Howell 98372cd244 refactor: Make home_view_loaded into a callback.
This reduces our extraneous deps from 72 to 71.
2021-03-28 15:55:55 -07:00
Steve Howell c67f82b073 refactor: Extract narrow_banner module.
This is a mostly verbatim extraction.

I re-phrased one line of code to work around a lint
false alarm. (Look for `preamble` in the diff.)

There are about 8 lines missing coverage here, so
the new module might be a good candidate to get
100% line coverage on.

Before this change, you would need to remove 74
edges from our dependency graph to make it
acyclic. Now it's 72.
2021-03-28 15:55:55 -07:00
Steve Howell e72f208fde refactor: Move insert_message to echo.
This change does not impact the overall complexity
of our dependency graph (at least in terms of the
number of edges that we would need to remove to get
a tree), but it does clarify the picture a bit.
2021-03-28 15:55:55 -07:00
Anders Kaseorg 1585c2a12c blueslip_stacktrace: Enlarge click target for expanding rows.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 22:07:26 -07:00
Anders Kaseorg 7f89cb9535 eslint: Enable spaced-comment rule.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 16:32:25 -07:00
tushar912 737dbb3741 custom profile fields: Rename few functions.
Rename few functions referencing the "CHOICE" field to
instead use the new "SELECT" name. This is done so that they
can be reused in "SELECT_MULTIPLE" field.
2021-03-26 11:49:28 -07:00
tushar912 2cf51139cf custom profile fields: Rename "CHOICE" to "SELECT" in frontend.
This requires a small backend change to the label.
2021-03-26 11:49:11 -07:00
Anders Kaseorg a05899f1b5 js: Convert static/js/csrf.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 10:17:56 -07:00
Anders Kaseorg 38ffd47b90 js: Convert static/js/page_params.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 10:17:56 -07:00
Anders Kaseorg bb1b2048bd js: Convert static/js/i18n.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 10:17:56 -07:00
Anders Kaseorg 40c3d07b2c bundles: Remove some imports with no side effects.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 10:17:56 -07:00
Sumanth V Rao e925ec6c41 css: Hide copy-paste button for codeblocks in formatting help overlay.
We missed out on this during our previous efforts to add a copy-to-clipboard
icon in codeblocks (42d30bc14b).
2021-03-26 09:46:09 -07:00
PIG208 a00f5dd90e static: Make alert-box available for portico pages. 2021-03-26 09:41:08 -07:00
PIG208 36e90195e0 static: Move click handlers for alert-box to a separate module.
ui_init is also modified to ensure that the click handlers will still
be correctly initialized.
2021-03-26 09:24:41 -07:00
Gaurav Pandey ba14168d57 right-sidebar: Remove extra subtrahend from max-height of user-list. 2021-03-26 09:22:36 -07:00
Anders Kaseorg 7656d44abc js: Simplify code using default parameters and destructuring.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 09:21:46 -07:00
Vishnu KS def1e01512 i18n: Translate quote and reply mention text.
Fixes #17479
2021-03-25 10:38:33 -07:00
Abhijeet Prasad Bodas 423770f189 refactor: Extract starred_messages_ui.js module.
This is a direct code move which will allow us
to enforce 100% coverage on the data handling
parts of starred_messages.js.
2021-03-25 02:26:44 -07:00
Ganesh Pawar 947ce2b79d minor: Check if typeahead query exists.
When a user entered an invalid character (whitespace or characters not
present in a name), the cleaned-up array, and hence the query,
would be empty which resulted in an error.

Fixes #17542
2021-03-25 02:08:51 -07:00
Nishant Mittal b845694e72 dropdown_list_widget: Display default_text for invalid values.
Fixes #16946.
2021-03-25 01:25:18 -07:00
Aman Agrawal 0b9578f457 recent_topics: Load filters from localstorage before rendering.
We were loading filters from localstorage after rendering the
filters block which caused the incorrect icons being displayed
for filters.

Since usually recent_topics renders a couple times when it
is loaded directly and the filters were being loaded as part of
show_selected_filters after we rendered recent_topics filters,
it meant the correct filters were being displayed in the
second render.

But, when user loads any other narrow directly when Zulip is loaded,
and opens recent_topics, recent_topics is only rendered once,
hence the bug gets noticed.

Fixes #17496
2021-03-25 01:22:19 -07:00
m-e-l-u-h-a-n 2699048208 markdown: Extend user mention syntax to support user_id for mentioning.
Extend our markdown system to support mentioning of users
by id also. Following these changes, it would be possible
to mention users with @**|user_id** and silently mention
using @_**|user_id**.

Main intention for extending the mention syntax is to make
it convenient for bots to mention a users using their ids. It
is to be noted that previous syntax are also supported.

Documentation tweaked by tabbott for better readability.

The changes were tested manually in development server, and also
by adding some new backend and frontend tests.

Fixes: #17487.
2021-03-25 00:44:56 -07:00
akshatdalton 9c6d8d9d81 markdown: Add support to shorten GitHub links.
We add support to shorten links and test their shortening in
well-organized, clean manner that makes it trivial to extend the
GitHub approach for GitLab and perhaps other services.

We only shorten basic types of GitHub links (issue, PR, commit) that
fit a set of simple common patterns; the default behaviour of Autolink
is kept for everything else.

Logic added in frontend and backend Markdown Processor is identical.
This makes easy to extend the logic for other services like GitLab.

Fixes #11895.
2021-03-25 00:39:44 -07:00
YashRE42 abd959cf6a server_events_dispatch: Throw blueslip from typing based on event.op. 2021-03-24 15:04:00 -07:00
YashRE42 a93adbfa76 server_events_dispatch: Throw blueslip from stream based on event.op. 2021-03-24 15:04:00 -07:00
YashRE42 f69de35267 server_events_dispatch: Throw blueslip from realm_user based on op. 2021-03-24 15:04:00 -07:00
YashRE42 27ac45e71b server_events_dispatch: Throw blueslip from realm_domains based on op. 2021-03-24 15:04:00 -07:00
YashRE42 4ffdfb5f00 server_events_dispatch: Throw blueslip if wrong op in realm_bot case. 2021-03-24 15:04:00 -07:00
YashRE42 d50bc7441a server_events_dispatch: Refactor realm_bot case to use switch/case.
This should make no functional changes.
2021-03-24 15:04:00 -07:00
YashRE42 b89363cec3 server_events_dispatch: Refactor realm event to use switch/case.
This should make no functional changes.
2021-03-24 15:04:00 -07:00
YashRE42 195b1b28ee server_events_dispatch: Throw blueslip if update_dict without prop. 2021-03-24 15:04:00 -07:00
YashRE42 e3b6cc61f3 server_events_dispatch: Throw from "reaction" based on event.op. 2021-03-24 15:04:00 -07:00
YashRE42 bf86422116 server_events_dispatch: Refactor 'reaction' case to use switch/case. 2021-03-24 15:04:00 -07:00
YashRE42 bc69521caa server_events_dispatch: Throw from "subscription" based on event.op. 2021-03-24 15:04:00 -07:00
Anders Kaseorg 6de39ae92d js: Clean up typeof … === "undefined" checks.
The only reason to use typeof foo === "undefined" is when foo is a
global identifier that might not have been declared at all, so it
might raise a ReferenceError if evaluated.  For a variable declared
with const or let or import, a function argument, or a complex
expression, simply foo === undefined is equivalent.

Some of these conditions have become impossible and can be removed
entirely, and some can be replaced more idiomatically with default
parameters (note that JavaScript does not share the Python misfeature
of evaluating the default parameter at function declaration time).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-24 13:15:01 -07:00
Steve Howell 57d79e8fd6 refactor: Extract color_class module.
This breaks some indirect dependencies on subs
and message_view_header.
2021-03-24 12:22:27 -07:00
Steve Howell f3b1e723e0 typeahead: Eliminate render caches.
These were introduced in ff9a929d7a
with no explanation of why they were necessary.

Generally you only render a few things, and it's
important that they're up to date.

We weren't doing a good job of invalidating the cache.

Eliminating the cache will fix bugs (like presence circles
being out of date) and break some dependencies.

I removed some very fragile test code that was relying
on invalid values taken out of the cache.  (We now have
less line coverage, but if we want to test our rendering,
there are much cleaner ways to do it.)

As part of testing this, I renamed Hamlet to "aaron", so
that there are two aarons, and then I logged on as Iago
to see the "secondary" code in action that shows their
emails to distinguish them.
2021-03-24 12:15:36 -07:00
smit_patel 5ddb5fc534 popovers: Change "Delete all messages in topic" to "Delete topic".
This cleans up the copy a bit to be more readable.

Documentation changes cleaned up by tabbott.

Fixes #16856.
2021-03-23 15:46:00 -07:00
Anders Kaseorg fb688e8e5d server_events_dispatch: Fix Prettier formatting.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-23 14:17:08 -07:00
YashRE42 592eb1a197 server_events_dispatch: Refactor user_group to use switch/case. 2021-03-23 13:56:21 -07:00
YashRE42 8d578c248f server_events_dispatch: Refactor typing event to use switch/case. 2021-03-23 13:56:21 -07:00
YashRE42 60b7211b1f server_events_dispatch: Refactor stream case to use switch/case. 2021-03-23 13:56:21 -07:00
YashRE42 1b4fc178c1 server_events_dispatch: Refactor realm_user to use switch/case.
This should make no functional changes.
2021-03-23 13:56:21 -07:00
YashRE42 33fb78af42 server_events_dispatch: Refactor realm_domain to use switch/case.
This should make no functional changes.
2021-03-23 13:56:21 -07:00
YashRE42 d575517035 server_events_dispatch: Refactor update_dict op of realm case.
This should make no functional changes.
2021-03-23 13:56:21 -07:00
YashRE42 f4afe770e4 server_events_dispatch: Refactor subscription case to use switch/case.
This commit should make no behavioural changes.
2021-03-23 13:53:23 -07:00
shanukun cfe0fa3788 event_schema: Add schema check for realm/deactivated event.
This add the schema checker, openapi schema, and also a test for
realm/deactivated event.

With several block comments by tabbott explaining the logic behind our
behavior here.

Part of #17568.
2021-03-23 12:16:16 -07:00
Steve Howell 65ec8f2000 refactor: Move suspect_offline logic into watchdog.
This breaks some indirect dependencies in presence.js.
2021-03-23 14:08:39 -04:00
YashRE42 5b0db2e7ed templates.js: Remove unused "plural" helper.
This helper was added in eac6463031 and
used by the "message.handlebars" file. This is no current call for
this helper in the codebase, hence it is removed to improve coverage.

This commit also marks template.js to have 100% test coverage.
2021-03-23 10:46:04 -07:00
Anders Kaseorg 9553f11387 eslint: Forbid CommonJS variables in ES6 modules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-23 01:42:43 -07:00
Abhijeet Prasad Bodas 42aea49784 left sidebar: Add support to unstar all messages in topic.
This adds support for unstarring all (starred)
messages from a particular topic, from the topic
popover.

The earlier implementation of this in #16898
was reverted in bc55aa6a01 (#17429)
because it had two problems-

1. The crash reported in bc55aa6a01
was due to message_store returning undefined. This happens
when the message itself hasn't been fetched from the server
yet, but we know that the message is starred from the ids
in `page_params` in `starred_messages.js`.
This commit handles this case explicitly.
Note that, we simply ignore those messages which
we haven't fetched, and because of this, it may
happen that we don't unstar some messages from that
topic. The correct implementation for this would
be to ask the backend for starred IDs in a topic.

2. The earlier implementation actually unstarred **all**
messages. This was because it grabbed the topic and stream_id
from the topic popover `data` attributes, after the topic
popover had been closed. This passed `undefined`, which
the function then interpreted as an action to unstar all
messages.
With this commit, we use the confirm_dialog widget,
which eliminates the need to store this data in the DOM.
2021-03-23 00:17:15 -07:00
Abhijeet Prasad Bodas f17a52b2f3 refactor: Use confirm_dialog for unstar-all-messages.
This replaces the separate modal shown on clicking
"Unstar all messages" from the left sidebar to use
the confirm_dialog widget instead.
2021-03-23 00:17:15 -07:00
Abhijeet Prasad Bodas eb7b699ac9 confirm_dialog: Make it usable outside settings.
* Currently, the confirm_dialog is used only in
the settings pane, which already has the `new-style`
class in the main `settings_overlay.hbs` file. So,
the confirm modal is rendered correctly there. But to
make it available for use outside of the settings pane,
we add the `new-style` class to the confirm container
itself, without which, the buttons look ugly.

* The other change here is the click handler for
removing the modal element. Previously, when the
modal was closed (with any of the "yes"/"no"/"cross"
buttons), there was a small time interval of around
a second during which the modal had disappeared,
but the background content was still in the faded-out
state. This change fixes this glitch. This glitch was
probably not noticable earlier, because the settings
pane itself causes the background to be slightly faded
out.
2021-03-23 00:17:15 -07:00
Abhijeet Prasad Bodas 1cc6f6158e left sidebar: Fix exception on opening all/starred popovers.
This code was added in 2d414fa897, after
the `window.exports` variable was removed from
`stream_popovers.js`, while converting it to an ES6 module
in c71af35461. This resulted
in opening the starred messages or all messages
popovers throw `Error: exports in undefined.`.
2021-03-22 23:56:50 -07:00
Anders Kaseorg d22a61443e notifications: Remove in_browser_notify and bootstrap-notify.
Follow up to #14768.  This feature was already non-functional due to
.alert-display { display: none; }, and if we want to reimplement it,
we should do it using a modern library.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-22 23:40:38 -07:00
Anders Kaseorg aff8a32bc1 notifications: Simplify sound playing.
Remove the unused notifications-area wrapper.  Remove the feature
detection code as all browsers recognize the <audio> element.  Create
the <audio> statically with the page template.  Use multiple <source>s
to let the browser detect the appropriate format instead of trying to
do its job for it.  Remove the absurd loop="yes" attribute, which had
fortunately been specified on the wrong element.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-22 23:36:38 -07:00
Steve Howell 72e0f2e901 bots: Lift render_bots calls to dispatcher code.
This is mostly a refactoring to break the unnecessary
dependency of bot_data on settings_bots.

This is a bit more than a refactoring, as I remove all
the debounced calls to render bots during the
initialization of bot_data. (The debouncing probably
meant we only rendered once, but it was still needless
work.)

We don't need to explicitly render bots during
bot_data.initialize(), which you can verify by loading
"#settings/your-bots" as the home page. It was just an
artifact of how add() was implemented.

Note that for the **admin** screen, we did not and
still do not do live updates for add/remove; we only do
it for updates. Fixing that is out of the scope of this
change. The code that was moved here affects
**personal** bot settings.

Note that the debounce code is quite fragile. See my
code comment that explains it. I don't have time to go
down the rabbit hole of a deep fix here. The puppeteer
tests would fail without the debounce, even though I
was able to eliminate the debounce in an earlier
version of this fix and see good results during manual
testing. (My testing may have just been on the "lucky"
side of the race.) I created #17743 to address this
problem.
2021-03-22 19:40:06 -07:00
Gaurav Pandey dea5245590 right-sidebar: Fix design bugs with keyboard-shortcuts.
The keyboard-shortcuts icon currently has a fix position
causing design related bugs such as overlapping with userlist
in the sidebar.

The fix wraps the invite-more-users link and keyboard icon inside
a div with display property as flex instead of just using the anchor
tags inside the side-bar items.
2021-03-22 19:29:46 -07:00
Steve Howell 746cc9e1f6 refactor: Extract browser_history module.
This mainly extracts a new module called
browser_history. It has much fewer dependencies
than hashchange.js, so any modules that just
need the smaller API from browser_history now
have fewer transitive dependencies.

Here are some details:
    * Move is_overlay_hash to hash_util.
    * Rename hashchange.update_browser_history to
      brower_history.update
    * Move go_to_location verbatim.
    * Remove unused argument for exit_overlay.
    * Introduce helper functions:
        * old_hash()
        * set_hash_before_overlay()
        * save_old_hash()

We now have 100% line coverage on the extracted
code.
2021-03-22 13:29:32 -07:00
Steve Howell 67a487db79 refactor: Extract message_parser module.
I moved four functions, verbatim, to a new module.
They were in message_util before, which led to
filter.js having several accidental indirect
dependencies.

I considered just putting these four functions in
filter.js, but I think it's a nice abstraction boundary
that filter.js delegates actual message parsing, and
the original author apparently had a similar thought
process.

I also wanted to make it so that a casual reader of
filter.js doesn't think we are manipulating DOM. It's
true that we still indirectly require jquery here, but
it's only for parsing, and it seems plausible we would
eventually use a more low-level parser.

I can see us maybe using these functions in something
like MessageListData in the future, so speculatively
splitting them out might future-proof us from some
cyclical dependencies.

I also think it's plausible that we will just modify
our two markdown processors to attach that kind of
metadata to the messages.

Last but not least, I think there might be opportunity
here to simplify the filter tests and remove some of
the zjquery hacks. We would instead just mock the
message_has_* helpers for the filter tests, and then
do more detailed direct testing on the functions
themselves.
2021-03-22 13:21:56 -07:00
Steve Howell 1cee29c2d1 refactor: Extract stream_bar.decorate.
This makes input_pill no longer depend on
stream_data and stream_color, and it
probably reduces some other dependencies.
2021-03-22 13:21:56 -07:00
Steve Howell dbf19fe8d7 refactor: Extract watchdog module.
We now have 100% code coverage on this somewhat
fiddly code.

We also break activity's dependency on server_events.
2021-03-22 13:17:37 -07:00
Steve Howell d644e42dc1 refactor: Move desktop_icon_count_display_values. 2021-03-22 13:17:37 -07:00
Steve Howell a429ecbb1b refactor: Move get_notifications_table_row_data.
The only caller for this function was settings_config,
so we put it there.

For the stream_edit test we no longer mock the function.
(The reason we mocked the function was more about avoiding
the heavy settings_notifications import than the function
itself.)  This gives some incidental coverage, but then I
also add some more real coverage on it.
2021-03-22 13:17:37 -07:00
Steve Howell 855ac26c48 compose fade: Extract compose_fade_users class.
We extract compose_fade_users and compose_fade_helper.

This is a pretty verbatim extraction of code, apart from adding a few
exports and changing the callers.

This change makes the buddy_data module no longer sit "above" these
files in the dependency graph (at least not via compose_fade):

    * jquery
    * lodash (not a big deal)
    * compose_state
    * floating_recipient_bar
    * message_viewport
    * rows

The new moules have dependencies that buddy_data already
had directly for other reasons:

    * people
    * util

And then buddy_data still depends on stream_data indirectly through
the compose-fade logic for stream_data. Even without compose-fade, it
would depend indirectly on stream_data via hash_util.

Note that we could have lifted the calls to compose_fade out of
buddy_data to move some dependencies around, but it's useful to have
buddy_data fully encapsulate what goes into the buddy list without
spreading responsibilities to things like activity.js and
buddy_list.js. We can now unit-test the logic at the level of
buddy_data, which is a lot easier than trying to do it via modules
that delegate drawing or do drawing (such as activity.js and
buddy_list.js).

Note that we still don't have 100% line coverage on the
compose_fade.js module, but all the code that we extracted now is
covered, mostly via buddy_data tests.
2021-03-21 20:16:08 -07:00
Signior-X 31b7eb7439 style: Fix the vertical alignment in message controls.
This commit adds vertical-align: middle to .message_failed in zulip.css
which was necessary as the alignment of .message_failed wasn't matching
with rest of the message controls like .edit_content. This makes the
look of the message controls better that they don't look shifted.

Follow up #17666
2021-03-21 17:38:14 -07:00
Steve Howell ec46827ebd refactor: Move user_can_change_* to settings_data.
This simplifies our dependency graph and puts easily
testable functions into a module where we enforce
100% coverage.

All the code was moved verbatim.
2021-03-21 17:07:41 -07:00
Steve Howell 0014bc1549 node tests: Add test() wrapper for channel. 2021-03-20 11:00:48 -04:00
Anders Kaseorg 0d218a4b76 eslint: Enable @typescript-eslint/consistent-type-imports.
TypeScript type-only imports will probably become important eventually
for reducing our circular import problem.

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-18 17:26:19 -07:00
Abhijeet Prasad Bodas 206fe1ef3b node tests: Introduce message_store.create_mock_message() helper.
Previously, it was tedious to create actual message
objects in message_store for use in node tests.
This was mainly because, `add_message_metadata`
in message_store has many dependencies and
validation checks. Since it was difficult to create
actual message objects, many tests just mocked
the `message_store.get()` method to return the desired
message.

This commit adds a new helper method (`create_mock_message`)
to message_store, for use in node tests. This just stores
the object passed to it in the `stores_messages` map,
without any validation. We do not add any
default fields to the message object before saving
it from this helper, because doing so would decrease
the utility of this helper, and, if a test
depends on some field having a particular value,
then it would be better to just pass the field: value
pair from the test itself, for readability, rather
than relying on the helper to add the field for us.

This helper allows us to write deeper tests.

This commit also replaces some instances of mocking
`message_store.get()` to use this new helper method.
2021-03-18 15:55:39 -07:00
Abhijeet Prasad Bodas aa0e5dd35b refactor: Extract update message flags POST call.
This modifies the helper to take in an array
of message ids, so that it can be used in the
`unstar_all_messages` function too.
2021-03-18 15:55:31 -07:00
Abhijeet Prasad Bodas b37e5cc017 left sidebar: Don't show unstar-all button when redundant.
Previously, if a user had zero total starred messages,
we would still show the "Unstar all messages" in the
left sidebar on opening the starred messages popover.

This commit adds a check to show button only if the
user had non-zero starred messages. This is done
because-
1. The button, when shown when the user has zero
   starred messages, is redundant and may be confusing.
2. Clicking on the button when having zero starred
   messages sends a zero-length array to the backend,
   resulting in HTTP 400 error.
2021-03-18 15:52:06 -07:00
Anders Kaseorg fe28ecb71d hash_util: Convert object characterToBeReplaced object to map.
Computed indexing into an object, especially with a user-provided key,
can be dangerous in JavaScript because of nonsense features like
obj["__proto__"].  In this case there’s no vulnerability because the
possible keys are strictly limited by the regex, but it’s always
better practice to use a Map for computed indexing.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-18 15:07:17 -07:00
Signior-X e1c4c7b802 message view: Show message source button until message successfully sent.
This commit removes the unless msg/locally_echoed condition for the
edit content div, which has the consequence of making the "view
message source" widget always available for locally echoed
messages. This ensures that the message source can be seen if a very
long message has been drafted and it fails due to a server-side error
(See #17425 for the original report).

Fixes #17650.
2021-03-18 14:49:09 -07:00
Steve Howell 728905d4bc node tests: Clean pm_conversations more simply. 2021-03-18 16:37:20 -04:00
Steve Howell b2be16c4d0 node tests: Use clean BuddyList instance in tests.
As part of this, we inline one function call rather
than changing it to have buddy_list be passed in.
2021-03-18 16:37:20 -04:00
Megamind e6ee1b0760
recent typos: Fix incorrect aria-label of mute (should be unmute). 2021-03-18 10:13:25 -07:00
100RABHpy 62676e5a3d encoding: Reduce the number of replace calls while encoding URL.
We are making two calls to replace function while encoding
URL. But we can optimize it to make only one.
2021-03-18 10:12:08 -07:00
YashRE42 e268debdc6 minor: Fix mention of success handler in error wrapper. 2021-03-18 10:09:22 -07:00
Signior-X 10e6ccc3a1 refractor: Created set_calculated_message_container_variables function.
This commit takes the blocks of code from "build_message_groups" that are the
same as "_rerender_message", and move those into a function called
"set_calculated_message_container_variables". This helps to avoid bugs in
future as in #17663. Like timestr was being updated in one of them, but needed
in both. So, it takes care that message variables are correctly set.

Part of #17663
2021-03-17 17:21:42 -07:00
Signior-X 0487503cc4 message view: Fix the wrong time shown for message locally echoed.
This commit updates the _rerender_message to update the message_time
string with the current timestamp on the message rerender.

When we locally echo a message, we store a local timestamp that will
generally not be used as it is replaced by the server time in
echo.process_from_server when we confirm receipt of the message.

echo.process_from_server correctly updates the .timestamp field on
the message and triggers a rerender but that rerender reuses
the message_container object without recomputing the
message_container.timestr due to which wrong older timestr was shown
on the message box.

This commit fix this by calling set_timestr in the rerender code path,
alongside calls to update similar data structures like
this._maybe_format_me_message.

Fixes #17655
2021-03-17 17:21:42 -07:00
yasiruRathnayaka97 2d414fa897
left-sidebar: Fix 3-points-menu responsive bug.
In responsive narrow windows where the left sidebar is an overlay, clicking the \vdots menus for  
'All messages' and 'Starred messages' would result in the navigation closing and the menu appearing
somewhere weird.

We fix this the same way that we address this issue with the similar stream/topic menus, by calling
the function to show this sidebar after closing all popovers.

Fixes: #17537.
2021-03-17 15:11:23 -07:00
Nikhil Maske d9776159f1 account_settings: Change the position of the custom-profile-fields-form.
The custom-profile-fields-form element custom_user_field contains
the textarea for Biography that expands. The textarea treats the
user-avatar-section as an disturbing obstacle when expanded beyond
the certain width. To fix this, the custom-profile-fields-form
is placed out from the account-settings-form.

Fixes #17617.
2021-03-17 12:25:12 -07:00
Anders Kaseorg 3ef6f6e2e2 js: Convert static/js/blueslip.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-17 08:47:15 -04:00
100RABHpy 039dd256a1 markdown: Fix a bug in query_and_reply.
Fixes #17466
This commit will change encoding logic. Initial logic
was not encoding parenthesis, and this creates conflicts
with the markdown link format. To resolve this while encoding,
we're now replacing parenthesis with ".28" and ".29."

There is no need to change decoding logic because before
decoding any URL, we first convert all the “.” to “%.”

optimization: No need to replace parenthesis in popovers.js.
2021-03-16 16:40:37 -07:00
Aman Agrawal f79a59d5f8 recent_topics: Directly pass jquery element instead of event object. 2021-03-16 14:54:22 -07:00
Aman Agrawal 493c00f2ad recent_topics: Set focus to element on click.
The scroll position of recent topics table is according to the
element which is in focus.

While this behaviour is correct, when
user clicks on an element in recent topics after scrolling to
a different position, the scroll position is lost as the focus
was not being set on the element. This commit ensures that
we set focus on the element when user clicks on it. Thus, the
scroll position being lost is naturally fixed.

Fixes #17587
2021-03-16 14:54:22 -07:00
Aman Agrawal 16a7753390 click_handlers: Extract function to mute topic. 2021-03-16 14:54:22 -07:00
pilgrim2308 2495f4498b recent_topic: Add role and area properties according to MDN docs.
Add role and area properties to recent topics filter buttons.
2021-03-16 14:54:22 -07:00
pilgrim2308 2cc96d981e recent_topics: Go to stream narrow on stream cell click.
Increase clickable area in recent topics stream cell to imporove
UX.
2021-03-16 14:54:22 -07:00
Gaurav Pandey 7ddf6435a9 left-sidebar: Remove add-streams option out of scrollbar.
This commit removes the option to add more streams out of scrollbar
as it is not visible on mobile devices or organizations with large number of
streams until scrolled down.
2021-03-16 14:10:04 -07:00
Steve Howell 15d99f87fb node tests: Clear more data for typeahead_helper.
We also use a more realistic method of setting
recipient counts, and we make the pm count test
a bit more explicit.
2021-03-16 09:04:26 -04:00
Steve Howell e9e8bcd26e node tests: Add popovers.clear_for_testing(). 2021-03-16 09:04:26 -04:00
Abhijeet Prasad Bodas 2ea330b025 linkifier settings: Remove loading indicator.
There is no element on the settings page with
id="admin_page_filters_loading_indicator", so
the indicator doesn't appear. And even if we make
a div for an indicator, it would be hardly visible,
because we don't call the server to fetch linkifiers
in this page, and there generally won't be too many
linkifiers to render.
2021-03-15 11:19:59 -07:00
Abhijeet Prasad Bodas 0acfbc385b linkifier settings: Fix empty list message not shown.
Previously, if there weren't any linkifiers set, only
non-admins could see the "No linkifiers set." message
below the list header. We do not hide the linkifiers
(when there are some of them) from non-admins, so there
seems to be no reason hide the above message when there
aren't any linkifiers.
2021-03-15 11:19:59 -07:00
Abhijeet Prasad Bodas 9223dced3b refactor: Rename filter to linkifier in frontend code and docs.
This only leaves `page_params.realm_filters`, which
will be changed in further commits along with the
API change.
2021-03-15 11:19:59 -07:00
tushar912 c6d1fbd051 settings: Fix input mouse behaviour in custom profile fields.
Add input to filter in sortablejs config. This prevents drag
and drog from being called on clicking input field. Also
set preventOnFilter to false. This prevents disabling the
default behaviour on the click event.

Fixes #17619
2021-03-15 11:11:47 -07:00
Steve Howell ece986bd10 node tests: Clear data for sort_recipients. 2021-03-15 13:05:49 -04:00
Steve Howell d7d357f61e node tests: Add test_all() wrapper for widgetize.
I also move around a couple set_global/mock_esm
calls.
2021-03-15 13:05:49 -04:00
Steve Howell 09bad82131 node tests: Add test() wrapper for typing_data. 2021-03-15 13:05:49 -04:00
YashRE42 1247b4f341 hotkeys: Deduplicate popover event calls.
This enables us to only have one block with all the calls instead of
duplicating the enter case.
2021-03-14 23:10:51 -07:00
YashRE42 b15f5c7214 hotkey: Add "enter" support for user info popover from message.
Previously we could navigate the user info popover on messages by
using the up/down arrow keys, but we could not use the enter key to
select an item, this commit fixes the bug.

Fixes: #17589.
2021-03-14 23:06:31 -07:00
Nikhil Maske f5544e36ed markdown: Add fa-clock icon before markdown timestamps.
These sigils will help make it easier to see that this is a special
Zulip syntax feature, not just something the other user typed, which
might help set the expectation that we're showing the time in the
user's timezone.

Tweaked by tabbott to improve variable/template naming.
2021-03-14 22:57:01 -07:00
Harsh Srivastava cd1601a858
left sidebar: Fix exception when deleting last stream.
Apparently, we never tested the unlikely behavior of deleting the last stream,
and doing so would result in exceptions being thrown (and thus no UI update).

Fixes: #16691
2021-03-14 22:34:07 -07:00
Tim Abbott e1aa7dd882 portico: Fix line-wrapping of bulleted lists with 2-digit numbers.
As demonstrated with the recent Zabbix integration, our line-wrapping
of numbered lists was busted in the presence of 2-digit numbers of steps.

Fixes #17634.
2021-03-14 19:36:29 -07:00
Anders Kaseorg 32df287818 ready: Wait for other ready callbacks before marking app loaded.
This is needed not because the DOM isn’t ready here (we’re in a
<script defer>), but because we want to wait an asynchronous tick
until after all the other callbacks that waited an asynchronous tick
for the DOM to be ready.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-14 17:36:22 -07:00
Steve Howell bbe12a3967 node tests: Ensure clean data for timerender tests.
We explicitly initialize things that future tests
could possibly mutate.
2021-03-14 11:38:21 -04:00
Steve Howell 92e611a787 node tests: Add test() wrapper for lightbox. 2021-03-14 10:46:45 -04:00
Steve Howell ae6c435bb4 node tests: Clean up hashchange tests.
* use override
* localize window_stub
* add clear_for_testing() helper
2021-03-14 08:11:25 -04:00
Steve Howell 85bd196bfc node tests: Add test() wrapper to bot_data. 2021-03-14 08:11:25 -04:00
Steve Howell fbd3669461 zjsunit: Do not run $(...) automatically.
We have generally gone away from using $(...)
initialization in modules that we test with
zjsunit, but there are a few remaining special
cases related to our billing and portico
codebases.
2021-03-13 11:48:50 -05:00
Steve Howell bc8647539c code cleanup: Remove obsolete stream_sort code.
I remove an obsolete comment--we use get_streams()
for the `n` key now.

I also remove a guard statement from sort_groups()
that returned `undefined` for empty lists.

That guard statement would break this code:

    const stream_groups = stream_sort.sort_groups(streams, get_search_term());

    if (stream_groups.same_as_before && ...

The calling code prevents the situation anyway:

    const streams = stream_data.subscribed_stream_ids();
    if (streams.length === 0) {
        return;
    }

I modify the "no_subscribed_streams" test to test
the new behavior.  (Even though stream_list currently
short-circuits the call here, that may change in the future.)

I also introduce the test() wrapper to explicitly clear
our data.
2021-03-13 11:48:50 -05:00
Aman Agrawal d8af33d24e recent_topics: Don't switch focus to input on `k` / `j` keypress.
Don't focus on search box when user is at end or start of
the table and is using vim keys. This ends up being a
bad UX as once user is inside the search box, vim
navigation keys cannot be used to take user out of
the search box.
2021-03-13 05:43:24 -05:00
Steve Howell 154daf353b node tests: Add test() wrapper for suggestions. 2021-03-12 15:29:23 -05:00
Anders Kaseorg ea9ca6b7d0 js: Use jQuery as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-12 10:08:25 -08:00
Anders Kaseorg 92a46888f0 node_tests: Mock sortablejs to avoid __Rewire__.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-12 10:06:34 -08:00
Steve Howell 87a3650176 node tests: Clean up recent_senders test.
This introduces the make_stream_message()
helper to avoid all the strange
`messages[0] === message1` confusion.

We also clear data explicitly at the beginning
of the test.

It's still a messy test.
2021-03-12 11:18:44 -05:00
Steve Howell f5506c78aa node tests: Clear data for presence tests.
I considered using set_info({}, 0) to clear data,
but it has a lot of machinery that could lead
to accidental line coverage and/or extra test
complexity.
2021-03-12 11:18:44 -05:00
Steve Howell bbf529f2a5 node tests: Clear data for pm_list tests. 2021-03-12 11:18:44 -05:00
Steve Howell 67a5fe95dc minor: Remove empty pm_list.initialize().
The commit 3cfc3ca24b
made this function do nothing, but I guess that
we thought we might resurrect the click handler
in the short term.  We never did.
2021-03-12 11:18:44 -05:00
m-e-l-u-h-a-n e781136acd css: Add separate class for typeahead items with no presence circle.
This commit adds a new class for typeahead items that do not need
a presence circle. It is changed to support addition of new items
that do not require presence circle.

There should not be any visual change due to this.
2021-03-12 02:10:21 -08:00
m-e-l-u-h-a-n 629aeced16 compose: Remove presence circles for wildcard users.
This commit removes presence circles for special users like
all, stream, and everyone. This was discussed at
 #design>Presence circles in typeahead, and this was justified
as presence circles for these special users will always be grey
circle and do not convey any information about presence of anyone.
2021-03-12 02:10:21 -08:00
m-e-l-u-h-a-n cd0d3347ab compose: Fix spacing of presence circles in typeahead.
This commit increases spacing between presence circles and user avatar
in typeahead suggestions.
These changes were discussed in #design>Presence.
2021-03-12 02:10:21 -08:00
Steve Howell 71ccb99531 node tests: Clean up pm_conversations.
* Hoist zrequire("people") to the top.
    * Add clear_for_testing() hook.
    * Add initialize_recents() helper.
2021-03-12 04:42:37 -05:00
Anders Kaseorg 7f30e5f9df info_overlay: Render Markdown help with frontend Markdown library.
Fixes #15375.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-11 21:24:39 -08:00
Tushar912 dc67870e0c avatar: Add confirmation dialog before deleting profile picture.
Use confirm_dialog here as this change is destructive and thus not
easy to undo.

We may want to consider using settings_ui.do_settings_change()
instead.

Fixes #17073.
2021-03-11 19:58:38 -08:00
Tushar912 cda3da18f4 settings: Refactor check_profile_incomplete.
Split the logic of check_profile_incomplete into two functions
show_profile_incomplete and check_profile_incomplete.

The latter is passed to the former which shows the message if the
profile is incomplete.
2021-03-11 19:55:29 -08:00
Tushar912 432751c319 settings: Improve check for incomplete org profile.
Use a regex to check for the pattern "Organization
imported from ..." instead of the previous approach
where we just checked if pattern startswith "Organiztion
imported from".

This allows users to extend the description from the original
"Organization imported from Slack." with a few extra sentences without
this warning remaining indefinitely.

Fixes #17463
2021-03-11 19:54:46 -08:00
Aman Agrawal e587c029f6 display_settings: Allow user to set default_view.
TextField is used to allow users to set long stream + topic narrow
names in the urls.

We currently restrict users to only set "all_messages" and
"recent_topics" as narrows.

This commit achieves 3 things:
* Removes recent topics as the default view which loads when
  hash is empty.
* Loads default_view when hash is empty.
* Loads default_view on pressing escape key when it is unhandled by
  other present UI elements.

NOTE: After this commit loading zulip with an empty hash will
automatically set hash to default_view.  Ideally, we'd just display
the default view without a hash, but that involves extra complexity.

One exception is when user is trying to load an overlay directly,
i.e. zulip is loaded with an overlay hash. In this case,
we render recent topics is background irrespective of default_view.

We consider this last detail to be a bug not important enough to block
adding this setting.
2021-03-11 18:09:08 -08:00
Aman Agrawal 709fbe5c0a recent_topics: Return false when escape is unhandled.
When user presses escape but there is no action that recent topics
can perform on it, it returns false.

The final state of focus is the focus on topics table. If the focus
is on table and not on RT search or filters, we return false to
indicate that the key was unhandled by recent topics.

This will allow escape to take user to another view if recent topics
is not the default view.
2021-03-11 17:53:36 -08:00
Steve Howell a4ab6065cd node tests: Clear data for peer_data tests. 2021-03-10 07:07:34 -05:00
Steve Howell dd7420ff11 minor: Don't export unread_topic_counter.
The only places we called it now use the
helper function.

In passing I move another const to the top
of the file.
2021-03-10 07:07:34 -05:00
Steve Howell 4621e54059 node tests: Clear data for message_store tests. 2021-03-10 07:07:34 -05:00
Steve Howell c6dc9e9014 refactor: Remove message_store.each helper. 2021-03-10 07:07:34 -05:00
Anders Kaseorg 6540285a9c channel: Sever dependency on reload.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-09 17:43:07 -08:00
Steve Howell 8c6469314b node tests: Avoid intra-test leaks in buddy_data. 2021-03-08 10:45:17 -05:00
Steve Howell ab34f63ad5 node tests: Clear pending channel requests. 2021-03-08 10:45:17 -05:00
Steve Howell 7cf62cd6b1 node tests: Avoid __Rewire__ for clipboard API. 2021-03-06 14:33:30 -05:00
Steve Howell 8006c29748 node tests: Extract create_sortable for testing. 2021-03-06 11:10:57 -05:00
Josh Gilley de74d2fd7c settings: Use HTML table for "Alert Words" for better icon alignment.
"Alert Words" is one of Zulip's oldest settings UI elements, and as a
result is buggy.  This commit converts it to use our standard
progressive-table-wrapper system used for settings tables, which has
the side effect of fixing a bug that mad ethe tables look pretty bad
if one adds a very long word.

Fixes #17172.
2021-03-05 14:38:56 -08:00
Steve Howell f6edaaab96 node tests: Test upload.feature_check directly. 2021-03-05 12:57:20 -05:00
Anders Kaseorg 62532777b1 server_events: Replace deprecated $.now alias.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 18:07:47 -08:00
Anders Kaseorg 4a3d66f776 setup: Remove unused $.fn.within.
It’s unused since commit 805ac2475b
(#14162).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 18:04:14 -08:00
smit_patel fb8d18caf8 compose: Fix alignment of Drafts button.
Fixes #17095.
2021-03-04 17:33:01 -08:00
Ganesh Pawar 3dbbbb04f8 message_list_view: Remove duplicate comment.
The comment and the conditional check is already present at the
start of the function.

This seems to have been introduced in
a9235a74f4, back in 2014.
2021-03-04 17:17:12 -08:00
m-e-l-u-h-a-n f4a111e314 compose: Add user presence circles in mention and pm typeahead.
This commit addresses the problem of user's status visibility to
some extent. It adds presence circles, like we have in buddy_list to the
typeahead suggestions that are given for mentioning users in messages.

Tweaked by tabbott to adjust vertical alignment of group mentions as well.

Testing for the changes is done manually in the developement server,
and also by updating frontend tests to address these changes.

Fixes: #17138
2021-03-04 17:06:02 -08:00
Tim Abbott 7def3e7832 css: Fix vertical alignment of mention typeahead.
Somehow the previous styling was oddly off-center.
2021-03-04 17:05:04 -08:00
pilgrim2308 ec88ba38a9 UI: Fix redundant condense message appearing in edit message menu.
Added the handler functions which were previously missing
for when a user tries to edit/view source of a message
after expanding it.

Fixes #17478
2021-03-04 15:28:17 -08:00
Gaurav Pandey 3dcf97bf27 tooltip: Hide tooltip for touch events on touch-enabled devices.
Fixes #16674.
The commit hides the tooltip for touch events on touch enabled device.

Touch events trigger both click and hover action,
leaving the hover action sustained until next click.

Hence it is better to hide the tooltip to avoid the clutter in UI.
2021-03-04 12:32:16 -08:00
Anders Kaseorg e271936aae logos: Optimize jotform.svg with svgo 2.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 12:24:25 -08:00
Gaurav Pandey 3d7462a0e7 integration: Add jotform integration.
Fixes #16554
2021-03-04 11:40:58 -08:00
Anders Kaseorg 63eae63a07 timerender: Fix comparison of Date objects.
This === comparison between two Date objects added by commit
9896782fd1 (#17220) always returned
false, so the body of timerender was running every minute instead of
every day.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 11:04:54 -08:00
Anders Kaseorg 23b589cce3 timerender: Do not duplicate entries of update_list!!
Commit 13915740bb (#5199) added a loop
in update_timestamps that appended an entry to update_list once for
each element that its className matched.  If there were two such
elements, this would double the length of update_list each time the
body of update_timestamps ran.  So let’s not do that.

Also fix the incorrect elements !== null check from the same commit.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 11:04:54 -08:00
Gaurav Pandey a3561c15d2 invites: Remove odd box-shadow for invite link clipboard svg. 2021-03-03 21:57:41 -08:00
Anders Kaseorg 9613c66560 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-03 21:46:42 -08:00
Aryan Shridhar bfefec31f4 Revert "edit_bot: Fixed dropdown username capitalization."
This reverts commit ea02d48e81.
2021-03-03 23:58:50 +05:30
Aryan Shridhar d1198c46c5 Revert "frontend: Fixed broken label tag and removed label expression."
This reverts commit 17bae43052.
2021-03-03 23:58:50 +05:30
Steve Howell b1a871f2e0 node tests: Avoid reset_module for recent_topics. 2021-03-03 07:08:51 -05:00
Anders Kaseorg a58e832884 eslint: Remove unneeded globals.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 099e8fb00e js: Convert static/js/settings_profile_fields.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 7ec8b8980f js: Convert static/js/dropdown_list_widget.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 9e613b1487 js: Convert static/js/message_events.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg d8c793f791 js: Convert static/js/composebox_typeahead.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 5cc1f8d289 js: Convert static/js/ui.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 8dbaf2d680 js: Convert static/js/subs.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 0e90f3be6d js: Convert static/js/compose_actions.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg e74598da17 js: Convert static/js/narrow.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 7a67c06581 js: Convert static/js/message_list.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 68872f44f6 js: Convert static/js/widgetize.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 3e8ddc229b js: Convert static/js/stream_list.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 727208b84c js: Convert static/js/unread.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 9997e13032 js: Convert static/js/unread_ops.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 7ec3fc38fa js: Convert static/js/input_pill.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg ac4e293da5 settings_profile_fields: Use named export from sortablejs.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg 4a2f937732 narrow: Add setter for narrow_title.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg b38712d8d2 js: Convert residual require() calls to import in ES6 modules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00