Commit Graph

8576 Commits

Author SHA1 Message Date
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
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
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 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 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
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 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
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
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 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
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
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
Priyank Patel 31abcaafb8 ts: Convert ready module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel c862c673af ts: Convert blueslip module to TypeScript.
We turn off the eslint no-use-before-define for TypeScript files
because it does not work correctly for types. There is already
a typescript-eslint version of it that is enabled for TS.

We also update the error handler on window to use instanceof check
for ErrorEvent instead of checking the error property.
2021-06-22 09:09:36 -07:00
Priyank Patel f7235912ff ts: Convert ui_report module to TypeScript. 2021-06-22 09:09:36 -07:00
Priyank Patel 8a6f57d750 ts: Convert common module to TypeScript.
We also update the tippy.js mock in tests to expect a element
(zjquery FakeElement function) instead of zjquery instance, and get
rid of setting _tippy property itself to a noop function.
2021-06-22 09:09:36 -07:00
Priyank Patel 9418ae51fa ts: Convert i18n module to TypeScript.
We update our tsconfig target to ES2020 so that we don't get type
errors related to some properties not being in Intl that is used by
@formatjs/intl.
2021-06-22 09:09:36 -07:00
Priyank Patel f1a0a790fe ts: Convert page_params module to TypeScript.
The plan for type annotating the page_params is to set it to
Record<string, unknown> for now and then annotate individual
properties on it as we use it in typescript modules.
2021-06-22 09:09:36 -07:00
Priyank Patel 43da43701b refactor: Use variables to get TypeScript type narrowing.
We also add an explicit undefined check for the these return value
of the Map.get calls. This makes the TypeScript conversion diff
cleaner.
2021-06-22 09:09:36 -07:00
Priyank Patel 2a21f626a7 refactor: Use object destructuring for function parameter.
This make type annotating easier.
2021-06-22 09:09:36 -07:00
Priyank Patel fd45ef57fa ui_report: Do not pass jQuery element to the html method.
Although it works, this feature is not documented.
2021-06-22 09:09:36 -07:00
Priyank Patel 9e08c6db93 ui_report: Correctly check if remove_after is passed.
We use a simpler approach here which is to let it be undefined if
nothing was passed and use that in the if condition. This has two
benefits. There is no edge case where the condition will evaluate to
false if 0 was passed and it is easier to type annotate.
2021-06-22 09:09:36 -07:00
Priyank Patel 5ae523891b ui_report: Use numerical check for request status code. 2021-06-22 09:09:36 -07:00
Priyank Patel 97c8987e02 blueslip: Declare log properties directly on the Logger class.
This makes TypeScript type annotation easier (and maybe looks
cleaner.)
2021-06-22 09:09:36 -07:00
Tim Abbott fcb2f66725 popovers: Show user profile popover for all humans. 2021-06-21 17:16:50 -07:00
aryanshridhar 477a066a4c delete_message: Move and rename the delete_message modal.
Moved the `delete_message` user-confirmation modal to
the `confirm_dialog` folder and renamed the modal to `confirm_delete_message.hbs`
to follow the common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar df556a199a settings_invites: Move and rename the revoke_invite modal.
Moved `revoke_invite` user-confirmation modal to the
`confirm_dialog` folder and renamed the modal to
`confirm_revoke_invite.hbs` to follow the common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar d0c683a8d7 settings_invites: Move and rename the resend_invite modal.
Moved `resend_invite` user-confirmation modal to the
`confirm_dialog` folder and renamed the modal to
to `confirm_resend_invite.hbs` to follow the common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar 83473ba647 settings_emoji: Move and rename the emoji_settings_warning modal.
Moved `emoji_settings_warning` modal to the `confirm_dialog`
folder and renamed the modal to `confirm_emoji_settings_warning.hbs`
to follow the common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar 4549cbe48c settings_users: Move and rename the deactivation_user modal.
Moved `deactivation_user` modal to the `confirm_dialog`
folder within `/static/templates` and renamed the modal to
to `confirm_deactivate_user.hbs` to follow the
common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar c5d65555fa deactivation_stream: Move and rename the deactivation_stream modal.
Moved `deactivation_stream` user-confirmation modal to
the `confirm_dialog` folder and renamed the modal to
`confirm_deactivate_stream.hbs` to follow the common naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar 803a6dd60a deactivate_realm: Move and rename the deactivate_realm modal.
Moved `deactivate_realm` modal to the `confirm_dialog` folder
within `/static/templates` and renamed the modal to
`confirm_deactivate_realm.hbs` to follow the naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar 7fc8d97daa avatar: Move delete_user_avatar_modal to confirm_dialog folder.
Moved `confirm_delete_user_avatar` modal to the `confirm_dialog`
folder.
2021-06-21 10:36:35 -07:00
aryanshridhar 1d5f63564a user_groups: Move confirm_delete_user_modal to confirm_dialog folder.
Moved `confirm_delete_user` modal to the `confirm_dialog`
folder.
2021-06-21 10:36:35 -07:00
aryanshridhar 48a7f95fc8 muting_ui: Move confirm_mute_user modal to confirm_dialog folder.
Moved `confirm_mute_user` modal to `confirm_dialog` folder.
2021-06-21 10:36:35 -07:00
aryanshridhar 3cad4c7837 starred_messages_ui: Move user-confirmation modals to confirm_dialog folder.
Moved `confirm_unstar_all_messages` and `confirm_unstar_all_messages_in_topic`
modals to the `confirm_dialog` folder.
2021-06-21 10:36:35 -07:00
aryanshridhar beab7ea1dc delete_topic: Move and rename the delete_topic modal.
Moved `delete_topic` modal to `confirm_dialog` folder and
renamed the modal to `confirm_delete_topic.hbs`
to follow the confirm_dialog naming conventions.
2021-06-21 10:36:35 -07:00
aryanshridhar 1db2fbcd77 stream_create: Move and rename the subscription_invites_warning modal.
Moved `subscription_invites_warning` modal to `confirm_dialog`
folder and renamed the modal to `confirm_subscription_invites_warning.hbs`
to follow the naming convention.
2021-06-21 10:36:35 -07:00
aryanshridhar db0a69648a subs: Move and rename the unsubscribe_private_stream modal.
Moved `unsubscribe_private_stream` modal to the newly created
`confirm_dialog` folder found within `static/templates`.

Later renamed the modal to `confirm_unsubscribe_private_stream.hbs`
to follow a common naming convention.
2021-06-21 10:36:35 -07:00
Ganesh Pawar d9d7c55006 user_deactivation: Move modal_parent one level up in the DOM.
The user deactivate button is also present in the "Deactivated users"
tab, a sibling element of the current modal_parent, #admin-user-list.
Adding the confirm_dialog modal to #admin-user-list won't have any
effect in the "Deactivated users" tab.
Move it one level up, i.e. to the parent element of #admin-user-list
and #admin-deactivated-users-list.

Fixes #18928.
2021-06-21 10:22:33 -07:00
Ganesh Pawar 777eeb6b8f subs: Update `sub` object with additional properties in update_* functions.
Subsequent function calls require additional properties present
after calling `get_sub_for_settings` on the original sub object.

