Commit Graph

12512 Commits

Author SHA1 Message Date
Signior-X 3bdc7432b9 refactor: Move wrap_text_with_markdown into compose_ui.js.
This commit makes it possible to use wrap_text_with_markdown_outside
compose.js.

Part of #18692
2021-07-06 17:55:58 -07:00
Tim Abbott 2cb1be096e ui_init: Fix order of realm_logo rendering.
This needs to run after the navbar has been initialized.  Bug caught
by our puppeteer tests.
2021-07-06 17:51:00 -07:00
aryanshridhar c6828767fa navbar: Migrate to handlebars.
This commit migrates the `navbar.html` Django template
to handlebars by creating a new file as `navbar.hbs`
within `/static/templates` which is then rendered
using `ui_init` module.

As a part of migration, we also remove the `search_pills_enabled`
and `embedded` parameters from the context attribute as they
are no longer needed now.

Fixes part of #18792.
2021-07-06 16:46:50 -07:00
Priyansh Garg 3294e8dbe0 compose-box: Insert quoted content at the cursor position.
Right now, on clicking `quote and reply` on any message, the quoted
message is always inserted at the top of compose-box irrespective of
the current cursor position. Also, after insertion of the quoted
message, the cursor is shifted at the end of the compose box.

This commit changes this behaviour to insertion of quoted message
at the current cursor position with a newline at the end of quote
and moving the cursor position to that newline after insertion.
A newline is added at the beginning of quoted message only if there
was some content already present in compose box before the previous
cursor position.

Tested on Google Chrome and Firefox browsers on Ubuntu dev environment.

Fixes: #16836
2021-07-06 16:38:17 -07:00
akshatdalton ea4587071a tooltip: Improve tooltip placement for search users icon in right sidebar.
Similar to the previous commit, the tooltip was not
completely visible in this case and this bug was
similar to the one corrected in recipient bar icons.
2021-07-06 15:26:53 -07:00
akshatdalton d693b77f49 tooltip: Improve tooltip placement for User sidebar title.
Here, the tooltip was partially visible. This bug was similar
to the one that is corrected for recipient bar icons.

I have removed the class attribute `tippy-zulip-tooltip`
for Filter stream title as this will be handled by the
new changes.
2021-07-06 15:26:53 -07:00
sahil839 8fe401c38c confirm_dialog: Rename confirm_dialog_yes_button class.
This commit renames confirm_dialog_yes_button class to
confirm_dialog_submit_button. This will help in keeping
a general class name when deduplicating the code for
confirm_dialog and edit_fields_modal.
2021-07-06 15:15:50 -07:00
sahil839 055d7113f2 confirm_dialog: Rename html_yes_button to html_submit_button.
This commit renames the html_yes_button parameter of confirm
dialog widget to html_submit_button and also all the related
variables in confirm_dialog.js.
This will help in keeping a general name when deduplicating
the code for confirm_dialog and edit_fields_modal.
2021-07-06 15:15:50 -07:00
sahil839 eaf69bbf16 edit_fields_modal: Show error message in the body not heading.
Placing error message at the top of the body looks better than
placing it below the heading.
2021-07-06 15:15:50 -07:00
sahil839 0ebcb17397 confirm_dialog: Change the style and position of error message element.
This commit changes the error message element of confirm_dialog to be
above the text of dialog and to be a nice box using already defined
"alert" class.
2021-07-06 15:15:50 -07:00
sahil839 19362f393e edit_fields_modal: Rename modal_body_html and modal_label.
This commit renames modal_body_html and modal_label to
html_body and html_heading respectively. This change
will help us easily deduplicating the confirm_dialog
and edit_fields_modal code.
2021-07-06 15:15:50 -07:00
sahil839 0edb413121 css: Remove unused css.
This was missed in 98bb0f7b2.
2021-07-06 15:15:50 -07:00
Priyam Seth ba44f4161a compose: Make a function to hide compose error.
This commit creates compose_error.hide() function that
can be used to hide compose_error alerts.
2021-07-06 15:15:26 -07:00
Tim Abbott fc0035f050 portico: Stop using 0.5 opacity for documentation titles.
opacity 0.5 is pretty hard to read.
2021-07-06 10:37:44 -07:00
Eeshan Garg 5a94bfcb88 docs: Add proper backlink to the homepage from /help and /api.
Currently, the "Home" link at the top takes one to the doc root,
i.e., /help or /api. This is a little misleading since "Home"
seems to be more synonymous with the Zulip homepage.

This commit adds a proper backlink to the top logo that takes you to
the homepage and renames "Home" to be more specific. The text after
"|" will now take you to the doc root instead (/help or /api). Note
that this allows us to link the /help and /api pages from the
homepage while ensuring that backlinks allow the visitor to get back
to the homepage.
2021-07-06 10:35:41 -07:00
Aman Agrawal 17eed06eb1 message_view_header: Don't include stream name is tooltip.
This fixes the bug where stream name overflows out of the tooltip
background.
2021-07-06 08:41:44 -07:00
Wesley Aptekar-Cassels 187737ce5a message_body: Rename "Condense" to "Show less".
See discussion on CZO:
https://chat.zulip.org/#narrow/stream/137-feedback/topic/.22Condense.22.20vs.20.22Collapse.22
2021-07-05 20:15:14 -07:00
Priyam Seth 57340a888c compose: Extract "compose_validate.js".
This commit first moves the compose.validate() function out
with the functions that are needed by it. Then one by one
checked for which function is now not needed in compose.js.

This moves all validation related functions out of "compose.js"
to "compose_validate.js".

Splitting compose announce variables out of compose.js.

This commit moves the "user_acknowledged_all_everyone" and
"user_acknowledged_announce" out of compose.js to reduce
cyclic dependency of compose_validate on compose.js.

Moving wildcard mentions to compose_validate.

