Commit Graph

8352 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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