Fixes #18602
2021-06-20 17:08:16 -07:00
Ganesh Pawar 6392a7122b open_modal: Pass extra arguments as object. 2021-06-20 17:08:16 -07:00
Ganesh Pawar 147cd8a366 message_edit_history: Dynamically load modal rather than statically.
message_history_cancel_btn is shifted down since the modal isn't
present before `show_history` is called.
2021-06-18 18:13:00 -07:00
Ganesh Pawar e73644593c message_edit_history: Move click handlers to message_edit_history.js. 2021-06-18 18:13:00 -07:00
Ganesh Pawar 72b1d3b5a6 deprecated_feature_notice: Make use of autoremove option in open_modal. 2021-06-18 18:13:00 -07:00
Ganesh Pawar 0b769bfcc8 overlays: Add `autoremove` option to `open_modal`.
`autoremove` will remove the modal element from the DOM
once the modal is hidden.
2021-06-18 18:13:00 -07:00
Ganesh Pawar a0e5a82d23 confirm_dialog: Correct documentation regarding loading_spinner. 2021-06-18 18:12:59 -07:00
Tim Abbott 10dcc4ac98 refactor: Use consistent name for RESOLVED_TOPIC_PREFIX. 2021-06-18 17:47:57 -07:00
Tim Abbott bfb6ff44d1 message_edit: Fix unicode encoding of resolve topic check.
We now encode resolved topics with just:

U+2714 HEAVY CHECK MARK, SPACE

Previously, the encoding was unintentionally this:

U+2714 HEAVY CHECK MARK, U+FE0F VARIATION SELECTOR-16, SPACE
2021-06-18 17:46:28 -07:00
Tim Abbott c705b7d5dd popover_menus: Add some comment documentation. 2021-06-18 17:25:45 -07:00
Aman Agrawal fa2825eaa0 popover_menus: Extract common popover properties to be reused. 2021-06-18 17:13:20 -07:00
Aman Agrawal 182f47b7c6 popover_menus: Extract popovers using tippy in a separate module. 2021-06-18 17:13:20 -07:00
Aman Agrawal 563f8aba1e compose_mobile_button: Use tippyjs for popover.
There are several benefits of using tippyjs here:
* Removes dependency on bootstrap.
* We don't have to manually handle show/hide of popover.
* There cannot be any memory leak since we don't store
  the instance.
2021-06-18 17:13:19 -07:00
Aman Agrawal f171b436f3 tippy: Hide stream settings popover on pressing `escape`.
Like all popovers, this behavior should be the same for tippy
popovers too.
2021-06-18 17:12:58 -07:00
Aman Agrawal 7c6fc5dff7 tippyjs: Use `one` instead of `on` to define event handlers.
Since the instance.popper can return same elements as the
instance may be used again by tippy, we use `one` to ensure
that we do not define multiple event handlers for the same element
repeatedly.
2021-06-18 17:12:58 -07:00
Aman Agrawal 444e9cd93f tippyjs: Show popovers on touch.
For tooltips we have set default to only show when pressed for a
small duration. For popovers, we show them on a simple touch.
2021-06-18 17:12:58 -07:00
Tim Abbott 081d74141b overlays: Don't close overlays when drawing selections.
This fixes the following bug:
* Open the streams modal.
* Click and hold in the word "Streams" at the top.
* Move pointer up out of the modal.
* Release.
* Expected: Some text is selected, but nothing else happens.
* Actual: The modal disappears.

We use the same fix we use for this class of issue in other places:
checking for whether a range is selected, and if so, doing nothing.
2021-06-18 17:01:19 -07:00
Tim Abbott a307de95de right sidebar: s/Filter users/Search people/.
We previously had a mix of "Filter users" and "Search people" for this
widget. "Search" is more correct because the right sidebar can only
show a subset of the organization in some settings.
2021-06-18 16:41:37 -07:00
aryanshridhar 8cd9fc7a74 popovers: Close user popover when clicked on stream name.
Earlier, when a user clicked on any stream name from the
user_popover, the stream page would open in the background,
but the user popover wouldn't close.

Fixed it by explicitly binding it to a click handler,
which closes the user popover before redirecting to stream
page.
2021-06-18 16:07:45 -07:00
Tim Abbott 696236b6fc left sidebar: Implement basic resolve topic option.
Fixes part of #18751.
2021-06-18 09:24:48 -07:00
Tim Abbott 639e2eef5e popover: Extract with_first_message_id helper. 2021-06-18 09:24:48 -07:00
m-e-l-u-h-a-n 433452a9b3 streams: Add function to get subscribed streams of a user.
We show only those streams whose subscribers can be seen by
logged-in user in subscribers list in stream edit page.
2021-06-17 17:57:20 -07:00
Tim Abbott 33d2ef67c3 i18n: Fix organization setting for default language.
This fixes a puppeteer failure introduced in
0a1eaf0384.
2021-06-17 17:49:21 -07:00
Tim Abbott 0a1eaf0384 i18n: Reorganize language_list logic.
This reorganization follows our modern coding conventions for avoid
leaving data in page_params that should be owned by a single module.
2021-06-17 17:22:10 -07:00
Gaurav Pandey 8fc3715ea8 settings: Remove language_list_dbl_col from page_params.
The language_list_dbl_col parameter in the page_params
is used by only the web client frontend. The value is
calculated in the backend and then passed as a page_param
which is unnecessary considering that the whole process
is beneficial for the front_end only. Hence move the entire
calculation code to the frontend.

Fixes part of #18673.
2021-06-17 17:02:27 -07:00
Gaurav Pandey 56d85fb833 settings: Remove default_language_name from page_params.
default_language_name was a part of page_params which is actually
redundant considering that we already have language_list and
default_language available to frontend which can be used to
get the default_language_name and hence prevents the backend
from sending an additional parameter.

Fixes part of #18673.
2021-06-17 16:56:21 -07:00
aryanshridhar 2d8fceff5d settings_emoji: Improve error handling for uploading custom emojis.
Previously, there wasn't any error message if a user tries to
upload a custom emoji with a name that already exists.

This commit essentially displays a error using `ui_report`
when the user tries to do so.

Fixes #18269.

Co-authored-by: yasiruRathnayaka97 <yasirurathnayaka97@gmail.com>
2021-06-17 15:53:47 -07:00
aryanshridhar 7227c12ba1 settings_emoji: Replace modal confirmation text to Confirm.
Followup of zulip#17926.
Basically, replaced the modal confirmation text to `Confirm`
to follow a common naming convention.
2021-06-17 15:53:47 -07:00
aryanshridhar e1c0273bd1 settings_emoji: Modify warning model text for a better understanding.
Modified and shortened the `emoji_settings_warning` modal message
to make it easily comprehensible for non-technical users.
2021-06-17 15:53:47 -07:00
Aman Agrawal 3e872b1fa5 timerender: Render past time till 24 hours before showing yesterday.
This avoids the issue of all the topics in recent topics marked
as yesterday after mid-night.