The wildcard mention settings are mostly used while validating.
Also to reduce the cyclic dependence of compose in
compose_validate, the related wildcard mentions are moved out to
compose_vaidate.js.

This also converts reset_acknowledged functions to set values
by passing values.
2021-07-05 19:21:56 -07:00
aryanshridhar 13399833b0 right_sidebar: Migrate to handlebars.
This commit migrates the `right_sidebar.html` Django template
to handlebars by creating a new file as `right_sidebar.hbs`
which is then rendered using `ui_init` module.

It also removes the tests in `test_home` due to the template
migration, since these elements aren't rendered on the backend
anymore.

We also remove `test_compute_show_invites_and_add_streams*`.

Fixes part of #18792.
2021-07-05 18:58:24 -07:00
aryanshridhar 8fb7ff7637 left_sidebar: Migrate to handlebars.
This commit migrates the `left_sidebar.html` Django template
to handlebars by creating a new file as `left_sidebar.hbs`
which is then rendered using `ui_init` module.

These are the minor changes introduced by virtue of template
migration -
 - The `compute_show_invites_and_add_streams` function now
   only concerns with the invite_to_realm_policy.
 - Renamed the `compute_show_invites_and_add_streams` function
   to `compute_show_invites` due to the above change.
 - Fixes relevant `test_home.py` tests due to the above
   changes.

Fixes part of #18792.
2021-07-05 18:49:43 -07:00
Tim Abbott 65acbfa4c4 navbar: Remove buggy nth-last-child logic.
We've been unhappy with this fragile nth-last-child logic since the
big navbar rewrite a few years ago.

Now that we have TippyJS tooltips in the navbar area, it actually
causes a bug: Hovering the "subscribe count" widget makes the search
icon jump.

Fix this by just adding a CSS class to the two elements that are
intended to be modified by this logic.
2021-07-05 18:20:25 -07:00
Dinesh a7ec1dce0f markdown: Rewrite tooltips for <time> elements.
This now uses TippyJS, which enables a more friendly format.
2021-07-05 18:09:47 -07:00
Dinesh 6ce2662df5 timerender: Extract timezone offset string generation to a function. 2021-07-05 18:08:18 -07:00
Gaurav Pandey 18c546e4b5 left-sidebar: Add support for showing resolve-topic-prefix.
We currently have the resolved topics prefix shown as part of
the topic name in the left sidebar. However this causes inconsistency
while showing topic names. Hence this adds support for showing the
prefix in the cutter to the left of the topic name.

Fixes #18989.
2021-07-05 18:02:40 -07:00
sahil839 d620ad0969 message_edit: Scroll back to original position after closing edit form.
This commit changes the code to scroll to the top after closing the
message edit form to make sure the cursor it at same position and
the scroll does not distract the user when the request of message
edit is processing. Though the scrolling is not visible distinctly
in much case and is visible only when there is some delay, but it
is fine to change this code as the logic is correct and to be on
safer side.
2021-07-05 17:24:28 -07:00
sahil839 8e7ad58557 message_edit: Show loading indicator inside the button.
We now show loading indicator inside the 'save' button
instead of hiding the buttons to show the loading
indicator. Both the save and clear buttons are disabled
when the request is processing. We do not change color
of the buttons just change the cursor to indicate that
button are disabled and nothing happens on clicking them.

The reason for disabling the cancel button is that it
is actually not possible to cancel the action once
loading has started, so it is actually better to disable
it only such that users are not confused.

This commit adds a wrapper div element around the button
because we wanted to add two css properties to the button-
 'pointer-events: none' such that nothing happens on click
and 'cursor: not-allowed' to indicate that buttons are
disabled. But these boht styles cannot be added to same
element because 'pointer-events: none' overrides the
'cursor: not-allowed' style and normal cursor is visible.
That's why we add a wrapper to add 'cursor: not-allowed'
style to it and add 'pointer-events: none' to the button.
2021-07-05 17:24:28 -07:00
Priyank Patel 3f0110d9c0 ts: Convert ui_util module to TypeScript. 2021-07-05 17:04:06 -07:00
Priyank Patel 31893d9e10 ts: Convert components module to TypeScript. 2021-07-05 17:04:06 -07:00
Priyank Patel 4fa4309338 ts: Convert loading module to TypeScript. 2021-07-05 17:04:06 -07:00
Priyank Patel a8cdc968cc ts: Convert csrf module to TypeScript. 2021-07-05 17:04:06 -07:00
Priyank Patel 35738e148b ts: Convert padded_widget module to TypeScript. 2021-07-05 17:04:06 -07:00
Priyank Patel 0aff593ed9 blueslip: Correctly type more_info parameter as optional.
This was incorrectly typed as a required argument before.
2021-07-05 17:04:06 -07:00
akshatdalton f80419509e message_view: Add resolve topic button in message recipient bar.
Now, one can (un)resolve the topic from 2 places:

1. Stream popovers.
2. Message recipient bars.

Fixes: #18988.
2021-07-05 16:53:55 -07:00
akshatdalton 505502a993 tooltips: Use TippyJS instead of HTML title in recipient bars.
Additional changes are added in `tippyjs.js` to ensure
that the tooltip doesn't hide behind the message
box or it is not limited by the parent container, in
case of recipient bar icons.
2021-07-05 16:53:55 -07:00
m-e-l-u-h-a-n c0afe9d8f4 templates: Wrap subscription settings into 3 respective sections.
We wrap the general stream name, description and type properties in
a "general_settings" div.

The "regular_subscription_settings" div was already present, so the
only change made was renaming this to "personal_settings".

We also wrap the email and adding of members settings in a new
"subscriber_settings" div.

This is a prep commit which will be helpful when we want to display
only one section and hide the other two.

Co-authored-by: Ryan Rehman <ryanrehman99@gmail.com>
2021-07-05 14:36:45 -07:00
m-e-l-u-h-a-n 9cb8e1b286 streams: Eliminate content-editable to change stream info.
The current system to change stream information like Stream name and
description isn't consistent with what we use everywhere else. It's
also slightly difficult to maintain.

