Commit Graph

8576 Commits

Author SHA1 Message Date
Sahil Batra 355f6e9b53 settings: Move 'enter_sends' setting to property_types dict.
This commit moves "enter_sends" setting to property_types dict.
With this change, changing enter_sends setting also sends an
event of type "update_display_settings" and thus enables us
to live-update the UI.
2021-07-27 15:52:53 -07:00
Sahil Batra dafd32bd09 compose: Extract compose.toggle_entry_sends_ui function.
This commit extracts the code for hiding and showing the
send button according to 'enter_sends' setting value in
a separate function.
2021-07-27 15:52:53 -07:00
akshatdalton 3a35a0b72c composebox_typeahead: Re-add comment to explain the need of `nextFocus` variable.
This commit re-adds the comment to explain the need
of `nextFocus` variable which was deleted in
3b0694693b.
2021-07-27 15:41:29 -07:00
sahil839 cfd64cf951 settings_ui: Add option for changing label on disabling input.
We only disable the dropdown and keep the label as it is when
disabling a dropdown input, but for a check-box we need to
change label style also while disabling it.

Till now disable_sub_settings_on_change was used only for
dropdown but will be used for a check-box in the next commit.
2021-07-26 17:48:01 -07:00
sahil839 c7e756f984 setting: Allow only owners to change "Who can invite users" setting. 2021-07-26 17:48:01 -07:00
sahil839 ca0bb5b9d8 settings: Add nobody option for invite_to_realm_policy in frontend. 2021-07-26 17:48:01 -07:00
Ganesh Pawar 0811bda192 dialog_widget: Clear error element when clicked on the submit button. 2021-07-26 16:37:16 -07:00
Ganesh Pawar b9aed2df19 change_email_modal: Remove duplicate id attribute.
This also naturally fixes the bug where the change_email_modal wouldn't
show the old email in the input box.
2021-07-26 16:37:15 -07:00
Ganesh Pawar 45799f1f1d delete_topic: Remove unnecessary `close_modal` call.
91b83cf09f migrated delete_topic modal
to confirm_dialog. confirm_dialog closes the modal after clicking on
the Confirm button. So manually closing the modal is redundant.
2021-07-26 16:37:15 -07:00
Eeshan Garg 72fba69c02 help: Activate sidebar scrollbar when hamburger is clicked.
On mobile, when you go to our /help pages, you cannot scroll the
sidebar content. As for testing, the bug can be reproduced by
using a mobile display in Chrome inspector. One caveat of this
bug is that if you go to /help with a mobile display toggled,
the scrollbar won't work. However, if you switch between
different mobile displays, it starts working.

This commit adds some JS that sets the right CSS properties
when the hamburger is clicked.
2021-07-26 15:30:55 -07:00
Mateusz Mandera 119f1da04a bots: Rename is_cross_realm_bot API field to is_system_bot.
Cross realm bots will soon stop being a thing. This param is responsible
for displaying "System Bot" in the user info popover - so this rename is the
right way to handle the situation.

We will likely want to rename the `cross_realm_bots` section as well,
but that is a more involved API migration.
2021-07-24 15:46:40 -07:00
Ganesh Pawar 43a3a73a0d widgets: Avoid adding the widget_elem if it already exists.
Fixes #18631
2021-07-24 09:52:14 -07:00
Tim Abbott ab2ef76baa login: Fix hash being lost with redirects.
This fixes the following flow being broken:

* You start on
  http://zulipdev.com:9991/accounts/go/?next=/upgrade%23sponsorship
  (which we link to from e.g. /plans/)

* The form on that page has
  `action=/accounts/go/?next=%2Fupgrade%23sponsorship`, i.e. it has correctly
  URL-encoded the `next `value.

* You enter a realm name and hit submit.

* That redirects you to
  `http://realm-26.zulipdev.com:9991/upgrade#sponsorship`, would is
  correct if you are already logged in.

* However, if you're not logged in, `/upgrade` will serve a redirect
  to the login page, landing you at
  `http://realm-26.zulipdev.com:9991/devlogin/?next=/upgrade/#sponsorship`.
  This page works.  But in production, it would instead be:
  `http://realm-26.zulipdev.com:9991/login/?next=/upgrade/#sponsorship`.
  On this page, password login works but social login does not.
  Note that the `next=` value is no longer URL-encoded, and thus is
  parsed by the browser as `?next=/upgrade` + a hash of
  `#sponsorship`.

* If you now login with Google auth, you find yourself on
  `http://realm-26.zulipdev.com:9991/#sponsorship` (no /upgrade).

The root cause was that we have a bit of JavaScript in signup.js and
dev-login.js that is intended to handle this; but it was broken for
the social login case for unknown legacy reasons.