This change also affects other pieces of UI using this function
like buddy list in a similar way.
2021-06-17 15:18:08 -07:00
Gaurav Pandey ba62d2ff8c minor: Remove irrelevant comments in stream_edit.js.
Remove comments in the module stream_edit.js that became
irrelevant after changes in commit 96e035a.
2021-06-16 15:10:06 -07:00
sahil839 38fac6c359 settings: Add moderators and members options in edit_topic_policy.
This commit adds moderators, full members and members options for
edit_topic_policy in both the backend and frontend.
2021-06-16 15:04:29 -07:00
sahil839 828759d2ba models: Replace allow_community_topic_editing with edit_topic_policy.
This commit replaces the allow_community_topic_editing boolean with
integer field edit_topic_policy and includes both frontend and
backend changes.

We also update settings_ui.disable_sub_settings_onchange to not
change the color of label as we did previously when the setting
was a checkbox. But now as the setting is dropdown we keep the
label as it is and we don't do anything with label when disabling
dropdowns. Also, this function was used only here so we can safely
change this.
2021-06-16 14:59:36 -07:00
Aman Agrawal 99cd837421 css: Introduce class which will hide elements for spectators.
`.hidden-for-spectators` class can now be used to hide elements
which should not be visible to spectators.
2021-06-16 10:16:04 -07:00
Aman Agrawal 64f04e9913 web_public_view: Replace `web_public_visitor` with `spectator`.
We use `spectator` term instead of `web_public_visitor` as it is
more concise and better represents this type of users.
2021-06-16 07:46:34 -07:00
Riken Shah b2ab448b71 gear_menu: Extract the gear menu as a handlebars template.
For this extraction, we need to move some context
parameter (from home_real in `views/home.py`) to extra
page_params parameter (of
build_page_params_for_home_page_load in
`lib/home.py`) so handlebars template can access them.

While moving I confirmed that these parameters are not
used elsewhere if some parameter is used elsewhere
(like `apps_page_url`) then I didn't remove it from the
context list, I just added it to the page_params list.

Fixes: #18795.
2021-06-15 12:17:45 -07:00
Riken Shah d2f7aaf6f6 refactor: Rename `enable_marketing_emails_enabled` param of page_params.
This is a prep commit to extract the gear menu as a
handlebars template.

We are renaming `enable_marketing_emails_enabled` to
`corporate_enabled` as it will be also used in the
handlebars template of the gear menu.
2021-06-15 12:05:37 -07:00
Ganesh Pawar 5e4b1e1867 deprecated_feature_notice: Migrate to handlebars. 2021-06-15 11:59:01 -07:00
Ganesh Pawar e3a099d732 deprecated_feature_notice: Move code to a separate module. 2021-06-15 11:58:45 -07:00
Ganesh Pawar 1d4b6c1320 about_zulip: Migrate to handlebars.
This results in moving the `zulip_merge_base` parameter to
page_params, so that it's available to JavaScript.

Since this is technically a tiny overlay, it needs to be initialized
before hashchange.js.
2021-06-15 11:55:20 -07:00
Ganesh Pawar c220c01ad2 user_status: Migrate to handlebars.
We also reorganize the click handlers to live in the main UI file for
the element, and depend less on initialization order.
2021-06-15 11:32:33 -07:00
Ganesh Pawar 8744b42beb message_history: Migrate to handlebars. 2021-06-15 11:31:01 -07:00
Steve Howell ab9c17ed3d minor: Use warn instead of error for widgets. 2021-06-14 17:46:16 -07:00
Steve Howell e98e4b5b02 todo widget: Check types for inbound events. 2021-06-14 17:46:16 -07:00
Steve Howell 99cdfbcbe5 widgets: Clean up index handling.
We only need to bump up indexes if inbound
events suggest that we have incremented our
personal index from another device.

We don't want somebody else's runaway index
to affect our index.

(For both widgets the sender_id is part of
the key, so uniqueness across all senders is
not required for the integer part.)
2021-06-14 17:46:16 -07:00
Steve Howell 91b8049ecf minor: Add permission-related comments to widgets. 2021-06-14 17:46:16 -07:00
Steve Howell 5f73164210 poll widget: Prevent question updates from non-authors.
We now ignore question edits if the sender of the submessage
is not the message author.

The webapp UI prevents folks from editing the question for
somebody else's poll, but a determined person could use our
low level API to do it.  We will add safeguards on the server
side for this, but this change is sufficient to protect the
webapp (and mobile when they upgrade the library).
2021-06-14 17:46:16 -07:00
Steve Howell b62d71cf23 widgets: Check sender of submessage before widgetizing.
We refuse to activate a widget if the first submessage
event doesn't have the same sender as the message's
sender.
2021-06-14 17:46:16 -07:00
sahil839 aa5d2199b1 invite: Use handlebar template for invite-user overlay.
Fixes a part of #18794.
2021-06-14 13:46:57 -07:00
Ganesh Pawar f5f5943ee0 lightbox_overlay: Migrate to handlebars. 2021-06-14 13:41:36 -07:00
Dinesh cde8d095bb tippyjs: Fix blueslip error on popover add emoji reaction hover.
This tippyjs event listener was active on 'add emoji reaction'
option in sender's popover menu of a message but it was only
intended for the add reaction button in message reactions bar
at bottom of a message.

Both of those having common selector `.reaction_button` caused
errors in tippyjs near `observer.observe` having wrong args.

Edited the css selector to be more specific to only target
add reaction button in reactions row of message.

This was introduced in 99e6f25.
2021-06-13 22:31:57 -07:00
m-e-l-u-h-a-n 82394308fd stream-settings: Use util.strcmp instead of localeCompare for sorting. 2021-06-12 08:16:19 -07:00
m-e-l-u-h-a-n dfd37e797f invite.js: Use util.strcmp instead of localeCompare for sorting. 2021-06-12 08:16:19 -07:00
m-e-l-u-h-a-n 712e32805e todo_widget: Use util.strcmp instead of localeCompare for sorting. 2021-06-12 08:16:19 -07:00
m-e-l-u-h-a-n 59143c1d4d stream-edit: Use util.strcmp instead of localeCompare for sorting. 2021-06-12 08:16:19 -07:00
m-e-l-u-h-a-n f1d7971a7f popovers: Use util.strcmp instead of localeCompare for sorting. 2021-06-12 08:16:19 -07:00
m-e-l-u-h-a-n 5ad850f1ff minor: Refactor pill_typeahead.js to use include_users check.
Functions in pill_typeahead.js assumed the type of required pills
to be user by default. But this created several readability
issues with its code, as a result, this codebase appeared
hard to change because of hacky checks involved due to this
assumption.

To improve these we use `include_users` check wherever possible
and simplify the code to clarify the logic involved in typeahead
functions in this module.

Also updated existing stream_edit tests to adjust them with changed
code.
2021-06-12 07:59:43 -07:00
m-e-l-u-h-a-n edeb1bf53b minor: Fix return value and redundant variables in pill_typeahead. 2021-06-12 07:59:43 -07:00
m-e-l-u-h-a-n b080417960 popovers: Add tabs for profile, groups and streams in user_info modal.
Fixes: #16233.