Co-authored-by: Pragati Agrawal <pragati22066@gmail.com>
2021-07-05 14:35:15 -07:00
Pankaj Patil 88b25d0c21 stream settings: Change icon and tooltip for Archive stream.
Fixes #19049.
2021-07-05 14:34:29 -07:00
sahil839 4875f6d3bb settings: Add status-and-availability help link with presence setting. 2021-07-05 14:27:56 -07:00
sahil839 7eb183fdf7 settings: Move presence-enabled setting to 'Account & privacy'.
The presence setting is more suited in 'Account & privacy'
section as it is not related to notifications in anyway
and resembles privacy of user by allowing user to hide
his status of being online.
2021-07-05 14:27:56 -07:00
Anders Kaseorg 99533b4aa2 js: Fix, and check for, non-ES5 syntax in webpack bundles.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-05 13:32:37 -07:00
Priyam Seth 985e95041d compose: Add trigger for new private message.
This commit adds a new trigger for compose.start that is
"new private message". It will clear the message recipients
whenever compose.start is called with this trigger.

This solves the bug, when a person is in a PM narrow and
clicks the new private message button, it opens the
composebox with the recipients filled out with whoever
you're narrowed to, rather than opening a new, blank PM.

CZO link for the issue
https://chat.zulip.org/#narrow/stream/9-issues/topic/.22New.20private.20message.22.20isn't/near/1222712
2021-07-05 11:56:46 -07:00
Tim Abbott 53e2193b10 narrow: Remove unused import of stream_topic_history. 2021-07-05 10:29:49 -07:00
Tim Abbott a5a958d18a narrow: Narrow to new/empty topics with Ctrl + . shortcut.
This shortcut now renarrows to an empty topic, rather than to the
stream, as long as the topic input is nonempty.

This was debated in the original implementation of this feature:
https://github.com/zulip/zulip/pull/9511#discussion_r190323319

Having seen the experience in practice, the current behavior is
surprising and we should migrate to the other option originally
considered. In particular, the argument that "narrowing to the stream
would still tell you the topic is empty" turns out to be inaccurate,
since the history within the stream may not be in the most recent
messages in the stream.

Fixes #19122.
2021-07-05 09:52:19 -07:00
Wesley Aptekar-Cassels 963b884d74 message_view_header: Make subscription count tooltip open downwards.
This causes it to not cover up the stream description. See CZO thread:
https://chat.zulip.org/#narrow/stream/137-feedback/topic/users.20subscribed.20tooltip.20direction
2021-07-05 08:17:52 -04:00
Dinesh ef5abb3f33 recent_topics_timestamp: Fix tooltip.
d779a1c tweaked `get_full_datetime` to return a string instead
of a {date, time} object. This function is used for recent topics
too but wasn't fixed to use the string.

This resulted in showing 'undefined undefined' in tooltip.
2021-07-03 06:59:55 -04:00
m-e-l-u-h-a-n 63fcc740a8 minor: Make group tab selector in profile modal more specific.
This is just to have a common pattern in stream and group tab.
2021-07-02 13:53:46 -07:00
m-e-l-u-h-a-n a428e546b8 minor: Make stream tab selector in profile modal more specific.
It is changed to avoid having an id that is too generic
and could invite unwanted bugs.
2021-07-02 13:53:46 -07:00
m-e-l-u-h-a-n 5dfd11673a CSS: Fix alignment of private and web-public streams in profile modal. 2021-07-02 13:53:46 -07:00
Priyank Patel cfc2d7c842 util: Remove unused code for lower_bound.
We currently do not need support for passing first and last index to
the lower_bound function, so we just remove it.
2021-07-02 11:37:01 -07:00
Gaurav Pandey 782fca79c4 copy_link: Add onSuccess listener to copy clipboard.
Previously, we showed a `Copied!` alert on copying link to a message
irrespective of the fact that the link was copied or not.
Hence add an event listener that shows the `Copied!` tooltip only
if the action was successful.

Fixes #19019.
2021-07-02 11:33:37 -07:00
Gaurav Pandey b1474ddaa6 copy_message: Add onSuccess listener to copy clipboard.
Previously, we showed a `Copied!` alert on copying a message
irrespective of the fact that the message was copied or not.
Hence add an event listener that shows the `Copied!` tooltip only
if the action was successful.

Fixes #19019.
2021-07-02 11:33:37 -07:00
sahil839 4f6658e98d hashchange: Call highlight_toggle after activate_section_or_default.
If highlight_toggle is called before activate_section_or_default,
then 3 hash change event take place for single hash change.
For example if hash is changed from "#settings/profile" in the
browser to "#organization/organization-permissions", then the
cycle is-
"#settings/profile" -> "#organization/organization-profile" ->
"#organization/organization-permissions".

This is because "highlight_toggle" also leads to call of
"activate_section_or_default" with section as default section
(i.e. organization-profile) then the correct section is opened
again as activate_section_or_default is called in hashchange.js
after highlight_toggle.

The middle hash of the above example depends on the last open
section in organization area or is the default section which is
"organization-profile" when overlay is opened first time after
reload.

This is also consistent with the code for opening overlay from
gear menu where "highlight_toggle" is called later.
2021-07-01 17:49:04 -07:00
sahil839 b5dfc02844 hashchange: Fix bug when directly chaning hash in settings overlay.
Reproducer:
* Open the settings overlay from gear menu, the profile (user profile
not organization profile) is opened.
* Note the current hash in browser is "#settings/profile".
* Now directly change the hash to be "#organization/organization-permissions".

You will notice that the content is fine, but there is problem in left
sidebar and the hash. The left sidebar content is still of user
settings and not organization settings and the hash in the browser is
"#settings/organization-permissions".

