Commit Graph

8554 Commits

Author SHA1 Message Date
Sahil Batra 89e5c7b9f9 settings: Fix live update of notification sound dropdown.
This commit fixes the live update of notification sound
setting dropdown. We already update the notification sound
source to play the correct sound after changing the setting.
2021-09-07 09:50:39 -07:00
Aman Agrawal 31de905955 login_to_access: Rename module to `spectators`.
This allows us to call spectators.login_to_access which
is more clear for what it does.
2021-09-07 09:47:28 -07:00
Aman Agrawal 5151e916ea click_handlers: Don't hide compose when clicking on tippy popovers. 2021-09-06 09:35:58 -07:00
Aman Agrawal 34a37f55d6 spectators: Rename is_web_public_compatible functions. 2021-09-06 09:00:16 -07:00
Aman Agrawal f5e4dca8f2 login_to_access_modal: Restore current hash after login. 2021-09-06 09:00:16 -07:00
Aman Agrawal a67cff4964 reactions: Don't process clicks from spectators.
The reaction count goes up locally if we don't have this check.
This is misleading for spectators.
2021-09-06 09:00:16 -07:00
Aman Agrawal 9bd2701f5b message_fetch: Don't re-fetch recent msgs for spectator.
Since a spectator cannot have unread counts, we always
fetch the most recent messages. Hence, there is no need to
separately fetch this in this case.
2021-09-06 09:00:16 -07:00
Aman Agrawal fcfc81cdf3 compose: Prompt user to login when trying to compose. 2021-09-06 09:00:16 -07:00
Aman Agrawal cfd81b1bf4 login_to_access: Take user to web_public_compatible hash on exit.
We save the last web_public_compatible hash that user visited
before the modal was shown and take user to that hash when
user exits the modal.
2021-09-06 09:00:16 -07:00
Aman Agrawal 3e7538b974 filter: Copy is_web_public_compatible from server to frontend.
This will be used to check if the narrow being requested by
spectator requires authentication without requesting the server.
Having this check locally, makes this process look snappy to
the user and doesn't result in 404s in the browser log.
2021-09-06 09:00:16 -07:00
Aman Agrawal 3ed833a7e4 hashchange: For hash that needs auth, prompt spectator to login.
For spectators, without sending any request to the server,
check locally if the hash requires authentication or which
shows a feature that requires authentication;
if it does, we show login_to_access modal to the user.
2021-09-06 09:00:16 -07:00
Aman Agrawal 045cdb4ed0 login_to_access: Modal which blocks access for spectator.
We will use this modal for any narrow / hash or other UI element that
requires an actual account to use, to provide something reasonable to
occur when a user clicks on those things.
2021-09-06 09:00:16 -07:00
Tim Abbott 79d313930b settings: Clarify newsletter documentation string. 2021-09-03 11:31:53 -07:00
Tim Abbott 191b1ac2be setting: Tweak strings explaining Zulip newsletter.
We ideally will also add a /help/ page explaining these with an
example, but it seems appropriate to make the labels frame it around
what sort of emails we actually intend to send (newsletters with
updates about Zulip, not a "drip campaign").
2021-08-31 17:12:16 -07:00
Sahil Batra fef825d56f settings: Rename class of notification settings elements.
We rename class of notification settings except checkboxes
by prefixing them with 'setting_' for clarity.

We do not change class of checkboxes because settings_checkbox
is used by other templates also and if we only change class
of those using notification_settings_checkboxes then live
update code will break and will need to add separate condition
for differentiating between which partial template is used.
2021-08-20 07:51:23 -07:00
Sahil Batra d05730a199 settings: Rename classes for display settings elements.
We rename the class of display setting elements by prefixing
them with 'setting_' for clarity.
2021-08-20 07:51:11 -07:00
Sahil Batra 9c17e7019d settings: Add 'user_' prefix to presence_enabled setting element.
This commit adds 'user_' prefix to presence_enabled setting
element such that we can have unique ids when we add a realm-level
setting for this.
2021-08-20 07:50:51 -07:00
Sahil Batra 02ce8531cc notification: Rename notification-sound audio and child elements.
This is a prep commit for adding UI for realm-level defaults
of user settings.
This commit renames notification-sound-audio element to
user-notification-sound-audio because we will be adding similar
element for realm-level default of user settings also.