Co-authored-by: Abhirup Pal <abhiruppalmethodist@gmail.com>
2021-06-11 07:56:32 -07:00
Aman Agrawal 448456e4c0 tippy: Hide other popovers when opening a popover like tippy instance.
When we use tippy to open a popover, we should hide other popovers.
2021-06-11 07:42:07 -07:00
Aman Agrawal 88454307cd recent_topics: Split into three modules.
We split recent_topics module into recent_topics_(ui + data + util).

This allows us to reduce cyclical dependencies which were
created due to large list of imports in recent topics. Also, this
refactor on its own makes sense.
2021-06-10 15:53:05 -07:00
m-e-l-u-h-a-n eb1d8b1a96 left-sidebar: Hide clear filter text button if topic filter is empty. 2021-06-10 15:49:34 -07:00
Ganesh Pawar 19fb6114d7 message_edit: Migrate to using `confirm_dialog`. 2021-06-10 12:23:48 -07:00
Ganesh Pawar f9d5dda72c confirm_dialog: Add an error element. 2021-06-10 12:23:47 -07:00
Ganesh Pawar 1afcc98be2 confirm_dialog: Add support for loading spinner. 2021-06-10 12:16:23 -07:00
Ganesh Pawar 4ed643ab8c popovers: Remove `hide_user_profile` from `hide_all_except_sidebars`.
`user-profile-modal` is shown using `overlays.open_overlay` which
disables mouse pointer events. The user can't click anywhere while a
modal is present, except to close it.

We use `hide_all_except_sidebars` and `hide_all` to hide popovers.
But since the user can't interact while a modal is present,
closing it manually is redundant.
2021-06-10 12:16:23 -07:00
Ganesh Pawar fe147757c9 refactor: Migrate Bootstrap modal calls to `overlay` calls.
In d0f8515b50, it was noticed that
Bootstrap's `hide` and `show` calls can cause race conditions.
So, migrate to our `overlay` calls to handle Bootstrap modals.
2021-06-10 12:16:23 -07:00
Ganesh Pawar 6e4735a4e9 confirm_dialog: Make Bootstrap `fade` class optional.
It would be better to load non-setting modals instantly.

This was previously reverted in
7bfa607d0a due to a rebase conflict.
2021-06-10 12:15:55 -07:00
Steve Howell 842b14b916 layout: Introduce a #compose-content div.
This should make it more intuitive to add
new elements to the compose box (such as
banners), and it also makes it a bit more
clear for styling purposes that the same
geometry happens whether the compose box
is open or the buttons are visible.

I lifted the #compose_container div into
the server template.  It's not totally
clear to me why we need both #compose
and #compose_container, but there are
some scary comments about 1400px that
made me too timid to address that quirk.

In passing I removed a clearly redundant
click handler.
2021-06-10 11:22:05 -07:00
Vishnu KS 1938076f67 billing: Enforce license limit for plans on manual license management. 2021-06-09 17:42:38 -07:00
Aman Agrawal 99e6f25c4e tippy: Fix vertical stacking for reaction button during message-fade.
This fixes the same bug in the previous commit for add reaction
button.
2021-06-09 16:38:56 -07:00
Aman Agrawal 3e2b6b52d8 tippy: Fix reaction tooltip placement when message-fade is active.
When message for which tooltip is active has reduced opacity in
an interleaved view due `.message-fade` class being applied to
it, then the tooltip used stack vertically under the recipient_row
which looked awful.

Appending the tooltip to document.body and manually fixing the
bug of tooltip persisting after the reference element is no
longer visible in DOM using MutationObserver does the trick
for us.
2021-06-09 16:38:56 -07:00
Riken Shah 31d85e2d3b navbar_alerts: Move bankruptcy loader msg as step-2 of bankruptcy alert.
This commit also removes the `bankruptcy-loader` class
as it is redundant now.
2021-06-09 12:36:40 -07:00
Riken Shah 9e2573f9c0 navbar_alert: Pass the rendered alert content directly to alert wrapper.
Instead of prepending the alert's content to the
navbar alert wrapper HTML it's better to pass the
rendered alert content as a parameter to the wrapper
template.
2021-06-09 12:36:40 -07:00
Tim Abbott 7bfa607d0a Revert "confirm_dialog: Make Bootstrap `fade` class optional."
This reverts commit 7b4039ade6.

This fails puppeteer tests after being rebased.
2021-06-09 11:01:04 -07:00
Ganesh Pawar 7b4039ade6 confirm_dialog: Make Bootstrap `fade` class optional.
It would be better to load non-setting modals instantly.
2021-06-08 18:07:52 -07:00
Ganesh Pawar 66d8375bfa settings_account: Remove redundant `hide_user_profile()` call.
"hidden.bs.modal" event is triggered once a modal is hidden.
Calling `hide_user_profile` once it's hidden doesn't make sense.
2021-06-08 18:07:52 -07:00
aryanshridhar 281c7da225 settings_org: Refactor realm_deactivation modal to confirm_dialog module.
The realm_name field in the old modal was always empty.
2021-06-08 17:59:47 -07:00
aryanshridhar ef17d0234d stream_edit: Refactor stream_deactivation modal to confirm_dialog module.
The stream_name CSS class in the heading before this change had no
functional effect.
2021-06-08 17:58:04 -07:00
aryanshridhar 418c40b2ea settings_users: Refactor user_deactivation modal to confirm_dialog module.
The "email" span in the old modal was not used for styling, just to
support updating the field visually.
2021-06-08 17:57:27 -07:00
m-e-l-u-h-a-n 3f0ed46fa2 left-sidebar: Add topic filter input in zoomed topic view.
Fixes: #18505.
2021-06-08 15:09:26 -07:00
m-e-l-u-h-a-n 59f8466de3 minor: Move filter logic for stream sort to utils.js.
This is done so that it can be shared by more generally
by different filter widgets used in web-app. An extra parameter
is added to it that helps to get text representation of of items
to be sorted, as items passed to it could be of different format.
2021-06-08 14:58:45 -07:00
Aman Agrawal 8799046f95 subs: Set focus on stream name box when creating a new stream. 2021-06-08 14:55:48 -07:00
Aman Agrawal 9decaeda0a subs: Explicitly show right section when required.
Instead of just depending upon clicks of certain buttons to
show the right section, we also show them when user is
creating a new stream or viewing settings of a specific stream.

This fixes a bug where user lands on `#streams/new` via url change
without clicking of any buttons and sees on left section of the
overlay in medium width (756px) devices.
2021-06-08 14:55:48 -07:00
Aman Agrawal 5dfedcabc3 subs: Extract function to show right section of stream settings. 2021-06-08 14:55:48 -07:00
Aman Agrawal 4b4fdad0e3 left_sidebar: Replace cog icon with plus icon.
We add a popover on click which allows user to create or browse
streams too.

Reason for doing so:

At present, it is hard to discover how to join streams
and create new streams. In particular:

Users have a hard time finding the gear in the STREAMS
header in the left sidebar and realizing that it's relevant for them.
Even once a user is in the STREAMS menu, the Create
stream button is hard to spot.