Now the bug was due to normal_settings.activate_section_or_default
call instead of org_settings.activate_section_or_default.
Calling from normal_settings leads to hash_prefix being "#settings"
which changes the hash in the browser and also toggles the left
sidebar to display settings part instead of organization. The right
section content is of organization-permissions only because it
depends only on section and not prefix.

So, this commit adds a if-else condition deciding what to call based
on the hash.
2021-07-01 17:48:36 -07:00
Riken Shah ce2821bc28 settings_checkbox: Fix incorrect line wrapping in mobile view.
The issue was text label has `display: inline-block`
property which caused it to go to a new line in smaller
width screens.

This commit fixes it by changing its display property to `inline`.

Fixes #19075.
2021-07-01 17:46:26 -07:00
m-e-l-u-h-a-n ee5aefee32 popovers: Add clear input button to stream search widget.
We show it only when it contains some text in it.

Fixes: #18878.
2021-07-01 14:30:31 -07:00
m-e-l-u-h-a-n 0d3f229283 popovers: Add filter widget for stream list in profile modal. 2021-07-01 14:30:30 -07:00
m-e-l-u-h-a-n 995048c4bc popovers: Add header to stream list in profile popover. 2021-07-01 14:30:06 -07:00
aryanshridhar f41692d032 table-sticky-headers: Add z-index CSS property to table headers.
Previously, there were cases where the table contents started to
overlap with the table heading when scrolled down the table.
This was mostly visible in `Custom Emoji` organization UI,
where the images and action table column contents started to
overlap with the table headers.

Rectified the bug by adding a CSS `z-index` property to
`table-sticky-headers` class which takes care of all
such overlapping issues.

Fixes #18906.
2021-07-01 12:19:53 -07:00
sahil839 8290a6fd8f settings: Fix header in settings overlay.
Previously the header of settings overlay
was 'SETTINGS / {name_of_section}'.

This commit changes it to be one of the two
mentioned below according to the opened
section-
1. 'PERSONAL SETTINGS / {name_of_section}'
2. 'ORGANIZATION SETTINGS / {name_of_section}'

Note - Have kept the header as original in
case of mobile as the above text will be
too long.
2021-07-01 11:47:14 -07:00
sahil839 cdaf9bf87a settings: Change "Settings" to "Personal" in the toggle tab. 2021-07-01 11:47:14 -07:00
sahil839 37620ffef0 gear_menu: Rename "Settings" option to "Personal settings".
Also includes change in markdown used in docs.
2021-07-01 11:47:14 -07:00
Dinesh 239228b317 tippyjs.js: Remove unnecessary `allowHTML: true`.
I accidentally added this while rebasing #18856.

This does no harm but it's best remove code that
isn't helpful in any way.
2021-07-01 11:46:25 -07:00
Dinesh d779a1cf2f timestamp_tooltip: Reformat tooltip content.
Reformats to a format like: 5/19/17, 2:42:53 AM IST (UTC+5.5).
2021-07-01 11:46:25 -07:00
sahil839 ac459b3042 muting_ui: Fix bug with same name of function parameter and a file.
The parameter passed to 'handle_topic_updates' is 'muted_topics'
and there is also a javascript file with same name.
So 'muted_topics.get_muted_topics' gives error, and this commit
fixes this by changing the parametr name to 'muted_topics_list'.

This was introduced in  5f74e78bee.
2021-07-01 08:44:27 -04:00
Tim Abbott 53df9a3958 settings: Move role to profile page.
This feels a bit more consistent with the fact that this field gets
displayed on the user's profile page.
2021-06-30 16:58:37 -07:00
sahil839 687a4ffbb1 settings: Show the date when a user joined the realm in profile panel.
This will also help us to cover up some space when there are no custom
profile fields.
2021-06-30 16:58:22 -07:00
sahil839 b94d6c1a20 settings: Move timezone setting from display settings to profile.
The user timezone is only used for user's profile, so we can
move this setting to the Profile panel of settings and this
will also help us in covering some space when there are no
custom profile fields for the organization.
2021-06-30 16:56:03 -07:00
sahil839 bb816e1998 settings: Separate "Your account" section in two different sections.
We separate "Your account" section to two different sections -
"Profile" section for user name, custom profile fields, and avatar
and "Account & Security" section for email, password, role, api-key
and deactivating button.

Another important change here is that the modal for changing name
is removed and now the name has a simple input text box and it
behaves similar to inputs for custom-profile-fields.

Fixes #18848.
2021-06-30 16:56:03 -07:00
Priyank Patel 5f74e78bee js: Rename muting module to muted_topics. 2021-06-30 16:32:55 -07:00
Priyank Patel 968a8c4e50 js: Split out muted_users module from muting. 2021-06-30 16:32:55 -07:00
Priyank Patel 4dac12144d refactor: Rename variables that conflict with muting modules rename. 2021-06-30 16:32:55 -07:00
Priyank Patel 88b83de5bd muting: Refactor get_time_from_date_muted to util module.
This function will be later needed again when we split the
muted_users module from muting.
2021-06-30 16:32:55 -07:00
m-e-l-u-h-a-n 524f0cc3d3 profile: Add tooltip to hint unsubscription flow for private stream. 2021-06-30 15:17:27 -07:00
m-e-l-u-h-a-n 68700e9599 minor: Keep logic for formatting stream list item at one place. 2021-06-30 15:17:27 -07:00
m-e-l-u-h-a-n c6f8b9d807 profile: Add unsubscribe button in user profile modal.
We add unsubscribe button in the stream list that allows
users and admins to unsubscribe them using profile modal.

If a user attempts to unsubscribe from a private stream
we redirect them to do so from stream setting overlay
to avoid a really confusing user experience as we ask
for confirmation before unsubscribing such streams.
2021-06-30 15:17:26 -07:00
m-e-l-u-h-a-n 2ac5ba0bf8 stream settings: Rename stream_subscription_info for readability.
We rename `stream_subscription_info.hbs` and its related
variables and functions to `stream_subscription_request_info.hbs`.
So that its clear that it is used for displaying info about
requests sent for stream subscriptions.