This bug appears to date from the original
b62bdde303 which introduced `next`
support for social backends in the first place.
2021-07-24 09:50:15 -07:00
Riken Shah 67f4851ded user_status: Add `get_emoji_info` function.
This is a prep commit to add the status emoji feature.

This function will add missing/extra parameters to the
emoji info object, that would need by the template to
render an emoji.

Co-authored-by: Yash Rathore <33805964+YashRE42@users.noreply.github.com>
2021-07-23 13:03:32 -07:00
Riken Shah b7b18cdfd3 emoji_picker: Update architecture to support status emoji.
This is a prep commit to add the status emoji feature.

We update the templates associated with the emoji
picker to add class `status_emoji` to `emoji` in the
popover.  So we can later add the events when the user
selects the emoji.

We also update the functions in `emoji_picker.js` to
support opening emoji picker popover in the 'set_status_
overlay`.

We also increase the `z-index` of the `popover-flex`
class (This class is only added to popover-emoji content
if the view is mobile), so in the mobile view the emoji
popover doesn't go behind the '#set_user_status_modal'.
2021-07-23 13:03:13 -07:00
PIG208 60e3429da3 bots: Remove the need to debounce for dispatching bot events.
We rely on calling eventually_render_bots from the event handling
code path for bot events to both updating the list and switching
the tab.

Now we decouple the logic and make render_bots take care of
rendering the list of bots only and switch the tab upon calling
the success handler of creating the bot.

Fixes: zulip#17743
2021-07-23 11:26:42 -07:00
Eeshan Garg 78ff74d3fd landing_page: Fix anchor links on landing pages.
As it turns out, anchor links on headings only worked on our /help and
/api pages but were broken everywhere else. This commit adds the
required JS to scroll properly when an anchor link on any of our
various landing pages is clicked. We already have similar code to
accomplish this in help.js.

We verified with console logging, browser Sources inspection, and
checking source files that help.js and landing-page.js are never
included in the same page, but we add comments to make this
architecture clear.

Fixes #19349.
2021-07-23 10:29:41 -07:00
Tim Abbott 99e6618f07 compose: Fix validation treating welcome bot as deactivated. 2021-07-22 15:22:20 -07:00
Priyansh Garg c541699b9b compose: Fix expanded compose un-collapsible in presence of navbar_alerts.
The distance of compose-box from the top is hardcoded in the existing
code as `50px`, which only considers the height of the `.header`, plus the
padding-bottom of the header. This results in a bug where the top bar of
compose-box gets hidden behind the header if navbar_alerts is also present
in the view.

This commit calculates the top distance of the compose-box dynamically,
whenever the compose-box is opened and set the `top` property of the
compose-box accordingly.

Tested on my Ubuntu development environment.

Fixes: #19249.
2021-07-22 14:25:48 -07:00
Abhijeet Prasad Bodas d0b3801596 ui_init: Fix "Error: Unknown user_id in get_by_user_id: 0".
For spectators (logged view), we send user_id=0 via page_params.

The people module does not know about this user ID, and so throws the
exception. Earlier `people.get_by_user_id` was not called on page load,
but only when determining settings permissions with `settings_data.user_has_permission`.

But 231c536cad made it so that that function
is always called, so we need to handle the spectator case explicitly.

Co-authored-by: Gaurav Pandey <gauravguitarrocks@gmail.com>
2021-07-22 14:06:13 -07:00
Aryan Shridhar 3991fb3ea6 Revert "message_edit: Replace checkboxes with settings_checkbox partial."
This reverts commit 54a1c73c78.
2021-07-22 11:07:49 -07:00
Sahil Batra 318d71469b api: Remove '/users/me/enter-sends' endpoint.
We remove the '/users/me/enter-sends' endpoint
and 'enter_sends' setting will now be edited
using the '/settings' endpoint.
2021-07-22 11:01:43 -07:00
Ganesh Pawar a2aea23da4 stream_ui: Fix subscription button out of sync.
cb4797e3b7 rearranged the stream templates
but didn't change the selector for the subscibe button.

Fixes #19290
2021-07-21 22:02:33 -07:00
aryanshridhar 54a1c73c78 message_edit: Replace checkboxes with settings_checkbox partial.
This commits replaces the custom `send_notification` message_edit
checkboxes with our `settings_checkbox` partial.

The main intention is to also support the feature of selecting a
checkbox by clicking over its corresponding label as we have
in the case of the organization settings checkboxes.

Due to above change, this commit also removes the redundant
`break-row` HTML class along with it styles.
2021-07-21 10:43:18 -07:00
Aman Agrawal 3c024b2fba portico: Add /for/education, /for/events, /for/research pages.
These modern landing pages cover use cases previously not detailed on
our website. Technically, we had a /for/research page before, but it
wasn't finished or linked everywhere.

Removed "function-url-quotes" stylelint rule
since I need to use quotes in url to use an
svg as list bullet point. There are spacing issues
using it as an image. Also, using quotes in url
is actually the recommended way to do it otherwise
there could be issue with escaping.
2021-07-20 22:37:52 -07:00
Vishnu KS 199d3859fb billing: Make create_ajax_request accept callback function.
This is a prep commit for the Stripe checkout migration.

create_ajax_request function used to create an ajax request to our
billing API and on completion redirect to one of the URLs in our
website. The stripe migration requires the ajax request function to
execute Stripe javascript code post the request completion to redirect
to Stripe checkout page. So this commit updates the function to accept a
callback function which gets executed post the request completion.
2021-07-20 14:43:38 -07:00
Priyank Patel 231c536cad settings_data: Break circular dependency with people. 2021-07-20 14:28:48 -07:00
m-e-l-u-h-a-n c7be17eb73 stream settings: Use buddy list logic for filtering users.
Our logic for filtering subscribed users in stream setting was
buggy and gave irrelevant filters based on email matching.

We correct it by using same logic as we use for filtering in
buddy list.
2021-07-20 14:27:58 -07:00
Eeshan Garg 13e566815d landing_page: Fix top navigation dropdowns for mobile screens.
A recent PR introduced a bug where navigation dropdowns on the
landing page would not open for tablet/mobile screens. This
commit fixes that issue by using the proper media query to
differentiate between touch and mouse-based devices.
2021-07-20 11:33:56 -07:00
sahil839 b5b7862571 settings: Use '/settings' endpoint for changing notification settings.
We have merged the '/settings/display' and 'settings/notifications'
endpoints to '/settings' in backend. This commit updates the frontend
code to '/settings' endpoint for updating notification settings
instead of '/settings/notifications' endpoint.
2021-07-19 21:14:33 -07:00
sahil839 bbee0fdf6f settings: Use '/settings' endpoint for changing display settings.
We have merged the '/settings/display' and 'settings/notifications'
endpoints to '/settings' in backend. This commit updates the
frontend code to '/settings' endpoint for updating display settings
instead of '/settings/display' endpoint.
2021-07-19 21:14:33 -07:00
Alya Abbott 89724e5bb4 billing: Edit helper text on sponsorship application
* nonprofit -> non-profit
* Edit pass on defautl helper text to use more user-oriented language.
2021-07-19 17:26:45 -07:00
m-e-l-u-h-a-n b23fd2f1f3 stream settings: Move subscription_result template to stream_settings.
This commit moves stream_subscription_request_result.hbs to
stream_settings folder to have a consistent file structure
for stream setting templates.
2021-07-19 10:54:11 -07:00
m-e-l-u-h-a-n 70aa957e55 stream settings: Move stream list templates to stream_settings.
We move templates related to listing streams in left pannel of
stream settings overlay to stream_settings folder by making
following changes:

* Rename `subscriptions.hbs` to `browse_streams_list.hbs`.
* Move `settings_stream_list.hbs` to stream_settings folder.
* Rename `subscription.hbs` to `browse_streams_list_item.hbs`.
* Move `settings_stream_list_item.hbs` to stream_settings folder.
2021-07-19 10:54:11 -07:00
m-e-l-u-h-a-n a61048e167 stream settings: Move subscription_table_body.hbs to stream_settings.
Following changes are done to subscription_table_body.hbs:

* Rename subscription_table_body.hbs to stream_settings_overlay.hbs,
  to have a uniform naming pattern for stream settings templates.

* Move it to stream_settings folder.
2021-07-19 10:54:11 -07:00
sahil839 0594207180 realm_logo: Rename realm_logo.rerender to realm_logo.render.
As realm_logo.rerender is now used for initial rendering of
logo as well in c8849f8, so we rename this function from
rerender to render.
2021-07-19 09:45:29 -07:00
Dinesh dd1fccd2c2 tippy: Fix blueslip error on edit history timestamp hover.
The timestamp in edit history ui also has .message_time.
We had a tippy hover event attached to .message_time
whose code assumes it to belong to an actual message
which caused an error on hovering the message timestamp
in edit history.

This commit fixes it by making the selector more specific.
2021-07-19 09:34:52 -07:00
Tim Abbott a5afbb60ff ui_init: Initialize people before right_sidebar.
Because the right_sidebar initialization calls user_has_permission, in
organizations that has a waiting period before users become full
members, and only full members can send invitations, Zulip will throw
an exception on startup.
2021-07-19 00:33:02 -07:00
Tim Abbott 4e876191c3 billing: Fix typo in Standard spelling. 2021-07-18 21:18:55 -07:00
Tim Abbott d7ef0c7232 billing: Fix options and help text for sponsorship requests.
This makes several changes:

* Fixes a bug where the help text explaining our policies was not displayed.
* No help text was defined for many organization types.
* Copy-edits the help text somewhat.
* Offers all of the organization type options.
* Removes the 100% coverage requirement because it's annoying to test
  the e.currentTarget click handler.
2021-07-18 20:48:27 -07:00
Alya Abbott 12d9ad957c billing: Clean up sponsorship form helper text.
- Change to match proposed hero text.
- Fix incorrect statement about event sponsorship; commercial
events should not be sponsored.
2021-07-18 12:15:33 -07:00
sahil839 ceb5333352 images: Rename loader.svg to loader-white.svg for clarity.
We rename loader.svg to loader-white.svg as this svg contains
white rectangles for clarity as we have also added loader-black.svg
which is same but with black rectangles instead of white.
2021-07-18 11:44:17 -07:00
sahil839 fb53556cef loading: Use img tag for loading indicator instead of object tag.
We use img tag for showing the loading spinner in message edit form
and dialog-widget submit button, instead of object tag because using
object tag gives the following error- "Refused to display
'https://chat.zulip.org/' in a frame because it set 'X-Frame-Options'
to 'deny'." in the browser console.

As mentioned by Anders in czo, this is probably because we’re loading
the SVG using an <object> tag as if it’s totally-not-an-IE3-ActiveX-
control.

We also need to add a new svg file similar to loader.svg with the
change that the retangles are filled with black color. This needs
to be done because we cannot get access to the svg document if we
use img tag and so we cannot change the color of rectangles using
jquery as we were doing before to show the spinner depending on
day/night mode. So, now we just set the src attribute of img tag
to the correct svg file depending on day/night mode.

Discussed in #issues > loading tail-spin.svg denied by X-Frame-Options.
2021-07-18 11:44:17 -07:00
m-e-l-u-h-a-n f377f8a963 stream settings: Move stream setting modals to stream_settings folder.
We do following changes in this commit to have a uniform file
structure for stream setting templates.

* Move change_stream_info_modal.hbs to stream_settings folder.
* Rename subscription_stream_privacy_modal.hbs to
  stream_privacy_setting_modal.hbs.
* Move stream_privacy_setting_modal.hbs to stream_settings folder.
2021-07-18 11:36:39 -07:00
m-e-l-u-h-a-n 36c8923797 stream settings: Move subscription_settings.hbs to stream_settings.
This commmit does following two changes to subscription_settings.hbs:

* Rename subscription_settings to stream_settings to have a uniform
naming pattern for stream settings.
* Move it to stream_settings folder.
2021-07-18 11:36:39 -07:00
m-e-l-u-h-a-n ee7188e625 stream settings: Move subscription_type.hbs to stream settings folder.
We do follwing changes in this migration:
* Rename subscription_type.hbs to stream_permission_description.
* Move it to stream_settings folder.
2021-07-18 11:36:39 -07:00
m-e-l-u-h-a-n c213ed575a stream settings: Move stream description templates to stream_settings. 2021-07-18 11:36:39 -07:00
m-e-l-u-h-a-n d82da45564 stream settings: Migrate stream member list template to separate folder. 2021-07-18 11:36:39 -07:00
m-e-l-u-h-a-n a63a23087f tooltips: Remove unnecessary checks for message action buttons in tippy.
We handled tooltips for failed message action buttons separately
through our default tippy-zulip-tooltip class because of
a diffrent html structure for these buttons. But as we refactored
html for those buttons to have same structure as for other buttons
in message action this extra check is no more needed.
2021-07-18 11:33:32 -07:00
Tim Abbott 8f74261d48 drafts: Delete old drafts on page load, not modal launch.
This fixes a bad user experience where clicking to open the drafts
modal causes the number of drafts that you're looking at to suddenly
change.
2021-07-16 12:50:51 -07:00
aryanshridhar af4bd34873 stream_create: Remove unnecessary export keyword.
There's no need for the `create_handlers_for_users`
function to be exported as it's called within its
scope itself.
2021-07-16 08:53:56 -07:00
aryanshridhar d8e2fa5f9c stream_create: Avoid re-initialization of event handlers.
Previously, Everytime the user triggers the Stream create UI
by pressing the `Create stream` button, the
`create_handlers_for_users` function would reinitialize which
created duplicate event handlers for its elements.
This could lead to multiple click events being triggered over the
same element.

One such example was filed as #19255, where the click event was
triggering twice and hence the "Copy from stream" dropdown
would remain folded (closed).

Fixed this by - Initializing the `create_handlers_for_users` function
within the main `set_up_handlers` function, which is triggered only
once upon the opening of Stream create UI.

Fixes #19255.
2021-07-16 08:53:56 -07:00
sahil839 711aca3fde settings: Show correct email in user-info form.
This commit fixes the bug of showing custom email to admin in
the user-info form even when email_address_visibility is set
to admins only.

This commit fixes it to show the correct email according to
email_address_visibility values.
2021-07-15 14:26:40 -07:00
Eeshan Garg 6036524651 landing_page: Restructure top-level navigation.
This commit restructures the top-level navigation on our landing
page using dropdowns in a manner that allows us to advertise some
important pages to our visitors:

- Use cases for companies, open source projects, and communities.
- Miscellaneous pages about the product are now accessible from the
  "Product" dropdown.
- "Resources" are a few key resources our users may want to consult
  if they need help or support.
2021-07-15 10:56:47 -07:00
sahil839 2f44a08b37 settings: Convert settings_overlay.html to handlebars template.
Fixes #18796.
2021-07-15 08:59:23 -07:00
aryanshridhar 7c25bd1aa8 message_edit: Refactor message_edit to use dropdown_list_widget.
Implemented dropdown_list_widget in message_edit UI
which enables the functionality to search for streams
while moving a particular message across streams.

This matches the UI we have in the "move topic" widget.

Fixes #18416.
2021-07-15 08:27:55 -07:00
sahil839 6a3f22480d settings_emoji: Rename can_admin_emoji to can_delete_emoji. 2021-07-14 14:57:09 -07:00
sahil839 61acf68aa4 emoji: Allow emoji authors to delete the emoji always.
Previously, non-admin emoji authors were allowed to
delete the emoji only if add_emoji_by_admins_only
was false. But, as add_emoji_by_admins_only setting
is for who can add emoji and not delete emojis, it
should not affect the behavior of deleting emojis
and users should always be allowed to delete the
emojis which. they added themselves
2021-07-14 14:57:08 -07:00
sahil839 e736d9d275 settings: Add moderators and full members options in user-group setting.
This commit adds moderators and full members options for user group
settings in frontend.
2021-07-14 14:38:44 -07:00
Tim Abbott c5b455d5c2 dialog_widget: Simplify rendering logic.
This makes the templates a lot more readable.
2021-07-14 13:32:26 -07:00
Tim Abbott e0135e278d dialog_widget: Fix race focusing submit button.
Opening the modal before adding the on_shown handler makes it possible
that the modal could full appear before the handler runs.
2021-07-14 13:32:26 -07:00
Tim Abbott 6fb0d414b4 dialog_widget: Remove is_confirm_dialog variable.
Making the controls declarative makes the system more flexible for
future use cases.
2021-07-14 13:32:24 -07:00
sahil839 fd55df9f7c settings: Use dialog_widget for bot-edit form and remove edit_fields_modal.
This commit changes the bot-edit modal to use dialog_widget instead of
edit_fields_modal.

This commit also removes edit_fields_modal module as it is no longer used.
2021-07-14 13:02:26 -07:00
sahil839 0b21ca725e settings: Use dialog_widget for edit-user-info modal.
This commit changes the edit-user-info modal to use
dialog_widget instead of edit_fields_modal.
The edit_fields_modal module will be removed in
further commits to avoid code duplication.
2021-07-14 13:02:26 -07:00
sahil839 e0ab9e52b5 settings: Use dialog_widget for edit-linkifier modal.
This commit changes the edit-linkifier modal to use
dialog_widget instead of edit_fields_modal.
The edit_fields_modal module will be removed in
further commits to avoid code duplication.
2021-07-14 13:02:26 -07:00
sahil839 f6d8204d23 dialog_widget: Color of button should be according to use of modal.
We show red color for confirmation modals and green for other
modals with input fields.

As of this commit, only confirmation modals use dialog_widget but
some other modals with input fields will be migrated to use
dialog_widget.
2021-07-14 13:02:26 -07:00
sahil839 dff374a48b frontend: Remove html_submit_button paramter passed to dialog_widget.
We used html_submit_button to pass text to be present in the modal
submit button. There are only two possible options as of now -
"Confirm" and "Save changes" and the correct one can be determined
using is_confirm_modal parameter. So, we remove this paramter for
now and we can add it later if we have more type of modals using
this widget.
2021-07-14 13:02:25 -07:00
sahil839 ec3c5547ff frontend: Add dialog_widget module and refactor confirm_dialog.
This commit adds a new dialog_widget.js file containing most
of the code of confirm_dialog.js with some minor changes and
changes confirm_dialog to be a wrapper around dialog_widget.js.
We pass 'is_confim_dialog' as true in dialog_widget for a
confirm_dialog modal. This commit also renames confirm_dialog.hbs
and confirm_dialog_heading.hbs to dialog_widget.js,
dialog_widget.hbs and dialog_widget_heading.hbs respectively.
2021-07-14 12:58:00 -07:00
sahil839 71969f5196 confirm_dialog: Add post_render support in confirm_dialog.
This will be used by other modals when we will migrate
those to use the same code as that of confirm_dialog.
2021-07-14 12:21:24 -07:00
sahil839 c87c4f92ee confirm_dialog: Rename variables and classes used in templates.
This commit renames the variables, functions used in confirm_dialog.js
and classes and ids used in confirm_dialog.hbs.

This change is made so that we can easily migrate edit_fields_modal to
use this same code with some more changes.

We will change the file names and correspondingly import variables in
the next commit.
2021-07-14 12:21:24 -07:00
Gaurav Pandey 5e97ec9ad9 narrow: Do not mark messages as read in mentioned narrow.
The current behaviour marks messages as read when in mentioned
narrow. This is not the ideal behaviour, hence do not mark them
as read.

Fixes #19098.
2021-07-14 11:39:46 -07:00
akshatdalton 272901326c narrow_banner: Add banner for no resolved topics found search. 2021-07-13 23:36:24 -07:00
akshatdalton fe9693c824 search_suggestion: Add suggestion support for `is:resolved` keyword. 2021-07-13 23:35:41 -07:00
akshatdalton 6a45379a30 resolve topic: Add frontend support for `is:resolved` search keyword/filtering.
This commit adds the frontend support for `is:resolved` search
keyword. Test cases are added for the same.

Fixes: #18990.
2021-07-13 23:18:41 -07:00
Riken Shah 644cd18dfd refactor: Move "send button" related code from `compose_validate.js`.
This commit moves "send button" related code from
`compose_validate.js` to `compose.js` as it makes more
sense there.
2021-07-13 16:45:29 -07:00
Riken Shah 801ebba7c7 compose: Avoid showing empty msg error when send by enter is enabled.
We are doing this to avoid annoying behavior, when
"enter sends" is enabled, and the user accidentally hits
"Enter" and has to deal with the error message.

Fixes #19182
2021-07-13 08:29:55 -07:00
Riken Shah 0dbc7e0d21 compose: Improve how we handle over character limit message error.
We improved it in the following ways:
* Show the error message with the maximum character
limit.

* Disable the send button.

* When the user tries to send the message via hotkeys
i.e, When "Press enter to send" is enabled or the user
uses "Shift" + "Enter" shortcut, Flash the red border
around the compose box.

Also renamed `check_and_set_overflow_text` to
`check_overflow_text` for better clarity.
2021-07-13 08:29:55 -07:00
Riken Shah 4cce23b564 compose: Hide sending indicator when the message failed validation.
This bug was found when the user tries to send a
over character limit message, i.e It has failed the
validation but it still shows the "Sending..." text.
2021-07-13 08:29:55 -07:00
Priyank Patel 519e8471c9 ts: Convert upload_widget to TypeScript. 2021-07-09 12:42:31 -07:00
Priyank Patel 92912a3b1c ts: Convert compose_error module to TypeScript. 2021-07-09 12:42:31 -07:00
Priyank Patel 97a27eb239 ts: Convert watchdog module to TypeScript. 2021-07-09 12:42:31 -07:00
Priyank Patel fdedced521 ts: Convert password_quality module to TypeScript. 2021-07-09 12:42:31 -07:00
Priyank Patel 5a65a47b21 ts: Convert message_parser module to TypeScript. 2021-07-09 12:42:31 -07:00
Priyank Patel 261df2b4dc js: Rename muting_ui module to muted_topics_ui. 2021-07-09 10:00:45 -07:00
Priyank Patel 05c3164bb8 js: Split out muted_users_ui from muting_ui module. 2021-07-09 10:00:45 -07:00
aryanshridhar 4cd2fab7b0 user_popover: Replace custom email tooltip with tippy tooltip.
This commit essentially migrates our custom email tooltip
to tippy tooltip for displaying user's email when their
names would overflow past the right edge of user popover.

This also removes the `email_tooltip` and `tooltip_holder` HTML
classes aloong with their CSS styles as they no longer used.
2021-07-09 09:55:22 -07:00
m-e-l-u-h-a-n 781179c56a subs: Rename subs.js to stream_settings_ui.js.
We use subs as a common variable name for a collection of stream
data structure used in settings, in lot of modules. So this
rename clears a bunch of related shadowed variables.
2021-07-09 09:38:58 -07:00
m-e-l-u-h-a-n a41d5e58f9 stream settings: Improve UI for editing stream permissions.
This now is much more similar to our normal settings UI.
2021-07-08 17:53:58 -07:00
m-e-l-u-h-a-n 889229ba16 stream settings: Improve message for no description streams. 2021-07-08 17:53:57 -07:00
m-e-l-u-h-a-n 8a2cc75e0e stream settings: Clean unnecessary elements in stream settings. 2021-07-08 17:47:14 -07:00
m-e-l-u-h-a-n e8030fadc6 stream settings: Improve title for stream settings based on content.
We had a common title `stream settings` for two cases
when no stream was selected and also when settings for
a particular stream were shown.

To improve this situation we now show `Settings for {stream_name}`
when settings for a particular stream are shown.
2021-07-08 17:47:13 -07:00
m-e-l-u-h-a-n cb4797e3b7 stream settings: Re-design stream settings page using tab-switchers.
We move away from a single scrollable page to have a tabs settings
structure instead.
This commit consists of the minimal changes required to set up toggler
component. And the subsequent commits would include all the UI UX
changes required for updating the layouts.

Co-authored-by: Ryan Rehman <ryanrehman99@gmail.com>
2021-07-08 17:47:13 -07:00
akshatdalton 834e8c0b63 tooltip: Improve tooltip visibility for message control buttons.
This change ensures that the tooltip doesn't hide by the
selected message blue border.
2021-07-08 17:41:22 -07:00
aryanshridhar 9049fb3bd4 users: Remove redundant compute_show_invites function.
This commits removes the redundant `compute_show_invites` function
which computes the `show_invites` page parameter in `lib/users.py`.

It is so because, commit 13399833b0 removed
the `show_invites` context variable passed in index.html.
Hence, the `show_invites` page_param key is no
longer required to compute in backend as it can be switched with
`settings_data.user_can_invite_others_to_realm()` in the frontend.

This commits also removes the `test_compute*` tests in
`test_home` that concerned with the `show_invites` page parameter
as they are no longer required.
2021-07-08 12:37:47 -07:00
Aman Agrawal 4c0c067136 actions_popover: Hide irrelevant options for spectator. 2021-07-08 12:33:56 -07:00
Ganesh Pawar 4df2fd2b61 hotkey: Disable hotkeys when a modal is open. 2021-07-08 12:04:19 -07:00
Anders Kaseorg dc1342825b Revert "compose: Convert pasted url to named link."
This reverts commit 5a61c9bb14 (#18849),
which had a number of bugs:

• It had a poor interaction with Ctrl+Shift+L resulting in double link
  formatting.
• It didn’t work at all in Firefox.
• It didn’t check whether what you’re pasting into is even a compose
  box.
• On pasting into the message edit box, it would throw “Error: Cannot
  read property 'text' of undefined”.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-08 12:00:22 -07:00
sahil839 91d2960252 confirm_dialog: Disable the cancel button also while loading.
We disable the cancel button of dialog while loading because
the action cannot be cancelled even afer clicking cancel.
2021-07-08 09:43:32 -07:00
sahil839 6b995050b0 confirm_dialog: Fix loading spinner in confirm button in night mode.
We change the color of loading indicator to black only if we are not
using night mode, and in night mode indicator remains white.
2021-07-08 09:43:32 -07:00
sahil839 cd333cf157 message_edit: Fix loading spinner in message-edit button in night mode.
We change the color of loading indicator to black only if we are not
using night mode, and in night mode indicator remains white.
2021-07-08 09:43:32 -07:00
sahil839 a3f7639af3 settings: Extract code for checking night-mode setting.
We extract the code for checking night mode setting on
the basis of color_scheme value and using matchMedia when
color_scheme is set to automatic. This is currently used
in rendering the correct logo only.

This is a prep commit for fixing loading indicator not
visible on message-edit button in night-mode.
2021-07-08 09:43:32 -07:00
Steve Howell 8ffe22fc15 slash commands: Remove /settings command.
It's easy enough for power keyboard users to just use "g"
to get to settings, and it's certainly easier for
mouse users to just go to the menu.
2021-07-08 10:47:52 -04:00
Signior-X 6cf33c4275 compose: Add support for full size compose box.
This commit makes a working toggler in compose_actions that adds the
compose-fullscreen class to the compose that removes the max-height
from the compose textarea and adds flex elements above so that the
height automatically adjust with the device height. This results in
making the compose box full screen sized.

The compose_height.js maintains the state of the height of the compose
box. Also, when the compose box is closed, the compose box is reset to
it's default behaviour and original height. So, everytime user need
not toggle off the compose full size and only for specific message
it is used.

It also adds destroy autosize on compose_height state change.
It destroys the autosize of textarea when the full
screen sized compose box is toggled on. And everytime when it is
turned off, it reinitialises the autosize. This also adds a
condition in autosize_textarea to only autosize when composebox
is not in full height state.

Fixes #17660
2021-07-07 16:47:30 -07:00
Anders Kaseorg 83120f218b compose: Don’t convert absolute upload URLs to relative.
Especially not by trying to edit markdown with a context-ignorant
unescaped regexp.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-07 15:41:52 -07:00
Anders Kaseorg e0f4013b21 upload: Don’t convert relative upload URLs to absolute.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-07 15:41:52 -07:00
m-e-l-u-h-a-n 6eaf111bde message-editing: Add autocomplete suggestions for topic editing.
We extends composebox_typeahead to support autocompletion
suggestions on editing the topic of a message from message
edit form as well as from recipient bar.

Tweaked by tabbott to have correct keyboard interaction without
needing to patch Bootstrap.

Fixes: #16368.
2021-07-07 15:18:39 -07:00
akshatdalton 11c37bca8f composebox_typeahead: Open typeahead immediately when @ is entered.
This change ensures that we pop up the typeahead when one
has entered just `@`. This will make clear to the user
about the @-mentions feature in Zulip.
This also makes us consistent with expectations from other
chatting apps like Slack, Discord, etc.

Added few test cases and modified the present ones.

Fixes: #19142.
2021-07-07 14:29:22 -07:00
Priyam Seth 62d9f28211 compose_area: Fix compose_area pasted message bigger than max_length.
Fix a bug where the compose box cut the message without warning the user
the message pasted was longer than the allowed. It was fixed by stopping
cutting the message off and showing an indicator whenever the limit exceeds
and removing the indicator as soon as message gets less than that.

The cut off for showing the indicator is set as 90% of the limit.

Fixes #15909
Co-authored-by: João Maurício <carvalho.joaomauricio@gmail.com>
2021-07-07 12:18:18 -07:00
Priyam Seth e976512b3c compose: Fix compose box getting close on copying code.
This commit adds an exception in click-handlers.js so that
when mouse clicks on .copy-codeblock, the composebox is not
closed.

Fixes #19130.
2021-07-07 10:47:23 -07:00
Aman Agrawal 578f93b2f3 tippy: Set default placement of tooltips to top.
Generally, tooltips placed at top look good. If the tooltip cannot
fit at top, it will by default be placed at opposite side.

Removed the unnecessary top placement definitions.
2021-07-07 10:23:31 -07:00
Anders Kaseorg 98194b9316 blueslip: Remove SAVE_FRONTEND_STACKTRACES setting.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-07 09:26:02 -07:00
Signior-X 5a61c9bb14 compose: Convert pasted url to named link.
This commit changes the pastehandler to have a case when
a url is tried to paste on composebox. It instead of
directly pasting it, changes the content as we do using
ctrl + shift + L, just the difference is here it uses,
the copied text instead of url and cursor moves forward.

Fixes #18692
2021-07-06 17:56:02 -07:00
Signior-X 3bdc7432b9 refactor: Move wrap_text_with_markdown into compose_ui.js.
This commit makes it possible to use wrap_text_with_markdown_outside
compose.js.

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

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

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

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

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

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

I have removed the class attribute `tippy-zulip-tooltip`
for Filter stream title as this will be handled by the
new changes.
2021-07-06 15:26:53 -07:00
sahil839 8fe401c38c confirm_dialog: Rename confirm_dialog_yes_button class.
This commit renames confirm_dialog_yes_button class to
confirm_dialog_submit_button. This will help in keeping
a general class name when deduplicating the code for
confirm_dialog and edit_fields_modal.
2021-07-06 15:15:50 -07:00
sahil839 055d7113f2 confirm_dialog: Rename html_yes_button to html_submit_button.
This commit renames the html_yes_button parameter of confirm
dialog widget to html_submit_button and also all the related
variables in confirm_dialog.js.
This will help in keeping a general name when deduplicating
the code for confirm_dialog and edit_fields_modal.
2021-07-06 15:15:50 -07:00
sahil839 eaf69bbf16 edit_fields_modal: Show error message in the body not heading.
Placing error message at the top of the body looks better than
placing it below the heading.
2021-07-06 15:15:50 -07:00
sahil839 0ebcb17397 confirm_dialog: Change the style and position of error message element.
This commit changes the error message element of confirm_dialog to be
above the text of dialog and to be a nice box using already defined
"alert" class.
2021-07-06 15:15:50 -07:00
sahil839 19362f393e edit_fields_modal: Rename modal_body_html and modal_label.
This commit renames modal_body_html and modal_label to
html_body and html_heading respectively. This change
will help us easily deduplicating the confirm_dialog
and edit_fields_modal code.
2021-07-06 15:15:50 -07:00
Priyam Seth ba44f4161a compose: Make a function to hide compose error.
This commit creates compose_error.hide() function that
can be used to hide compose_error alerts.
2021-07-06 15:15:26 -07:00
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