We also change the child elements to have current id as their
class for the same reason.
2021-08-20 07:50:51 -07:00
Sahil Batra 032d347b4f settings: Refactor frontend code for notification settings.
This is a prep commit for adding UI for realm-level default
of user settings. We refactor the code to use  classes
instead of ids such that we can use the common code for the
new settings.
2021-08-20 07:50:51 -07:00
Sahil Batra 79fa7f9609 settings: Refactor change_display_setting to have url paramter.
This commit refactors change_display_setting function to accept
url as a paramter instead of directly using '/json/settings'
such that we can use the same function for realm-level settings.
2021-08-20 07:50:51 -07:00
Sahil Batra 9bd1ea229c settings_display: Refactor change_display_setting function.
This commit refactors change_display_setting function to
accept container element as a paramter and then determine
the correct status element from it. This is the prep commit
for adding realm-level default settings UI.
2021-08-20 07:50:51 -07:00
Sahil Batra c5cc4fb114 settings: Refactor default-language modal code.
We add a prefix to id of default_language_modal.hbs
such that we can use the same code for user settings
and realm-level settings.
We also add a class "default_language_modal" to the
modal div to avoid duplicate css.
2021-08-20 07:50:51 -07:00
Sahil Batra 3adf5e6383 settings: Refactor frontend code for display settings.
This is a prep commit for adding UI for realm-level
default of user settings. We refactor the code to use
classes instead of ids such that we can use the common
code for the new settings.
2021-08-20 07:40:20 -07:00
Aman Agrawal da11141eae click_handlers: Don't select message on clicking message_controls.
Note that opening the main message actions menu still selects the
message due to explicit code in toggle_actions_popover.
2021-08-20 07:31:26 -07:00
Sahil Batra 6117c3824a user groups: Hide system user groups temporarily from UI.
We hide the system groups from the typeaheads and the list
of user groups in settings page temporarily.
2021-08-19 02:56:45 -07:00
Sahil Batra 7ea3a53d49 settings: Remove unnecessary code.
We were using incorrect element as we changed the input from
select to radio buttons in 439bc2920a.
This code was originally added in 6cb03ea78e (though in a
different file) and was removed from sometime and then added
again in e7311cdf5d. But in the meantime the input was
changed to radio, which resulted in incorrect code.
2021-08-19 02:50:50 -07:00
Sahil Batra 7b74bd1428 settings: Fix incorrect elements used for emojiset loading spinner.
We were using emojiset_spinner element in destroy_indicator, but
there is no such element and emoji-settings-status element is used
in make_indicator, so destroy_indicator should also use the same
element.

This was added originally in 6cb03ea78e (though in a different
file) and was removed for sometime and then readded in e7311cdf5d.
But between these two commits, the setting was changed to be a
radio element and thus the spinner elements were also changed.
2021-08-19 02:50:50 -07:00
Eeshan Garg 190ce61eed landing-page: Fix mobile scrolling bug when sidebar is toggled.
On mobile, when the sidebar is toggled, the following three issues
are encountered:
- When none of the sidebar menus are expanded, the sidebar has no
  scrollbar, which is expected. But if you scroll, the background
  content scrolls, which is a bug.
- When some of the sidebar menus are expanded such that the content
  overflows and is "scrollable", once you get to the end of the
  sidebar content, the background content keeps scrolling in a weird
  way.
- If the mobile screen is wide enough, if you scroll the sidebar
  content, it scrolls as expected. But if you move the pointer to
  the side of the background content that is still visible, you
  can scroll the background content even though it should be fixed.

This commit fixes all of the above issues.
2021-08-17 06:23:46 -07:00
Sahil Batra 5459a92e4a setting: Use "unlimited" instead of "forever" for retention setting.
This commit updates both the stream-level and realm-level message
retention setting to use 'unlimited' instead of 'forever' to set
message retention setting to "retain messages forever".
2021-08-08 15:56:57 -07:00
Sahil Batra 0e5b2326b2 stream settings: Rearrange personal stream settings.
We rearrange the personal stream settings to show all the
notification settings together under a separate heading.

Fixes #19508.
2021-08-08 15:05:56 -07:00
akshatdalton 1a63c2d187 notification: Fix "narrow to..." link present above composebox.
Earlier copy to the link present above the composebox (which
appears when a message is sent outside the current narrow), it
used to provide the link to the home page which is fixed now.
Now, copy to the link gives the link of the narrow where message
is sent.
2021-08-07 09:51:04 -07:00
Ganesh Pawar 378395bcc4 user_status: Show change status modal when clicked on emoji in buddy list.
Fixes #19506
2021-08-07 07:19:03 -07:00
Eeshan Garg f2d58f1d5d landing-page: Fix flickering sidebar transition upon resizing.
When one resizes the window and tries to switch to the vertical
sidebar menu, the CSS transition flickers in and out. This is
less than ideal.

This commit implements a solution to this problem. The solution is
inspired by the following helpful article:

https://ishadeed.com/article/layout-flickering/
2021-08-07 06:22:29 -07:00
Eeshan Garg 132498894f header: Stop trying to detect if touch is enabled for click events.
We found a bug in our top-level nav on certain Samsung phones where
tapping on the dropdowns didn't do anything. As it turns out, trying
to figure out whether touch is enabled on a device using CSS media
queries such as `(hover: none)` is very tricky business! While it
may work on some devices, it may break spectacularly on others.