This is a follow-up for #18957.
2021-06-30 14:54:28 -07:00
sahil839 efa19597bb settings: Show tooltip if avatar changes are disabled.
We show a tooltip besides "Profile picture" heading
to the users who cannot change their avatar explaining
that the avatar changes are disabled in organization.
2021-06-30 15:33:54 +05:30
sahil839 a537ecc587 settings: Fix live update of user-avatar upload widget.
We add disabled prop on buttons only and we add the css for
buttons (and some specific class elements) when disabled as
'cursor: not-allowed' or 'pointer-events: none' which means
the user cannot use these buttons when disabled.

This is not the case for the avatar widget as we use a div
element there and not button and neither those specific
classes which has appropriate styles defined.

We use the avatar image block in two ways - for showing image
and as a clickable target (which is actually a div element)
for uploading, so instead of adding 'disabled' prop we are
hiding (adding display: none) the div such that it is not
visible on hover and also cannot be clicked.
2021-06-30 15:00:51 +05:30
sahil839 d09da692c6 settings: Use switch case instead of if-else for message delete checks.
This is a prep commit for making zero as invalid value for
message_content_delete_limit_seconds, as that change would
add one more else-if and our eslint rules convert such cases
to switch case. Doing this here would keep the diff smaller
in the original commit of making zero as invalid value.
2021-06-29 17:37:53 -07:00
sahil839 6370b00f14 message_edit: Remove unnecessary check for allow_message_deleting.
We do not need to check whether allow_message_deleting is true
when checking for time limit, because we already have a condition
before that returns false if allow_message_deleting=False.
2021-06-29 17:37:52 -07:00
sahil839 4170a2e969 templates: Fix incorrect class name used for tooltips.
Tooltips of message retention and realm deactivation
should have appropriate class as per the setting and
not "realm_allow_message_deleting_tooltip" for all
the different tooltips.
2021-06-29 17:37:52 -07:00
m-e-l-u-h-a-n 4b870e0410 settings (stream): Add function to check if user can unsubscribe others. 2021-06-29 16:50:04 -07:00
m-e-l-u-h-a-n 14f46a831d popovers: Add data-user-id in user profile modal. 2021-06-29 16:50:04 -07:00
m-e-l-u-h-a-n 8070f5e1e2 CSS: Fix border color issue for stream list in profile modal.
This was missed in e10a315efd.
2021-06-29 16:50:04 -07:00
m-e-l-u-h-a-n f0141ee9c1 stream settings: Ignore deactivated user for stream subscription.
We ignore deactivated users when they are being added to streams.
To give current user information about the ignored user ids
we show it along with other details about subscribed and
unsubscribed users.

This partially addresses: #18949.
2021-06-29 16:46:40 -07:00
m-e-l-u-h-a-n a2b50bacee stream settings: Add checks to render `br` tags only when required.
This is required as we added `br` tags irrespective of whether
there were any users in the subscribed or already subscribed
category. This made the spacing here look odd. We now include
br tags inside conditionals to render them only when required.
2021-06-29 16:46:40 -07:00
m-e-l-u-h-a-n ffb811ef6e stream settings: Refactor logic for stream_subscriber_info display.
This refactor helps to avoid code duplication that occurs
if we need to add any extra info to the stream_subscriber_info
and also cleans up code in `add_subscriber_form` and
`.subscriber_list_remove form` handler to make it more readable.

It is preparatory commit to add information about ignored
deactivated users when bulk subscribing users to streams.
2021-06-29 16:46:37 -07:00
sahil839 c8849f8fe3 logo: Compute realm-logo url in frontend only.
This commit fixes the bug of always showing
day-mode realm logo when color scheme display
setting is set to automatic but the OS setting
is dark theme. This is because we cannot check
the OS setting on backend and we need to set
the logo url accordingly in frontend only.
So, we remove the logo url computation from
backend completely and instead compute it in
the frontend only.