Fixes #18694.
2021-06-08 14:55:48 -07:00
Anders Kaseorg ad7466a2bf dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-08 10:15:52 -07:00
Anders Kaseorg 656344064a eslint: Fix unicorn/require-array-join-separator.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-08 10:15:52 -07:00
Anders Kaseorg 7fd1e33d1b eslint: Fix unicorn/require-number-to-fixed-digits-argument.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-08 10:15:52 -07:00
Riken Shah ccfee49407 navbar_alerts: Replace HTML template with handlebars architecture.
This moves this block of HTML templates, which are dynamically
rendered with some user data, to be managed by the frontend handlebars
template system.

This migration involves only displaying active alerts in the DOM, and
thus we no longer need navbar_alerts to have display: none by default.
2021-06-07 17:52:08 -07:00
Aman Agrawal 7e814f4877 tippyjs: Add light theme for tippyjs.
This is important for showing popovers/menus with a light background
in Zulip's light theme.

We extend light-theme to show dark colours in night theme.
2021-06-07 14:10:11 -07:00
Ganesh Pawar 2965fec355 modals: Remove `in` class once modal is hidden.
Rapidly clicking a button that shows a modal cause a race condition
in Bootstrap. Specifically, Bootstrap adds an "in" class to a modal
on the "shown" event and removes it on the "hide" event. Frequent clicks
cause the "hide" event to trigger before the "shown" event. Therefore, the
"in" class isn't removed. We use the "in" class to check if a modal is
active in overlays.js

For now, we manually remove it once the modal is hidden.

Newer versions of Bootstrap probably handle this better internally.
Look into removing this once it's upgraded.

Fixes #15463
2021-06-07 13:40:37 -07:00
aryanshridhar 9032d43408 info_overlay: Remove dead code.
In commit 9ce9c2f9db, we added `maybe_show_keyboard_shortcuts`
function which triggered through hotkeys.js when a user
presses the keyboard shortcut hotkey.
However, within commit 8b29c38e62, we migrated to use
hashchange.go_to_location method in order to open info_overlay, leaving the
`maybe_show_keyboard_shortcuts` function orphaned/dead.

This commit essentially removes the dead
`maybe_show_keyboard_shortcuts` code.
2021-06-07 13:37:45 -07:00
Gaurav Pandey 9b696cf212 api: Expose event_queue_longpoll_timeout_seconds in /register.
Rename poll_timeout to event_queue_longpoll_timeout_seconds
and change its value from 90000 ms to 90 sec. Expose its
value in register api response when realm data is fetched.
Bump API_FEATURE_LEVEL to 74.
2021-06-05 07:37:19 -07:00
Riken Shah 38d9e26a6c refactor: Rename `delete_draft_after_send` to `delete_active_draft`.
This commit renames `delete_draft_after_send` to
`delete_active_draft` for two main reasons:

1) This function does the job of deleting the draft that we
are currently using in compose box and it is independent
of the message sending functionality.

2) This is prep refactoring for new drafts behavior where
we delete the draft if the compose box is cleared and
closed.
2021-06-04 09:47:14 -07:00
sahil839 d8c4b96b12 setting: Divide user_invite_restriction into a checkbox and dropdown.
This commit divides the user_invite_restriction setting dropdown to
a checkbox and a dropdown.
The checkbox is used for 'realm_invite_required' setting and dropdown
for 'realm_invite_to_realm_policy'.

This separation of UI elements is fine as these two settings are
separate in database also and also helps in removing excess if-else
conditions and switch cases.
2021-06-03 18:45:29 -07:00
sahil839 a271308ac3 admin: Avoid passing unnecessary policy values to admin_tab.hbs.
We do not require values of realm_create_stream_policy,
realm_invite_to_stream_policy, realm_private_message_policy
and realm_wildcard_mention_policy in the organization settings
templates, as we handle the dropdown values of these settings
in javascript code (settings_org.js) only and these values
are not used anywhere in templates.
2021-06-03 18:45:29 -07:00
sahil839 c09e3fd845 settings_users: Directly use role value in sort_role.
There is no need to write a custom function for sorting
the users table by role since role values are according
to hierarchy of roles already.
2021-06-03 18:45:28 -07:00
sahil839 10e9789179 message_edit: Show save button correctly in message edit form.
Previously the logic to show save button considered only topic
and content edit. This commit fixes it to show the save button
when only stream edit is possible and content and topic edits
are not.

This commit only introduces a simple fix, in long-term we would
want to change the logic of get_editability to include stream
edits as well but it would also require discussion on when to
show the edit icons at different places, so it is better to do
it in a separate commit later.
2021-06-03 17:58:43 -07:00
sahil839 7c7e81e662 message_edit: Rename show_edit_stream to is_stream_editable.
This commit renames show_edit_stream to is_stream_editable
for more clarity.
2021-06-03 17:58:19 -07:00
m-e-l-u-h-a-n fa34f793a7 recent topics: Display other sender names in tooltip.
It is a follow up for #18451.
2021-06-03 14:55:40 -07:00
Tim Abbott 746d3e8dcb presence: Disable 'Idle' for users with idle status.
Previously, we oddly displayed "Last active: Just now" for users in
this situation, which doesn't make any sense.
2021-06-03 14:53:21 -07:00
Tim Abbott 16bd6e6b1d presence: Use consistent logic for displaying last active time.
Previously, we had this complicated layering where the right sidebar
logic would display "Last active: foo" but the user popovers would
just display "foo", which doens't make any sense, since the two
settings have equal context about the string.

We deduplicate that and also arrange that the "Last active:" prefix is
used when it's not clear what we're talking about; i.e. all the values
except for "Active now".
2021-06-03 14:53:21 -07:00
Priyank Patel 2441138a7b settings_orgs: Use button element for save-discard button.
There is no clear reason to not use a button element here. According
to the spec pharasing content, which includes the <span> element,
are allowed in the button element.

Manually tested both buttons to make sure it works and made sure all
the selectors are updated by grepping all the selector classes/id in
the handlebars templates that are parents of the button or are
present on the button.

(One of the jQuery handler code got reformatted due to it fitting
the line limit due to one character deletion for the selector)
2021-06-03 12:41:10 -07:00
Priyank Patel cee94654df minor: Use Array.includes instead of a regex to check for values. 2021-06-03 12:41:10 -07:00
Vishnu KS 5db53029a5 api: Include is_billing_admin as an attribute in user response.
This is sufficiently useful that it should be made available to clients.
2021-06-03 10:27:07 -07:00
akshatdalton b98ad46459 templates: Move edit_bot to settings/.
Since templates for settings UI should be
in `static/templates/settings`.
2021-06-02 20:36:21 -07:00
akshatdalton d48a728fd0 templates: Move bot_avatar_row to settings/.
Since templates for settings UI should be
in `static/templates/settings`.
2021-06-02 20:36:21 -07:00
akshatdalton 55d3090f05 templates: Move uploaded_files_list to settings/.
Since templates for settings UI should be
in `static/templates/settings`.
2021-06-02 20:36:21 -07:00
m-e-l-u-h-a-n a46cb14845 js: Add functions to get user groups by user_id. 2021-06-02 20:06:03 -07:00
aryanshridhar 68111d967a settings_invite: Adjust modal heading for resend_invite modal.
Modified resend_invite modal heading to remove the email
field to avoid it's duplication, since the email feild is
also displayed within the actual modal body.
2021-06-02 17:17:36 -07:00
aryanshridhar 994a965aa5 settings_invite: Refactor resend_invite modal to confirm_dialog module. 2021-06-02 17:17:36 -07:00
aryanshridhar 0e3a305a67 settings_invite: Refactor revoke_invite modal to confirm_dialog module. 2021-06-02 17:17:36 -07:00
aryanshridhar e79acba4dc subscription: Refactor subscription_invite modal to confirm_dialog module. 2021-06-02 17:17:36 -07:00
aryanshridhar 91b83cf09f delete_topic: Refactor delete_topic modal to confirm_dialog module. 2021-06-02 17:17:36 -07:00
Priyank Patel bf179b7d2f composebox_typeahead: Use e.key instead of deprecated e.keyCode.
Tested by the adding a console log to the handlers and typing Tab
and Enter in the group PM and stream compose box. This two event
handlers are attached to form#send_message_form which is the compose
box form.