This commit presents a potential solution to this. Media queries
about widths are a lot more device-independent than hover media
queries. So, this is what we do now:

- We fire click events regardless of whether the top-level nav is in
  the vertical sidebar orientation or the horizontal orientation.
  Since we are no longer dependent on hover media queries for click
  events, this fixes the mobile bug mentioned above because taps or
  clicks will always work regardless of device.
- The mouseover/mouseout events are only fired when the header is
  in the horizontal orientation and the primary input mechanism
  supports hovering over elements. This allows us to support hovering
  over menus on desktop. However, since mouseout/mouseover events are
  irrelevant for mobile, we are fine on that front since clicks/taps
  will still work.

NOTE that the above approach also takes care of weird edge cases where
you have a horizontal orientation on a device such as the iPad Pro that
is flipped in the horizontal position. Since clicks work anyway, these
edge cases are largely taken care of.
2021-08-07 06:22:29 -07:00
Anders Kaseorg b44e6123fe gear_menu: Fix template variables passed from page_params.
Commit 9049fb3bd4 (#19176) broke these
by changing {page_params} to {...page_params}.  We could change it
back, but it’s better to be explicit about which items we use from
page_params.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-07 06:19:43 -07:00
Priyam Seth 5a4318d046 compose: Fix compose fade not updating on deleting user pill.
This commit makes the compose.update_fade as an exported
function and adds the listener to update the fade manually
as deleting the pill was not calling this functions.

Fixes #18865
2021-08-06 14:22:55 -07:00
Steve Howell ea6929457c unread: Add get_read_message_ids() helper.
We only use this is in tests for now, but it will be
helpful to mark messages as unread in an upcoming PR.
2021-08-04 12:06:11 -07:00
Steve Howell 8ac0beefcf refactor: Use named parameters for UnreadTopicCounter.add(). 2021-08-04 12:06:11 -07:00
Steve Howell 09d0652bdd refactor: Use user_ids_string more internally.
We want to avoid passing opaque messages around to
low-level functions that only need certain fields.

This sets us up to handle mark-as-unread messages
that aren't necessarily full messages.
2021-08-04 12:06:11 -07:00
Steve Howell f7e5847b5c unread: Avoid use of opaque message.
We only care about ~8 fields from a Zulip message
when we're tracking unread counts. For example, we
don't care about the "content" field. This also sets
us up to pull up the "display_recipient" logic in an
upcoming commit.
2021-08-04 12:06:11 -07:00
Steve Howell 80edf7456c unread: Extract process_unread_message.
This will facilitate adding mark-as-unread events in
the (hopefully near) future.
2021-08-04 12:06:11 -07:00
Riken Shah e5b216fc64 compose: Update status text in placeholder instantly after it's updated.
When compose box is opened to self and the user
updates the status, it should instantly update the status
text in a placeholder.
2021-08-04 01:11:06 -07:00
Anders Kaseorg 42fa62e563 Revert "time_widget: Make the generated time string more readable."
This reverts commit 1965584eec.

This syntax has a bad interaction with table syntax and needs to be
rethought.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-03 16:45:31 -07:00
Sahil Batra aefab3d898 settings: Fix incorrect usage of user_settings.
'corporate_enabled', 'realm_push_notifications_enabled'
and 'realm_digest_emails_enabled' settings are part of
page_params and not user_settings.

This was introduced in 998d710275.
2021-08-03 10:27:38 -07:00
Ganesh Pawar 1965584eec time_widget: Make the generated time string more readable.
Before: <time:2021-07-14T00:14:00-07:00>
After: <time:2021-07-14|00:14:00|UTC-07:00>

Fixes #19205
2021-08-02 23:17:01 -07:00
Riken Shah d6286e76c8 user status: Fix keyboard UI in status emoji picker.
Previously, the keyboard UI functions were not being called because of
the order of operations of keyboard checks.
2021-08-02 13:43:32 -07:00
Riken Shah e47179fc35 hotkey: Avoid Enter opening compose when modals are open. 2021-08-02 13:40:10 -07:00
Riken Shah 8210daefc8 user status: Fix custom emoji not loading during page load.
The reason for this was we were not loading extra
parameters while storing the status emoji object.

For this we also need the emoji module to be initialized
early because the right sidebar would need it to display
the status emoji.
2021-08-02 13:38:51 -07:00
Tim Abbott 8755a76cf6 user_settings: Add types for all managed settings. 2021-08-01 15:30:17 -07:00
Sahil Batra 998d710275 frontend: Add new user_settings module for user's settings.
We add a new user_settings module similar to page_params
module in frontend and use it to access user's personal
settings instead of page_params.
2021-08-01 15:30:17 -07:00