Fixes #18778.
2021-06-29 13:42:44 -07:00
Aman Agrawal cb2d95d9ad hashchange: Don't narrow to default_view on `#reload`.
When the hash changes to `#reload...` before a reload, the app tries
to show default_view since there is no `case` handled for it. What we
want to do is ignore this hashchange, since we're about to be reloaded
(so it's not helpful) and if the timing is wrong, it can cause the
browser to reload back to "Recent topics" rather than saving the
user's view.

This fixes a bug introduced in 0e65225d06.

With tests from Riken Shan.
2021-06-29 13:39:01 -07:00
Ganesh Pawar 415159c5b9 user_status: Fix styling of modal. 2021-06-29 11:44:47 -07:00
Tim Abbott 7010777d6c compose: Remove unnecessary 10x margin.
This margin was ignored and will become a liability with future
changes to the compose box HTML.
2021-06-29 11:28:49 -07:00
Priyansh Garg 6cfe10fef2 compose-box: Fix compose-box from covering last messages of stream.
While writing a long message in compose-box, the last few messages of
the current stream gets covered by the compose-box and it gets pretty
annoying sometimes trying to figure out a way to read the last message
of the stream while writing. Right now, the only way to get past this
is to resize `compose-textarea` by using the resize tool at the
bottom-right corner of the `compose-textarea`. But, that small resize
tool is not always readily visible to the user.

The proposed solution in this commit is to reset the `max-height`
property of `#compose-textarea` everytime `bottom_whitespace_height`
is resized such that the total height of `#compose` is always less
than or equal to the height of `bottom_whitespace_height`.  Doing
this, the compose-box never covers the last message of the current
stream.

The only problem with this is that if the compose-box is closed at the
time of bottom-whitespace resize, we cannot find the
`compose_non_textarea_height` and so, we cannot reset the max-height
of `#compose-textarea`. To solve this, max-height of
`compose-textarea` is also reset everytime a new compose-box is opened
according to the value of `bottom_whitespace_height` at that time.

Thus, if the compose-box is already open at the time of
bottom-whitespace resize, the max-height of `#compose-textarea` will
also get reset at the same time, whereas, if the compose-box is closed
at the time of bottom-whitespace resize, the max-height of
`#compose-textarea` won't get reset at that time, but it will surely
get reset whenever the user will open the compose-box.

Tested on my Ubuntu Development Environment on Chrome and Firefox browsers.

Fixes: #16038.
2021-06-29 11:24:01 -07:00
Tim Abbott da596ef269 message_edit: Fix live update bug in left sidebar.
We've had for years a subtle bug, where after editing a topic in the
left sidebar that had previously had unread messages (but doesn't
anymore), the old topic might still appear in the sidebar.

The bug was hard to notice except for new organizations or in the
development environment, because the pre-edit topic appeared with a
sort key of -Infinity (that being the max ID in an empty list of
message IDs). But this is an important onboarding bug in reducing
faith in Zulip's topic editing just working, so I'm glad to have it
fixed.

Fixes #11901.
2021-06-29 10:00:52 -07:00
sahil839 e0fc6df2b4 settings: Fix live update of email change button.
This commit fixes a bug of not enabling/disabling
the email-change button when email_changes_disabled
setting is changed. Bug was because of using wrong
selector.
2021-06-28 22:14:55 -07:00
sahil839 c32a036449 settings: Remove unnecessary code.
The class "name_change_container" is used in the custom
profile fields form.

The name of custom profile field should not be affected
by this setting.

Also confirmed the behavior by testing on master itself,
that these fields are not hidden actually due to this
code being in settings_account itself.

We can also remove the class "name_change_container" as
there is no use of this class elsewhere.
2021-06-28 22:14:49 -07:00
sahil839 0f0e71b3f2 settings: Remove user-name-section from email input.
We handle the css using email-change-form and thus
there is no need for 'user-name-section' class as
this element is used for emails and not user names.
2021-06-28 22:11:24 -07:00
sahil839 e0667a80fe settings: Remove user-name-section class from some elements.
'user-name-section' class is only used to set css for its child
settings-info-icon. This commit removes the 'user-name-section'
class from elements which do not have 'settings-info-icon' as
their child element and also these elements are in not related
to user names.
2021-06-28 22:11:24 -07:00
sahil839 1cb72c77fe settings_users: Rename user-name-form to edit-user-form.
This commit renames user-name-form to edit-user-form as
the modal for which this id is used, is used to edit all
the user properties, not only name.
2021-06-28 22:11:24 -07:00
Steve Howell e311a0ad31 buddy list: Always include "me" in the list.
If a user sets themselves to unavailable, or otherwise
drops out of our presence data, we should still show
them at the top of their own buddy list.

See https://chat.zulip.org/#narrow/stream/137-feedback/topic/Users.20Sidebar/near/1220135
for more context.

I believe this change makes sense as a defensive
fallback, but it's quite possible that we may
want to change the server to record presence info
about users who are "unavailable" and then only
send that info to them (and not their peers).
2021-06-28 16:09:43 -07:00
Tim Abbott e76fd775ba settings: Remove unnecessary ancient table styling.
This effectively reverts d96d4e30ab,
which is a bug that hasn't been present for other reasons due to past
design changes.

It fixes a bug where the "Search operators" page had missing margin
between the table and post-table content..
2021-06-28 09:14:09 -07:00
aryanshridhar 8140a1a6ee info_overlay: Render search operators using info_overlay.
This commits ports the `search_operators.html` file from
./templates to handlebars, essentially creating a new file
as `search_operators.hbs` within /static/templates which is
then rendered using info_overlays.js.

As part of this migration, we rewrote the way internationalization was
done, since the previous implementation incorrectly did not support
languages with a different word order than English.

We also not consistently use periods at the end of the descriptions.

Co-authored-by: Tim Abbott <tabbott@zulip.com>

Fixes #18504.
2021-06-28 09:14:09 -07:00
aryanshridhar 942f4372f0 info_overlay: Render keyboard shortcuts using info_overlay.
This commits ports the `keyboard_shortcuts.html` file from
using the Django template to handlebars, essentially creating
a new file as `keyboard_shortcuts.hbs` within /static/templates
which is then rendered using info_overlays.js.

Fixes part of #18792.
2021-06-27 18:29:52 -07:00
Aman Agrawal 8c1ae1161b tippy: Clarify how to use `tippy-zulip-tooltip` class. 2021-06-27 18:11:34 -07:00
akshatdalton a7681d4a17 message_edit: Extract `toggle_resolve_topic` helper function.
This is a prep commit for #18988. Extracting it here, we
can avoid duplication which helps to avoid future bugs.
2021-06-26 16:42:44 -07:00
akshatdalton d17e5d080c refactor: Extract `RESOLVED_TOPIC_PREFIX` in message_edit.js.
This is a prep commit for #18988. Extracting it here, we
can avoid duplication which helps to avoid future bugs.
2021-06-26 16:40:58 -07:00
Dinesh afe6404167 timerender: Use tippy tooltip for topic header timestamp. 2021-06-25 18:10:42 -07:00
Dinesh 177dd05d0b timestamp: Move tooltip date, time rendering logic to tippyjs.js.
Makes use of `onShow` for all calculations and rendering
of date, time for tooltip.
2021-06-25 18:10:42 -07:00
Dinesh c10e56698c timestamp: Migrate message_time from title to tippyjs tooltip.
This keeps it consistent with other widgets in message body area.

Set the display position to top to be consistent with
compose control buttons.

Changed the tooltip content to be more readable like
Thursday, May 18, 2017
7:12:53 AM India Standard Time

Also changed timerender.get_full_datetime() to consider
users' 24 hour format preference.
2021-06-25 18:10:42 -07:00
Hashir Sarwar d1b18d2c07 compose: Show `compose_error` for deactivated users.
When a user tries to send a (group) private message to a deactivated
user, a compose error is displayed.

Fixes #13766.

Co-authored-by: Signior-X <b19188@students.iitmandi.ac.in>
2021-06-25 18:06:48 -07:00
Hashir Sarwar 130f1d7153 input_pill: Customize pills for deactivated users.
This modifies the appearance of pills for deactivated users
in the following ways:

* Adds `(deactivated)` with the deactivated user's name.
* Add a tooltip to the deactivated user's pill stating
that one can't send a message to this user.
* Color the deactivated user's pill reddish.

This now also adds tests for user_pills.

Part of #13766.

Co-authored-by: Signior-X <b19188@students.iitmandi.ac.in>
2021-06-25 18:06:42 -07:00
Hashir Sarwar 7b9ed4ff2e people: Allow deactivated users pills in compose box.
This commit treats deactivated users as valid users
for compose box which prevents the PM list to collapse
when a deactivated user in the PM list is clicked.

Part of #13766

Co-authored-by: Signior-X <b19188@students.iitmandi.ac.in>
2021-06-25 18:01:15 -07:00
sahil839 5504741239 settings: Remove intentional waiting time in deactivate account request.
The waiting time of 5000ms was probably added for testing UI of
spinner in 2f99e6b7b2 and was missed in review. This commit removes
the waiting time and now the user is deactivated almost instantly when
the button is clicked.
2021-06-25 16:36:41 -07:00
Anders Kaseorg 9518545128 js: Remove ancient IE createTextRange API.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-25 16:34:37 -07:00
Anders Kaseorg fa81ae3aa4 js: Simplify more code using default parameters and destructuring.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-25 16:34:04 -07:00
Ganesh Pawar 166bfa4cf8 user_status: Migrate from overlay to modal.
This also migrates from loading the modal dynamically rather than
statically once at page initialization.

With styling changes by tabbott to preserve the original look of the
UI.

Fixes #18278.
2021-06-25 09:43:55 -07:00
Ganesh Pawar 663743261a recent_topics: Return false in `is_in_focus` if a modal is present.
This prevents a bug where keypresses are received by recent_topics view
even if a modal is present on it, which prevents, for instance, the modal
from receiving text input.
2021-06-25 09:27:03 -07:00
sahil839 0b8b7c4441 settings: Use edit_fields_modal framework for user-info edit modal.
This commit modifies the user-info edit modal to use newly added
edit_fields_modal framework.

Fixes a part of #18417.
2021-06-24 16:55:23 -07:00
sahil839 b04647f219 settings: Use edit_fields_modal framework for linkifier-edit modal.
This commit modifies the linkifier-edit modal to use newly added
edit_fields_modal framework.

One important change is that we remove the "edit-linkifier-status"
element as the corresponding "edit-fields-modal-status" element
is added in edit_fields_modal.hbs and we also modify the css
accordingly. This "edit-fields-modal-status" is used only for
this modal and remains empty for others, so this change does not
cause problems with other modals.

There is another element which uses "edit-linkifier-status" as a
class, but the css we defined was for "edit-linkifier-status" as
id, so the css change is also safe.
2021-06-24 16:55:23 -07:00
sahil839 3da636a20e settings: Use edit_fields_modal framework for admin bot form.
This commit modifies the modal for editing bot information to
use edit_fields_modal framework.

We also change the id of form element of this modal such that
it makes sense with the actual use of modal and there is no
problem with this change as styling of this modal is not
affected.
2021-06-24 16:55:23 -07:00
sahil839 36560da0f0 modals: Add edit_fields_modal.js and edit_field_modals.hbs.
We create a new widget edit_fields_modal such that this common
framework can be used in bot-edit modal, linkifier-edit modal
and user-edit modal, which have very similar implementations.

The "edit-fields-modal-status" is used only for edit-linkifier
modal and remains empty for others, so this change does not
cause problems with other modals.
2021-06-24 16:55:22 -07:00
Dinesh be3b637603 message_view: Make timestamp a permalink to message.
The css edits are to override the `a` tag's default color
with our default values from body, body.night-mode.

Fixes part of #18699.
2021-06-24 16:37:32 -07:00
Priyam Seth 939d8dab7b compose: Extract compose_error.js.
This commit moves the compose_error function to its own module, which
will be useful for future work splitting the compose module.

We also simplify compose_not_subscribed_error to call the
compose_error show function.
2021-06-24 16:19:22 -07:00
sahil839 a14d649444 styles: Fix line-height of delete button of image-upload-widget.
This commit fixes the bug with the delete button of both profile
picture and realm-logo buttons. The button was shifted downwards
and was caused due to line height change in 5d64c21c38.

Found the correct value of 20px by checking the line-height in
one test organization on zulipchat.com where the button position
looks correct.
2021-06-24 14:36:58 -07:00
aryanshridhar ab0db73e62 topic_sidebar: Add support to copy topic link to clipboard.
This commits adds the support to copy a topic link
to the clipboard by introducing a new "Copy link to topic"
topic sidebar action which is placed below the
"Mark all messages as read" action.

Basically, this does the same job as right clicking upon the
topic name and selecting "Copy link".

Closes #18946
2021-06-24 11:26:55 -07:00
sahil839 98bb0f7b28 settings: Show spinner inside the confirm button for confirm_dialog.
We show a spinner inside the button instead of hiding the button
and then showing the spinner in the bottom area. We also disable
the button to avoid repetitive clicking by user.
2021-06-24 09:48:42 -07:00
m-e-l-u-h-a-n c36aa1126c settings (streams): Fix data-dismiss handling for stream creation form.
Click handler added for cancel button in stream creation form
incorrectly assumed data-dismiss to be present only in that
form inside `.subscription`. We now handle editing stream
properties like stream privacy and stream name/description
by making use of modal widget. So this assumption creates
a bug where closing these edit modal closes complete stream
edit pane. It was added in 1886f0a015.

We fix this by binding this handler to data-dismiss element
inside stream creation form.
2021-06-23 17:50:55 -07:00
m-e-l-u-h-a-n a57aa07a6d css: Extract modal related css rules.
Co-authored-by: Pragati Agrawal <pragati22066@gmail.com>
2021-06-23 17:50:55 -07:00
m-e-l-u-h-a-n dfe67d25b5 i18n: Fix translation tags in message_retention_settings. 2021-06-23 17:45:02 -07:00
m-e-l-u-h-a-n 6e5d8e4e90 i18n: Fix translation tags in subscription_stream_privacy modal. 2021-06-23 17:45:02 -07:00
m-e-l-u-h-a-n 152f979e3b streams: Remove dead CSS rule from subscriptions.css.
Co-authored-by: Pragati Agrawal <pragati22066@gmail.com>
2021-06-23 17:45:02 -07:00
m-e-l-u-h-a-n 41dc123cf1 streams: Reorder buttons in button-group to reflect the visual order.
Co-authored-by: Pragati Agrawal <pragati22066@gmail.com>
2021-06-23 17:45:02 -07:00
m-e-l-u-h-a-n 5de115a964 streams: Use consistent settings HTML structure in stream types modal.
We had our input elements for stream settings inside li tags
and their alignment was managed using CSS. We move away from
this HTML structure to have inputs and labels inside divs for
two reasons. First is that if we want to later refactor the HTML
to have some different design, then having them inside `ul`
requires complex changes to CSS and eventually we would have
to move away from using `li`s for the part that is changed to
have a different design. Second `li`s are generally not used
to organize input elements.

Above is an explanation of why this change is a preparatory
commit for shifting to have a tabbed design in the stream edit page.

So following changes are done to have a more consistent
HTML structure in stream types modal:

* Added modal-body and removed the non-standard
usage of the unordered list for settings header and inputs.

* Updated relevant CSS rules to have the same design during refactor.

Co-authored-by: Pragati Agrawal <pragati22066@gmail.com>
2021-06-23 17:45:02 -07:00
m-e-l-u-h-a-n 777f784e07 popovers: Extract user_profile_modal functions in separate module.
We had a lot of functions and click handlers that were only
involved with user profile modal and were not related to
popovers logic in any way. So we extract these functions
into a separate module `user_profile.js`.
2021-06-23 17:43:08 -07:00
Riken Shah 0e65225d06 hashchange: Show default view when the hash is unknown.
Fixes #18870.
2021-06-23 17:41:09 -07:00
Aman Agrawal 48addae20b tippyjs: Fix traceback on reaction tooltip.
It can happen that reactions are re-rendered while we are
in the process of showing tooltip for them. In that case,
we setup MutationObserver for an element not present in DOM
which results in weird behaviour. We avoid it by checking the
element again before setting up MutationObserver for it.

See https://chat.zulip.org/#narrow/stream/6-frontend/topic
/tippy.20bug/near/1206316 for details on the issue.
2021-06-23 12:17:55 -07:00
Anders Kaseorg 5d64c21c38 styles: Globally set font-size and a unitless line-height.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-23 09:10:50 -07:00
Anders Kaseorg 3691805253 styles: Remove invisible .stream_label::before rules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-23 09:10:50 -07:00
Anders Kaseorg cbec20cfdf message_body: Fix -3px alignment kludge using whitespace control.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-23 09:10:50 -07:00
m-e-l-u-h-a-n 6cce478bce popovers: Use keys instead of names for tab navigation in profile modal.
We used name parameter in tab component callback to handle our
custom logic when switching tabs in profile modal. Using name
here invites a posible bug as these name are tagged for
translation. So to avoid this we switch to use key (html id
for these tabs) for this as they are always constant.
2021-06-23 08:08:23 -07:00
m-e-l-u-h-a-n e10a315efd temaplate: Separate stream and user group tabs in user profile modal.
We had stream and group tab inside a common div with class
`subscription-group-list` due to this adding any info
elements like alert boxes that were specific to one of them
became difficult. To fix this we keep them in their own
`.tabcontent` div. This change also makes the handling of
display of different tabs a lot easier and cleans
up unnecessary javascript code that was handling the
display of common parent div of stream and group tab.
2021-06-23 08:08:23 -07:00
m-e-l-u-h-a-n 775b8eb05f template: Correct sequence of stream and group tab.
We show stream tab before user-group tab but in the template
this order was reversed that created confusion while editing
any one of them. So we correct their order in the template
to reflect the order we show in UI.
2021-06-23 08:08:23 -07:00
sahil839 4df22564f4 settings: Use confirm_dialog for deactivating own account modal.
This refactor changes two things - position of the modal, as it
is moved up by some amount because of using confirm_dialog and
also loading spinner of confirm_dialog widget is used.
2021-06-23 08:05:25 -07:00
Aman Agrawal 1295b47e3b navbar_alerts: Don't ask spectator for notifications access. 2021-06-22 17:18:56 -07:00
Aman Agrawal 534d169ead people: Stop queries about current user in web_public_view.
Since we don't have any info on the spectator in web_public_view,
we avoid doing such queries.
2021-06-22 16:56:34 -07:00
Priyank Patel 81e2c3825c js: Export variables instead of setting them on window. 2021-06-22 16:54:03 -07:00
Priyank Patel 043b0c6ef3 ts: Convert spoilers module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel 91573531bb ts: Convert color_data module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel adf83c6eb7 ts: Convert color_class module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel d660f512fa ts: Convert list_util module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel 6ed635b5ed ts: Convert night_mode module to TypeScript. 2021-06-22 09:14:09 -07:00