The tests set keyCode to 42 previously, which does not represent a
valid key, so I assume they were trying to test a random key, and
replace it with "a".
2021-06-02 14:04:53 -07:00
Priyank Patel 37f96e85ff compose: Use event.key instead of deprecated event.keyCode.
There is no functionality change caused by this change. We turn the
event key to lowercase so hotkeys work even when Caps Lock is on as
it did before.

Tested by using the keybinds with and without Caps Lock in compose
box:
 - "Ctrl + B" and "Ctrl + Shift + B",
 - "Ctrl + I", and
 - "Ctrl + Shift + L".

(Also tested that "Ctrl + Shift + I" and "Ctrl + L" do not work.)
2021-06-02 14:04:53 -07:00
Priyank Patel e5005cf4cc input_pill: Use e.key instead of deprecated e.keyCode.
Tested by doing the following in the compose box input for PMs:
  - "Enter" works as expcected with and without input
  - "Backspace" when there is no input deletes the last pill
  - Left arrow in the input focuses last pill
  - Comma works as expected for correct and incorrect input
  - Left arrow, Right arrow and Backspace work correctly for pills.
2021-06-02 14:04:53 -07:00
Priyank Patel 94459f1425 dropdown_list_widget: Use e.key instead of deprecated e.keyCode.
We use e.key for our side of code and still pass e.keyCode and
e.which to the custom jQuery event we trigger. The event is handled
by our patched copy of outdated bootstrap and it still requires the
e.keyCode and e.which properties.

One of the places this widget is used is in the settings panel, at
Manage Organization > Organization Settings > Notifications > New
stream notifications. One of the handler is attached to the
dropdown menu items that shows up when you click the "#announce"
button. The other one is attached to the search button. The second
one triggers the custom jQuery event and passes the event data to
bootstrap unless the Up & Down arrow or Esacape is used. The first
event handler handles the Enter click on one of the items and saves
it. Verified that the widget works as expected.
2021-06-02 14:04:53 -07:00
Priyank Patel 283412a5b8 ui_util: Use e.key instead of deprecated e.which.
Tested by making sure Enter is treated as click at one of the places
this function is used, recent topics view. Using the keyboard to
focus the mute or read button and click Enter treats it like a
click.
2021-06-02 14:04:53 -07:00
Priyank Patel a7a9f3eb92 subs: Use e.key instead of deprecated e.which.
Tested by making sure the "Filter stream" search box filters stream
on user input (when Enter is not pressed) in the Streams modal.
2021-06-02 14:04:53 -07:00
Priyank Patel 90bd3e9123 stream_popover: Use e.key instead of deprecated e.which.
Tested by making sure that Enter and other keys work as expected in
the streams dropdown in the Move topic modal.
2021-06-02 14:04:53 -07:00
Priyank Patel f2aae91cc1 stream_edit: Use e.key instead of deprecated e.which.
Tested by making sure Enter works as expected in Stream membership
input in Stream setttings.
2021-06-02 14:04:53 -07:00
Priyank Patel 7f87ea7e79 settings_user_groups: Use e.key instead of deprecated e.which.
Tested by making sure pressing Enter in the user group name and
description does not create a new line at Manage organization > User
groups.
2021-06-02 14:04:53 -07:00
Priyank Patel 08f5349666 settings_streams: Use e.key instead of deprecated e.which.
Tested by making sure Enter works as expected in the default stream
input at Manage organization > Default stream.
2021-06-02 14:04:53 -07:00
Priyank Patel a218143db7 search: Use e.key instead of deprecated e.which.
Tested by making sure Enter works and expected in the navbar search
with and without the typeahead being present.
2021-06-02 14:04:53 -07:00
Priyank Patel 607abc0b77 signup: Use e.key instead of deprecated e.which.
Tested by making sure Enter works as expected in the signup flow.
2021-06-02 14:04:53 -07:00
Priyank Patel baad874689 integrations: Use e.key instead of deprecated e.which.
Tested by making sure Enter does the search in the integrations page
when the input is not empty.
2021-06-02 14:04:53 -07:00
Priyank Patel 969874d633 alert_words_ui: Use e.key instead of deprecated e.which.
Tested by making sure alert word is added when Enter is pressed in
the alert word input.
2021-06-02 14:04:53 -07:00
Priyank Patel 98cb0e339c click_handlers: Use e.key instead of deprecated e.which.
Tested by making sure Enter and Escape works as expected in the edit
stream name in the subscriptions modal.
2021-06-02 14:04:53 -07:00
Priyank Patel 5fdcf7b534 click_handlers: Use e.button instead of deceprated e.which.
The middle button click is represented by 1. Tested by clicking
middle button on zulip logo and making sure it is not focused.
2021-06-02 14:04:53 -07:00
Priyank Patel 53d2712027 settings_org: Use e.key instead of deprecated e.keyCode.
Tested by making sure pressing Enter in the input field of the
changed organization settings (the organization name for example)
clicks the save changes button if present.
2021-06-02 14:04:53 -07:00
Priyank Patel 63cf47b63a stream_create: Use e.key instead of deprecated e.keyCode.
Tested by making sure pressing Enter in the stream creation
description did not create a new line.
2021-06-02 14:04:53 -07:00
Priyank Patel 121e21d3b9 poll_widget: Use e.key instead of deprecated e.keyCode.
Tested by making sure Enter and Escape work for editing poll title
and adding new poll options.
2021-06-02 14:04:53 -07:00
Priyank Patel c292ade96a message_edit: Use e.key instead of deprecated e.keyCode.
Tested by making sure Enter and Escape works as expected for editing
topics and messages.
2021-06-02 14:04:53 -07:00
Priyank Patel 2cb71ccc7b emoji_picker: Use e.key instead of deprecated e.keyCode.
Tested by opening the emoji picker from the composebox and making
sure Enter works as expected on the input.
2021-06-02 14:04:53 -07:00
Priyank Patel 6e59d08a74 settings_org: Fix incorrect selector for the save changes button.
This change fixes a bug where pressing Enter does not save the
changes as expected, due to an incorrect selector, when the
save/discard changes button shows up in settings. Tested by changing
the Organization name and pressing Enter at Manage Organization >
Organization profile > Organization name.
2021-06-01 14:56:10 -07:00
Anders Kaseorg 6702f434ca giphy: Load Giphy SDK lazily.
The Giphy SDK sends tracking pings when it loads; we don’t want those
to be sent for visitors who aren’t using Giphy.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-28 15:44:49 -07:00
Aman Agrawal 07f972f45a message_events: Pass correct new stream id to recent_senders.
We were passing new_stream_id as undefined in case of topic
edit as event.new_stream_id is undefined in that case.

We pass the correct stream_id to fix it.
2021-05-28 09:41:02 -07:00
Priyank Patel 7999d52400 ts: Convert keydown_util to TypeScript.
We also add JQuery to globals which is a global type.
2021-05-27 23:33:21 -07:00
Priyank Patel 6ab66ea17a keydown_util: Use Event.key instead of deprecated properties.
The Event.which and Event.keyCode are deprecated as pointed out by
TypeScript intellisense based on the jQuery types. We use Event.key
instead which behaves similarly to Event.which & Event.keyCode for
our use case.

The only difference in functionality by this change is that the vim
keys won't work when Caps Lock is on. This is because, in this case,
the key property will be "J" instead of 'j'. We can fix this by
adding a mapping for this, however, I think we don't want to handle
this case so I left this change out. Tested by trying out the
everywhere keydown_util is used.

Finally, we also turn off the new-cap rule for tests since I think
it fine to only enforce it on real code and exempting test code is
fine.
2021-05-27 23:33:17 -07:00
sahil839 d37ddf13a4 registration: Show spinner and disable button while processing.
This commit disables the button and shows a loading spinner on
the button when signup request is being processed to avoid race
conditions caused by user clicking on the button multiple times.

The fix is done observing that for the case when form is invalid
the whole page is rerendered and thus we do not need to remove
the spinner and enable the button again and for other errors
we redirect to some other page.

And for the validation taking place in client-side, the button
is disabled and spinner is shown, only is form is valid, by
using "$('#registration').valid()".
2021-05-27 22:51:13 -07:00
sahil839 df43d6d99e stream_edit: Fix bug of disabling of "Add" button on subscribing.
We live update the "Add subscribers" UI on subscribing/unsubscribing
the stream and the field sub.can_add_subscribers is used to check
whether user is allowed to add subscribers or not.

The sub object used here is not the complete sub object and thus
sub.can_add_subscribers is undefined. We need to use the updated
sub obejcts with all the setting fields that we can get from
'stream_settings_data.get_sub_for_settings' before rendering UI.

This calculation of additional fields was done previously by
'stream_data.update_calculated_fields', but in d50462568b
call to 'updated_calculated_fields' was removed with the aim to
call 'get_sub_for_settings' before updating UI which was missed
in this part of UI update.

Fixes #18616.
2021-05-27 16:49:10 -07:00
Gaurav Pandey 64bd461bad register api: Rename realm_upload_quota.
Rename `realm_upload_quota` to `realm_upload_quota_mib`
reflecting file size in mebibytes. Update frontend and bump
API_FEATURE_LEVEL.
2021-05-26 11:38:24 -07:00
Gaurav Pandey 1da818f848 register api: Rename max_logo_file_size.
Renaming `max_logo_file_size` to `max_logo_file_size_mib`
reflecting the file size in mebibyte and update the frontend.
2021-05-26 11:38:24 -07:00
Gaurav Pandey 531cf041f1 register api: Rename max_icon_file_size.
Renaming `max_icon_file_size` to `max_icon_file_size_mib`
reflecting the file size in mebibyte and update the frontend.
2021-05-26 11:38:24 -07:00
Vishnu KS 3e62a793f7 user status: Remove data attributes from user status options.
I don't see any good reason why we have to store the status
values in data attributes when they are already stored as
the content of the buttons.
2021-05-26 11:04:04 -07:00
m-e-l-u-h-a-n 22b1f6e1ab typeahead: Make typeahead_helper.sort_recipients more readable. 2021-05-25 08:03:02 -07:00
m-e-l-u-h-a-n 069718cdc7 pills: Cleanup source initialization in pill_typeahead.
Source in pill_typeahead, was intialized in a
very tricky way. In this cleanup, we refactor it
to clearly reflect how source is initialized for
different cases. These changes do not change its
behavior for its current use and solve potential
issues, so that it could be safely used at places
that do not require user pills at all.
2021-05-25 08:01:56 -07:00
m-e-l-u-h-a-n 0080daa5a3 minor: Specify types of pills while initializing pill typeahead.
In options that we pass to pill_typeahead.set_up we
specify if we want typeahead to support stream or
user_group pills, and use users as source by default.

Using users for source by default, can have unnecessary
suggestions in typeaheads where only user_groups or streams
are needed.

So to solve that, we specify if we want users pill in the input.
This is then utilized in further commits, to clean up hacky code
that deals with intializing source for typeahead.
2021-05-25 08:01:05 -07:00
m-e-l-u-h-a-n 637f648828 message view: Show re-hide option in revealed muted user's message only. 2021-05-25 07:56:13 -07:00
Sumanth V Rao 386ddf1517 typehead_helper: Show a maximum of one alias per language.
We make the typeahead a little more nicer but only showing one alias
per language. For example if the user searches for prefix "j", then
the typeahead list should contain "javascript" only, and not "js" and
"javascript".
2021-05-24 23:15:40 -07:00
Tim Abbott c44a922b15 settings_data: Avoid using undefined for false. 2021-05-23 14:26:45 -07:00
sahil839 6a792c93df setting: Add moderator option in email visibility setting in frontend. 2021-05-23 14:26:00 -07:00
Riken Shah 51e24519b8 refactor: Rename `panels.js` to `navbar_alerts.js` as it better explains it. 2021-05-21 17:49:12 -07:00
m-e-l-u-h-a-n 2fce386657 message view: Refactor _rerender_message to accept object of parameters.
It is changed to improve readability, about what parameters are being
passed.
2021-05-21 17:47:05 -07:00
m-e-l-u-h-a-n 61cc26667d popovers: Hide message action popover on revealing muted user messsage.
When muted user's message is revealed, popover should have
an option for hiding the message again. But in case if the
popover is already open while message is being revealed then
option for undo reveal in the popover could be out of sync.

To avoid this, we hide the message actions popover before
revealing muted user's message.
2021-05-21 17:23:29 -07:00
m-e-l-u-h-a-n caa5ec74c2 message view: Allow muted user message to be rehidden.
An new option is added in message action popover of a muted user
message that allows the message to be rehidden.

Fixes: #18452.
2021-05-21 17:23:29 -07:00
Priyank Patel f4524467e0 ts: Convert reload_state to typescript. 2021-05-21 16:53:30 -07:00
Priyank Patel 3b46ec0e5f ts: Convert colorspace to typescript. 2021-05-21 16:53:30 -07:00
Priyank Patel cafe2b4d11 colorspace: Remove unused methods.
The getDecimalColor, getLighterColor & getHexColor were unused.
2021-05-21 16:53:30 -07:00
Priyank Patel e18377162c ts: Convert search_utils to typescript. 2021-05-21 16:53:30 -07:00
Priyank Patel 1325b25704 ts: Convert message_user_ids to typescript. 2021-05-21 16:53:30 -07:00
Priyank Patel 3c84a883c5 ts: Convert feature_flags to typescript. 2021-05-21 16:53:27 -07:00
m-e-l-u-h-a-n c97956c5ff message view: Fix tooltips in message action icons.
Tooltips in message action buttons for failed message were
not shown properly because they were initialized two times
first because of general tippy-zulip-tooltip class and then
because of message_control_button class. So to avoid showing
an extra empty tooltip for failed message icons we return
false from onShow() method of message_control_button class
initialization of tooltip.
2021-05-20 17:30:24 -07:00
m-e-l-u-h-a-n 03a3879aa0 message view: Remove unnecessary expectOne check in tippyjs.
This check was not needded as it is possible to have even zero
edit message buttons in cases when a message is fails. So it
raises unncesary errors on hovering over icons of those failed
messages.
2021-05-20 17:30:24 -07:00
Tim Abbott af2b1ef3a1 page_params: Remove duplicate debug_mode field.
This had the same value as development_environment, I believe in a way
likely to persist long term, and was less clear about its meaning.
2021-05-20 14:57:34 -07:00
Tim Abbott 2e67b879ed api: Add server_timestamp to register response.
Since this is currently only useful to interpret presence data, we
send this only if presence is requested.

I'm not sure that server_timestamp is the right name for this field,
but ultimately it should match the main presence API format.
2021-05-20 14:57:34 -07:00
Aman Agrawal 637c7e297c streams_filter_icon: Convert from id to class.
This will allow us repeat the class which we cannot do with id.
2021-05-20 14:41:40 -07:00
Aman Agrawal d666b465b9 hotkeys: Go through hashchange to open drafts.
This helps us keep all the logic related to changing hash of
webapp in hashchange itself, like not showing drafts to
web-pubic-visitors.
2021-05-20 14:41:40 -07:00
akshatdalton 78b59fa756 people: Fix `get_mention_syntax` when `full_name` matches wildcard.
When quoting a reply or mentioning a person having full name matching
wildcard mention, in such case, `get_mention_syntax` doesn't return
mention syntax of format: **full_name|user_id**.
As a result, a normal user can't mention such users and users who
can mention them may unwillingly trigger wildcard mention.
This commit fixes such issue.
2021-05-20 11:41:56 -07:00
akshatdalton b636a9199b compose: Add typeahead for user group silent mentions.
Prior to this, we restricted to show any user group suggestions
if silent mention syntax is used. But with the addition of
user group silent mentions, there are cases where one may want to
refer to some user groups without actually notifying them.
So, we add typeahead logic for such cases.

Test cases for silent syntax (@_*) and non-silent syntax (@*)
are added.
2021-05-20 11:41:55 -07:00
akshatdalton bf96d7eae8 markdown: Add support for local rendering of user group mention in quote.
This also adds test cases to test the local rendering of
user group mention in blockquotes.
2021-05-20 11:35:04 -07:00
akshatdalton e50d189191 minor: Refactor `user_mention_re` to match characters except `>`.
The regex could have match a bunch of characters including `>`
and hence end up matching across multiple adjacent spans in
a weird way. This commit fixes such an issue.
2021-05-20 11:35:04 -07:00
akshatdalton 5bab65e82f markdown: Add support for local rendering of user group silent mention.
This also adds test cases to test the local rendering of
silently mentioned user group.
2021-05-20 11:35:04 -07:00
akshatdalton 9d031ecf8f markdown: Add support for local rendering of wildcard silent mention.
This also adds test cases to test rendering of silent
wildcard mention and wildcard mention in quotes.
2021-05-20 11:35:04 -07:00
akshatdalton 13421a1969 minor: Refactor `userMentionHandler` to avoid duplicating escaping logic.
We avoid duplicating escaping logic for the same variable, which
helps to reduce the risk of any future bugs.
2021-05-20 11:25:38 -07:00
Anders Kaseorg 69f454195f gear_menu: Fix obsolete comment about window.onhashchange.
Commit 0c80fc6aba (#12737) stopped using
the old-style window.onhashchange property.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-20 10:43:06 -07:00
Anders Kaseorg c09da2abdf panels: Replace deprecated jQuery event trigger shorthand.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-20 10:42:36 -07:00
Anders Kaseorg 7c38a0c1f0 recent_topics: Replace deprecated jQuery event trigger shorthand.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-20 10:42:36 -07:00
sahil839 bd957bb5a2 giphy: Add a '?' icon besides the "GIPHY integration" label.
We add a '?' icon besides the "GIPHY integration" label of
giphy settings dropdown.

The icon links to readthedocs page for setting up giphy API
key when api key is not set, and it points to help center
article of GIFs when the api key is added.
2021-05-19 13:20:52 -07:00
Steve Howell 62eca19b86 node tests: Eliminate sloppy_$ for compose tests. 2021-05-19 15:55:03 -04:00
akshatdalton 769cd06ab6 refactor: Extract linkifier non-settings logic from `markdown.js`.
The extracted logic is in linkifier.js.
We have decided to name it linkifier.js instead of realm_linkifier.js
because in future when we will add stream-level linkifiers, we'll
likely want them to be managed by this same file.
2021-05-19 11:59:28 -07:00
sahil839 cf23a09532 giphy: Fix live update of giphy icon when API key is empty.
We fix the code to show giphy icon live update only if the
updated setting is not disabled and API key has been added.
Though the dropdown is disabled,the setting can still be
changed using API, so this change is necessary.

Previously, we were not checking whether API key is there or
not and icon was shown on live update even if API key was
not there and then it went off on reload.
2021-05-19 11:04:32 -07:00
sahil839 cf6fc3456f giphy: Disable giphy settings dropdown if API key is not present. 2021-05-19 11:04:32 -07:00
rht aa3cdfa2e9 Fix typos using codespell.
The command:
codespell --skip='./locale,*.svg,./docs/translating,postgresql.conf.template.erb,.*fixtures,./yarn.lock,./docs/THIRDPARTY,./tools/setup/emoji/emoji_names.py,./tools/setup/emoji/emoji_map.json,./zerver/management/data/unified_reactions.json' --ignore-words=codespell_ignore_words.txt .

The content of codespell_ignore_words:
```
te
ans
pullrequest
ist
cros
wit
nwe
circularly
ned
ba
ressemble
ser
sur
hel
fpr
alls
nd
ot
```
2021-05-18 17:33:51 -07:00
akshatdalton 9e5f2f841f rendered_markdown: Add support for rendering of user group silent mention.
Earlier, the text in silently mentioned user group was rendered
as: `@user-group`

which is fixed by this commit and now it rendered as: `user-group`.
2021-05-18 17:31:25 -07:00
Steve Howell eb46ac408d node tests: Add activity.clear_for_testing(). 2021-05-18 18:34:17 -04:00
Steve Howell 7a9d0a505d node tests: Avoid rewiring client_is_active. 2021-05-18 18:34:17 -04:00
Vishnu KS 323ad83d98 billing: Allow updating licenses of plans on manual license management. 2021-05-14 15:10:02 -07:00