Commit Graph

12738 Commits

Author SHA1 Message Date
m-e-l-u-h-a-n c6f8b9d807 profile: Add unsubscribe button in user profile modal.
We add unsubscribe button in the stream list that allows
users and admins to unsubscribe them using profile modal.

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

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

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

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

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

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

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

This fixes a bug introduced in 0e65225d06.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #13766.

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

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

This now also adds tests for user_pills.

Part of #13766.

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

Part of #13766

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-21 16:38:11 -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 8c65b971c6 stream_creation_form: Replace `everyone` with `public` in stream_privacy_policy.
The passed `stream_privacy_policy_values` object
doesn't contain the `everyone` property.
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
Aman Agrawal ad59fae407 lightbox_overlay: Fix `&` not being rendered as desired.
The attempt to render `&` doesn't work. So, just replacing it
with `and` to make it always work.
2021-06-20 12:46:30 -04: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 f453db0df2 about_zulip: Mark strings for translation. 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
m-e-l-u-h-a-n 4c319268a1 templates: Remove form-inline class from stream setting forms.
It is a class provided by bootstrap and one of its most
important job is to set the display of inputs and labels in
the form in such a way that if there is sufficient
horizontal space then they are shown side by side.

As we override most of the bootstrap classes to organize
content, CSS rules set by it were not applied. So we remove
these safely without having any visual changes. Also, we had
only three instances of this class in the complete template
directory.
2021-06-18 12:24:02 -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
Tim Abbott 1b91545b37 subs: Document adding user groups to streams. 2021-06-16 16:30:43 -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 f26a76a9d8 message_controls: Hide irrelevant icons for spectators. 2021-06-16 10:19:07 -07:00
Aman Agrawal 0a84123f0b recipient_row: Hide edit & mute icons for spectator. 2021-06-16 10:18:27 -07:00
Aman Agrawal 5ffc95f6bb compose: Show login and hide drafts for spectators. 2021-06-16 10:18:22 -07:00
Aman Agrawal b99a720012 left_sidebar: Hide "Add streams" widget for spectators. 2021-06-16 10:16:40 -07:00
Aman Agrawal c0f23569b8 navbar: Show login button for spectators. 2021-06-16 10:16:04 -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
Wesley Aptekar-Cassels f08555bb31 shared: Bump version to 0.0.6. 2021-06-15 14:40:58 -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 50362a8c39 poll 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
Signior-X c1833b74f0 login: Remove browser show password in IE, edge.
The Microsoft browsers such as IE and Edge has their own
show password that is a bit bugy and also conflicts with
the show password in Zulip that was added in #17305.
This fixes the issue by making the display none for the
ms-reveal that comes in the input.

More details can be found at
https://chat.zulip.org/#narrow/stream/101-design/topic/Show.20password/near/1173890
2021-06-14 16:35:25 -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
Tim Abbott 8181a2fe57 css: Remove unnecessary font sizes in stream settings. 2021-06-11 17:15:46 -07:00
Tim Abbott 95efadaf86 css: Use default font size for buttons and dropdowns. 2021-06-11 17:15:45 -07:00
Tim Abbott 7291f2c1ca css: Avoid hardcoding font size in input pills.
This also fixes horizontal alignment issues when scaling.
2021-06-11 16:59:35 -07:00
Tim Abbott 6a7d4d96c5 settings: Fix size of dropdown_list_widget elements.
We remove the small CSS class, which set the font size as something
tiny, and also restructure it with a fixed height and more natural
markup for the reset link.
2021-06-11 16:58:52 -07:00
Tim Abbott 579a9d60e9 css: Remove 15px font usage in full profile.
Together, these larger font size declarations made the modal look
worse, in addition to just being inconsistent with the rest of the
app.
2021-06-11 16:03:39 -07:00
Tim Abbott 64f9721ce5 css: Use default font size for user search icon.
This icon always looked really small, so it's probably visually better
this way, and this lets us remove an unnecessary font-size override.
2021-06-11 16:03:39 -07:00
Tim Abbott 18bcff8c96 css: Remove font-size for message_edit_tooltip.
This looks better with the default font-size, though it needs an
alignment fix.
2021-06-11 16:03:39 -07:00
Tim Abbott 8efa8e378d css: Simplify preview_message_area CSS. 2021-06-11 16:03:39 -07:00
Tim Abbott 9a5b0b4f0a css: Remove useless undo_markdown_preview CSS.
These properties had no effect, since the compose_control_button CSS
has the same effect.
2021-06-11 16:03:39 -07:00
Tim Abbott 147e243113 css: Use default font for left sidebar private messages.
Previously, this used a slightly smaller font size than the default.
Given that it looks visually fine to use the default font size, it's
better to remove this inconsistency.

It's also worth noting that we plan to move this component to be
parallel to STREAMS in a way that is likely to also want the new font
size, so this is a step towards that goal.
2021-06-11 16:02:56 -07:00
Tim Abbott f5369db8f1 css: Remove duplicate specifications of default font size.
These unnecessary references to 14px font size complicate any effort
to adjust the font size in Zulip.
2021-06-11 15:11:33 -07:00
Tim Abbott 01bfb621ba css: Rename settings forgot password CSS class.
"info" in not a sensible name for a broadly used CSS class.
2021-06-11 15:08:45 -07:00
Tim Abbott 90041ff453 css: Deduplicate CSS for message_control_button elements.
Each copy set the same 3 properties, with the actions menu relying on
the terribly named "info" class for its copy.
2021-06-11 15:08:14 -07:00
Tim Abbott 1298b4a0d2 css: Remove font size hardcoding of save/discard button. 2021-06-11 15:08:14 -07:00
Tim Abbott ff93176743 css: Remove special font size for settings errors.
These errors look fine with our normal font size, and it's one less
thing to potentially test.
2021-06-11 15:08:14 -07:00
Tim Abbott e77bb84988 css: Remove invalid widgets CSS.
This green font block seems to apply to a TODO widget that is also a
poll, which doesn't exist.
2021-06-11 15:08:14 -07:00
Tim Abbott 420500ab25 user_profile_modal: Fix duplicate 'Last active' notice.
This fixes a regression in 16bd6e6b1d
that caused the user profile modal to display "Last active: Last active: ...".

I'm not convinced these are the best visuals, but the whole modal
needs a visual refresh.
2021-06-11 07:59:59 -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
Aman Agrawal 2f46b80005 left_sidebar: Use padding instead of margin around clickable icons.
For create stream icon specially, this is useful to allow user having
some extra space around the icon to click.

This fixes the bug that you can have the tooltip of "Add streams" and
by hovering at the bottom of `+` icon but clicking on it shows stream
search.
2021-06-10 09:01:43 -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 a9a712fee3 subscription_table_body: Add tippy tooltip to create_stream_button. 2021-06-08 14:55:48 -07:00
Aman Agrawal e6f38f9bc2 css: Remove bad color change of create stream button.
This color change make the button less visible on hover which
doesn't makes sense.
2021-06-08 14:55:48 -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
Tim Abbott 8da54af3a0 presence: Fix confusing "active" label for "not unavailable".
The Help Center article talks about these using similar terms, which
may need further work, but it seems clear that undoing "set
unavailable" should be "set available", not "set active".
2021-06-08 12:09:10 -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
Wesley Aptekar-Cassels 5c4db6ec41 compose: Increase opacity of icons.
The icons at the bottom were previously too low-contrast, so bump the
opacity up to 0.7 from 0.4.
2021-06-07 17:53:44 -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 ac360b3a6b left_sidebar: Increase font size of STREAM header icons.
Font size increased from 13px to 14px to allow users to click easily;
this was already the default, so we can just delete the line.
2021-06-07 14:14:02 -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
aryanshridhar fcff3cc5da popovers: Migrate user status indicator tooltip to tippy.
Replaced the existing HTML tooltip with tippy.js for user
status indicator within the user info popover.
2021-06-05 07:32:59 -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
Tim Abbott 20c629f327 compose: Clarify title for wide reply button.
This changes the button text from "Reply" to "Reply to selected
message". Here's the thinking:

* The title "Reply" was a little confusing/inconsistent with the
  button's label.

* If you're hovering over the button, it's because you want more
  information about what it does -- not just a repeat of the button's
  label.

* The "Message foo > bar" content of the button already cleanly
  expresses what the button will do if you click it right now.

* The hover text "Reply to selected message (r)" explains to you what
  that button's role is in all situation, not just with the current
  selection, and thus documents the concept.  And it also gives you
  clarify if you're thinking "but how do I reply to something in
  Zulip?" and try hovering over the buttons at the bottom to find out.
2021-06-04 09:18:59 -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
sahil839 f827debe9d settings: Move move-message-between-stream setting to "Message Editing".
This commit moves "Who can move messages between streams" setting to
"Message Editing" section.
2021-06-03 17:13:32 -07:00
sahil839 4d20bce6e4 settings: Move message edit settings to "Organization Permissions".
The message-editing section of settings is moved from "Organization
Settings" to "Organization Permissions", which feels like a more
natural place for these settings.
2021-06-03 17:13:32 -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 75034bb767 settings_orgs: Add hover like effects on focus for save-discard buttons.
This uses the same effect as hovering over the button when they are
focused using keyboard shortcuts such as Tab or Alt + Tab.
2021-06-03 12:41:10 -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 0f3d45f078 settings: Use `user-plus` icon instead `plus-circle` icon for invites.
To show invite user icon, we use `user-plus` icon.
2021-06-02 20:40:54 -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
Robert Imschweiler 31322be598 css: Make login-social-button responsive to larger fonts. 2021-06-02 20:23:33 -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
Siddharth Asthana a4fcbcd4aa static: Fix the incorrect warning message when unsubscribing from stream.
Fixes #18661
2021-06-01 14:58:47 -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
Aman Agrawal 36051877a5 recent_topics: Optimize for mobile devices.
On small widths, add margin to right to action buttons so
that they don't they trigger scrollbar when clicked upon.

Make action buttons larger so that they are easier to click / tap on small
widths.
2021-06-01 08:32:06 -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
Anders Kaseorg 80b6808de0 draft: Fix incorrectly centered topics in drafts modal.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-28 15:44:19 -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
Adam Birds ee375e2999 integrations: Add Freshstatus webhook integration. 2021-05-27 23:38:11 -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
Adam Birds 303bb61f9c integrations: Add Sonarr Integration. 2021-05-26 17:12:28 -07:00
Adam Birds 17fe2e4a08 integrations: Add Radarr inegration. 2021-05-26 17:11:57 -07:00
Adam Birds 11e7f27031 integrations: Add Lidarr integration. 2021-05-26 17:11:24 -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
Nikhil Maske 725f975e96 left_sidebar: Set the width of stream-list-filter to 236px. 2021-05-25 19:49:49 +05:30
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
slefforge 99097b10fc help: Fix formatting on stream-permissions table legend.
This is a bit hacky, but it avoids the legend being weirdly
misaligned.

Fixes #18062.
2021-05-23 12:04:11 -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
Anders Kaseorg 9d290798eb templates: Escape some unescaped > and & characters.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-20 12:09:47 -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 f4891e7e4f minor: Simplify `usermention` regex and properly use capturing groups.
In the old regex, there was no 4th capturing group, hence
cap[4] always gives `undefined`. It is removed now.

Also, we were capturing the whole pattern which is not needed
as it is by default captured in the group with the 0th index.
2021-05-20 11:35:04 -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
Aman Agrawal ddfb9b5200 tippy: Increase font size from 12 to 13px.
Increasing the font size for clear visibility.
2021-05-19 11:20:49 -07:00
sahil839 48761208f0 css: Change width of upgrade-tip and to max-content.
We change the width of upgrade-tip to be max-content
such that it matches with the other elements in
settings overlay like dropdown, which are not of full
width.
2021-05-19 11:04:32 -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
Nikhil Maske 1428310973 muted_user_settings: Add table-sticky-headers class to table header.
table-sticky-headers class is used to make the header of the
table fix at the top.
2021-05-18 17:36:13 -07:00
PIG208 4e8dd43841 devtools: Improve the appearance of dev_panel. 2021-05-18 17:35:29 -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
Vishnu KS 51ef5d62ad billing: Add ignored_inputs paramater to create_ajax_request. 2021-05-14 15:10:02 -07:00
Vishnu KS d9baa681b2 billing: Use PATCH request for changing plan status.
I think it's much more cleaner to use PATCH request on
/json/billing/plan than using a POST request on
/json/billing/plan/change to update the plan.
2021-05-14 15:10:02 -07:00
Anders Kaseorg e015f3ed7d docs: Correct “webapp” to “web app”.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-14 13:15:38 -07:00
aryanshridhar 056e7d1a36 dropdown_list_widget: Add 'type' attribute to reset button.
Previously, when a user hits 'Enter' key within a input
field it incorrectly triggers the dropdown_list_widget's
reset button.

This is because the reset button had the default type attribute of
'submit' which triggers the click event binded to it. Fixed it by
explicitly defining it's type attribute to be a button.
2021-05-14 13:06:59 -07:00
Aman Agrawal 987acd93f4 message_edit_form: Fix vertical alignment of bottom elements. 2021-05-13 17:11:29 -07:00
m-e-l-u-h-a-n ab1c656c58 recent-topics: Fix tooltip placement for time in recent-topic row. 2021-05-13 15:28:01 -07:00
Tim Abbott 3edb9b8ed6 tooltips: Use TippyJS for all message_control_button tooltips.
The inconsistent style between these three buttons looked bad.

We have to take some care with the "Starred messages" and "Edit" ones,
to make sure they live-update properly.
2021-05-13 12:56:38 -07:00
aryanshridhar 2e334bec89 dropdown_list_widget: Add 'type' attribute to template.
Previously, when the user presses 'Enter' within a input
field while keyboard focus in is in the topic edit textbox
it incorrectly opened the dropdown list widget.

This is because the dropdown button had the default type attribute of
'submit' which triggers the click event binded to it.  Fix it by
explicitly defining it's type attribute to be a button.

Fixes #18415
2021-05-13 12:54:01 -07:00
aryanshridhar 352acdcc36 dropdown_list_widget: Properly bind focus to dropdown elements.
Previously, the focus event tends to skip the first
element within the dropdown list when the user presses
the down arrow.
Added a stopPropogation event for keydown handler within
dropdown_list_widget which propoerly binds the focus
event to the dropdown list items.
2021-05-13 12:51:49 -07:00
m-e-l-u-h-a-n 480c5cbc01 recent topics: Fix placement of tooltips in recent topic rows.
It is a follow up for #18451.
2021-05-13 11:43:48 -07:00
Anders Kaseorg 668b5137b0 version: Display Zulip version in About Zulip dialog.
We record Git details about the merge-base with upstream branches in
the zulip-git-version file, if the upstream repository is available.

Note that the first Git upgrade after merging the parent commit will
not include the merge-base details, since the upstream repository will
not have been available.

Co-authored-by: Tim Abbott <tabbott@zulip.com>
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-13 11:36:12 -07:00
Tim Abbott dc33b2a515 message_controls: Show keyboard shortcut for emoji button. 2021-05-13 10:06:43 -07:00
Tim Abbott 014e8c9f6c emoji_picker: Remove title attribute hackery. 2021-05-13 10:05:11 -07:00
Tim Abbott 13a2c9712f message_controls: Remove duplicate title element. 2021-05-13 10:04:19 -07:00
Tim Abbott 889e98f467 popovers: Display move topic option to all users with permission.
Previously, the "Move topic" option was only displayed to organization
administrators, despite the new setting making who can move topics
between streams configurable.

Making this migration requires us to remove the text on the previous
"Admin actions" divider, and just make it an hrule, to avoid confusing
normal users, while still providing a hint that moving topics is a
non-personal operation.

We also change the ordering for consistency.
2021-05-13 09:22:14 -07:00
Tim Abbott 61e1f5eb37 settings: Use consistent dropdown widths for permissions. 2021-05-13 08:42:24 -07:00
sahil839 c7d4640af5 setting: Add dropdown for managing who can move messages between streams.
This commit adds the dropdown in 'Stream settings' section of organization
permissions page to control who can move messages between streams and
also hides the stream-edit UI in message-edit form accordingly.

Fixes #14499.
2021-05-13 08:42:24 -07:00
Tim Abbott 41a477bbfb lint: Fix tab-based whitespace in uploaded_files_list.hbs. 2021-05-13 08:01:47 -07:00
akshatdalton bad3fe40e5 alert_word_settings: Fix table heading.
For edit/delete actions table heading should be `Actions`.
2021-05-13 07:52:10 -07:00
akshatdalton 43498c9ebd uploaded_files_list: Reorder download and delete buttons.
The download button should come before the delete button.
2021-05-13 07:52:10 -07:00
akshatdalton 23dc3bf995 settings: Reorder edit and delete buttons.
The edit button should come before the delete button.
2021-05-13 07:52:10 -07:00
Abhijeet Prasad Bodas a377a2df8b pm_list: Use "Muted user" placeholder for muted usernames.
This also handles a few other places missed earlier like
narrow headings, beacuse they use the same function.

We already rerender the PM list for events, so there's no
need to do anything special when someone is muted/unmuted.

`people.get_full_names` is now only used in the settings pages
while creating ListWidgets etc, so we add a new test for
it to ensure coverage.
2021-05-13 07:51:21 -07:00
akshatdalton 3015837e6e linkifier: Remove unnecessary on-success update on deleting linkifier. 2021-05-12 20:32:35 -07:00
akshatdalton a3930d8804 edit_linkifier: Improve UI for error message display on modal. 2021-05-12 20:32:35 -07:00
akshatdalton 7632541afb edit_linkifier: Remove unnecessary error message display.
We want the error message that we get on editing the
linkifier to be displayed only on the edit linkifier modal.
2021-05-12 20:32:35 -07:00
Aman Agrawal 91d32b1512 recent_topics: Extend the borders to bottom of window.
When height of topics is less than window height, the borders
don't reach bottom. So, we min-height for the table to make it
span to the bottom.
2021-05-12 15:45:08 -07:00
Aman Agrawal 3cb7ffd61a hotkey: Render default_view via changing hash.
Directly rendering the default view on pressing `escape` key will lead
to default_view being rendered on the current window hash.  So, we set
empty hash to load default view and let hashchange handle it.

This fixes a bug introduced in
59a45d3521.
2021-05-12 15:24:10 -07:00
Tim Abbott 3d6af7a3c8 typeahead: Fetch stream topic history from server.
Long ago, we changed Zulip to inspect server-provided topic history in
our compose and search typeahead modules, but did not trigger a query
to the server to fetch data.

This could result in confusing experiences where someone thought that
a topic doesn't exist that just isn't present in recent history.

Once we merge this, we may want to adjust the messaging in typeahead
to advertise that the first option will create a new topic, since this
change may make it feel more like creating topics is a heavyweight
operation.

Fixes #9857.
2021-05-12 15:21:25 -07:00
Anders Kaseorg 879ca4543b favicon: Catch exceptions in update_favicon.
We’re getting unexplained exceptions from URL.createObjectURL in
Firefox 88 (#18374); contain them to this function.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-12 15:06:59 -07:00
Tim Abbott b67b9912c4 drafts: Fix hook for saving drafts.
Previously, the hook to save drafts when closing the compose box was a
focusout on #compose-textarea. This mostly worked, and was essentially
invisible to users (because the animation to notify you about saved
drafts was in the close_compose_ui widget that is hidden), but you'd
end up seeing the tooltip appear (in the wrong place) if you closed
the compose box immediately after sending a message with Tab+Enter.

The correct fix is for the drafts hook to be just before we start
clearing compose box state, inside hide_box.

This was difficult to catch in a development environment, since one
doesn't use that flow with "Enter sends" enabled.
2021-05-12 12:53:58 -07:00
Tim Abbott ad4c5890aa portico: Make apps selector easier to see. 2021-05-12 11:58:14 -07:00
Tim Abbott 06f1ea657e navbar: Adjust label for usage statistics. 2021-05-12 10:34:12 -07:00
Tim Abbott b0f8bbfbd4 recent_topics: Fix annoying flicker on rerendering.
We were apparently not using the ListWidget API for replacing the
content of a widget without removing the whole thing from the DOM and
replacing it.

Unless ListWidget has unexpected bugs, this should have the exact same
result as the previous logic, with much a nicer user experience.
2021-05-12 10:02:48 -07:00
Tim Abbott 4dae2c53fb recent_topics: Make muted user avatars a bit less bright. 2021-05-12 09:38:36 -07:00
Abhijeet Prasad Bodas 336b791f8b recent topics: Use tippy tooltip instead of HTML title. 2021-05-12 09:30:24 -07:00
Abhijeet Prasad Bodas ed8faf1374 recent topics: Rename some HTML classes for readability. 2021-05-12 09:30:24 -07:00
Abhijeet Prasad Bodas e5a339df25 recent topics: Handle muted user avatars in participants.
We use styling same as that of the number shown for overflow
(e.g "+3") which has a gray background.
To keep these avatars up-to-date, we need to rerender the
recent topics view after receiving a `muted_users` event.

Also update the user documentation to mention this detail.
We deliberately avoid mentioning "recent topics" because
this applies to mobile too.
2021-05-12 09:30:24 -07:00
Abhijeet Prasad Bodas e4cbfcaf1d recent senders: Rename sender_info getter function for brevity.
We will also later use this function for attaching other
information to it like whether the sender has been muted
or not.
2021-05-12 09:30:24 -07:00
Tim Abbott cf69ce166c recent_topics: Avoid unnecessary rerenders via repeated Esc.
This also prevents unnecessary rerenders when changing the URL between
"#recent_topics" and "#" when it's the default view.
2021-05-12 08:42:29 -07:00
Tim Abbott 9e812c5683 hashchange: Show default view behind overlays on load.
This seems more consistent with what users would expect; Recent topics
may be a better default view in general, but if a user has picked
another default view, we should use that where the default view is
desired.
2021-05-12 08:42:24 -07:00
Tim Abbott c690fa1174 compose_closed_ui: Avoid duplicate button in recent topics. 2021-05-11 23:57:57 -07:00
Tim Abbott 8e7761e15b compose: Move closed-compose functions to closed_compose_ui.js.
This improves the organization of our codebase a bit.
2021-05-11 23:57:57 -07:00
Tim Abbott 9239de408a compose: Remove now unused nonexistent_stream_reply_error.
This was a holdover from the legacy "reply" button behavior; with the
new wide button model, it just becomes a normal "compose" button.
2021-05-11 23:57:57 -07:00
Aman Agrawal 0d8a7efa09 compose_closed_ui: Show default label for empty narrows.
The default label for empty narrows depends on whether it's a
stream/topic narrow or a PMs narrow.

We leave some default text in compose.hbs for reply label
because it take some time for the js to display the
correct label.
2021-05-11 23:57:57 -07:00
Aman Agrawal 98b9c7284e recent_topics: Update reply button on topic row click.
Use can stay in recent_topics after clicking on mute and
read button, so we need to update reply button text here.
2021-05-11 23:51:01 -07:00
Aman Agrawal d8f554eb52 recent_topics: Set default text for reply btn when not focused in table.
When user is focused in search or filters, show "Compose Message"
as label which is more appropriate.
2021-05-11 23:51:00 -07:00
Aman Agrawal 7ab562d138 compose_closed_ui: Set text directly to compose_reply_button_label.
This will allow us set other text to it without making us restore
this html fragment when we replace it.
2021-05-11 23:51:00 -07:00
Sumanth V Rao 72ead6e097 playgrounds: Rename `name` field to `playground_name`.
The browser seems to autofill the `Name` field of the add-playground
form. Most likely this behavior is a result of  value of the `name`
input field being `name`, causing the browser do to something weird
here. This name is now changed to `playground_name`.
2021-05-11 20:47:41 -07:00
Tim Abbott 6a374d6d28 drafts: Replace notification when saving a draft.
The old logic, inline in the compose area, has produced a very weird
effect where the buttons would move to fit the notification, ever
since design changes to use the full bottom row space.

We address this by just using a Tippy tooltip instead.
2021-05-11 15:01:25 -07:00
Tim Abbott 23b544d613 compose: Move drafts button to right end of bottom row.
This avoids it breaking up the list of buttons that start a message, a
state introduced when we moved the Reply button from right to left.
2021-05-11 14:09:48 -07:00
Abhijeet Prasad Bodas 421cf05176 people: Deduplicate get_full_names logic.
Share code between `safe_full_names` and `get_display_full_names`
functions, and rename `safe_full_names` to `get_full_names_for_poll`,
because that was the only place where this was used earlier.

This also has the nice side effect of showing "Muted user" instead
of the muted username in poll results.
2021-05-11 13:21:38 -07:00
Aman Agrawal 96565ee1d1 hashchange: Rename activate_home_tab for clarity. 2021-05-11 11:26:57 -07:00
Aman Agrawal 59a45d3521 hashchange: Render default view on empty hash.
Instead of changing the hash to the default_view hash, we render
the default_view directly in case of recent topics and all messages.

This also fixes the bug that user is unable to go back in
browser window history.
2021-05-11 11:26:57 -07:00
Aman Agrawal f95443ac8f recent_topics: Use is_visible for testing if RT is rendered.
We don't want to rely on browser hash to check if RT is visible
because soon we want to display default_view without any hash
and RT may or may not be visible in that hash.
2021-05-11 11:26:57 -07:00
Anders Kaseorg 5ca763fc24 eslint: Fix unicorn/prefer-switch.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 19:26:41 -07:00
Anders Kaseorg 04569bc17e settings_org: Remove unused case for realm_zoom properties.
Commit 4d04fa3118 (#11874) removed those
properties.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 19:26:41 -07:00
Anders Kaseorg a284299b85 eslint: Fix unicorn/prefer-array-flat.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 18:07:13 -07:00
Anders Kaseorg 42abc1b635 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 18:07:13 -07:00
Aman Agrawal 512f16690a settings_streams: Use hash_util to check if settings is open.
Since both `organization` and `settings` are category of hash,
we can simply check if the current hash's category is among
them.
2021-05-10 17:55:03 -07:00
Aman Agrawal 570306fa69 subs: Use hash_util to get stream id.
Active stream's hash look like this - `#streams/1/announce`
Since the stream_id is present where typically hash section
is for all other hashes, get_current_hash_section should return
the same result.
2021-05-10 17:55:03 -07:00
Aman Agrawal b180c245b4 subs: Use hash_util to check if user is in "#streams/new". 2021-05-10 17:55:03 -07:00
Aman Agrawal b6f14c54e5 subs: Move active_stream function to hash_util.
This function better belongs in hash_util since it relies on
the current window hash.
2021-05-10 17:55:03 -07:00
Aman Agrawal c6a934da4c reload: Use hash_util to get current hash encoded.
We do this change to limit the use of window in other modules,
specifically window.location.hash.
2021-05-10 17:55:03 -07:00
Aman Agrawal e7129af8ac hash_util: Extract functions to be reused without `window`.
These functions can now be used in other libraries without
using window.location.hash in them and directly calling these
functions.
2021-05-10 17:55:03 -07:00
PIG208 d8db797798 doc: Fix configurations for images in the doc of newrelic.
The screenshot generating mechanism doesn't work for newrelic and
causes error because its configuration file doesn't exist. This
commit fixes the configuration and re-generate the screenshots.
2021-05-10 17:50:32 -07:00
PIG208 9b48a36b91 tools: Add support to generating bot avatars for non-webhook integrations.
New bot avatars are generated with this tool. Having the avatars generated,
we can run generate-integration-docs-screenshot to generate the doc
screenshots.

Fixes: #17792
2021-05-10 17:50:32 -07:00
aryanshridhar 69e3b9c7ec keydown_util: Add comments documenting keys. 2021-05-10 17:32:16 -07:00
aryanshridhar 9f9259683c settings_panel: Bind vim keys to SettingsPanelMenu.
Added a commit to bind vim keys with the SettingsPanelMenu,
allowing users to control the settings and organization tabs
using 'h','j','k' and 'l' keys.

vim_left('h') -> Switch between tab by shifting focus to the left.
vim_right('l') -> Switch between tab by shifting focus to the right.
vim_up('k') -> Move up.
vim_down('j') -> Move down.
2021-05-10 17:30:10 -07:00
Abhijeet Prasad Bodas 67cd385cec mute user: Add user documentation page.
Also link to it from the API documentation page,
other help pages, and the confirmation dialog for
muting a user.

With substantial edits by tabbott and alya.
2021-05-10 17:10:40 -07:00
Abhijeet Prasad Bodas 9519221bb5 mute user: Remove development environment checks. 2021-05-10 16:38:21 -07:00
Tim Abbott f83bea76a2 compose: Revert placeholder styling for bottom reply button.
* Revert "frontend: Remove hover effect from small messagebox."
  This reverts commit 27d9643274.
* Revert "frontend: Use placeholder style for small messagebox text."
  This reverts commit 8453aac260.
* Revert "frontend: Make "Reply" button look more like a textbox."
  This reverts commit 9fdd7184c6.
2021-05-10 12:54:30 -07:00
Abhijeet Prasad Bodas 35fb095f61 confirm dialog: Allow specifying /help links.
This makes it easy for users new to a feature to learn
about more it when confirming the action.
2021-05-10 12:36:39 -07:00
Abhijeet Prasad Bodas 22053d8399 people: User "Muted user" placeholder for muted usernames. 2021-05-10 12:36:39 -07:00
Abhijeet Prasad Bodas 5bcc96508d refactor: Extract people.get_display_full_names.
This deduplicates code used to generate message group headers
and the reactions tooltip.
2021-05-10 12:36:39 -07:00
Gaurav Pandey 756ee2c055 right-sidebar: Replace invite-link height with shortcut height.
To calculate the max-height of buddy_list_wrapper, we use
invite-link-height. This works alright if inviting is enabled
for all. However for users who aren't permitted to invite,
the element does not render, hence the logic uses `0` as
default value for subtraction in `get_new_heights` function
under resize.js. This leads to the keyboard-shortcut icon
rendered below the browser window. Hence use the parent div
`right-sidebar-shortcuts` height for the logic.
2021-05-10 12:10:41 -07:00
Gaurav Pandey 96e035a2f0 api: Fix encoding of strings in streams endpoint.
* Remove unnecessary json_validator for string parameters.
* Update frontend to pass right parameter.

Bump api feature level and highlight the fix for `emojiset`
parameter of `settings/display` endpoint in zulip.yaml file.

Fixes part of #18035.
2021-05-10 10:29:22 -07:00
Gaurav Pandey 9abe1cafbe api: Fix encoding of strings in display settings endpoint.
* Remove unnecessary json validator for string validator.
* Update frontend to pass right validator.
* Update zulip.yaml to pass right parameter for curl request
  in openapi.
* Update python_examples to pass right paramater.

Fixes part of #18035.
2021-05-10 10:03:32 -07:00
Anders Kaseorg 544bbd5398 docs: Fix capitalization mistakes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 09:57:26 -07:00
Anders Kaseorg 41e8872b0f realm_playground: Stop using Map incorrectly.
Commit ad76df25ac (#18405) uses Map
incorrectly.  A JavaScript Map needs to be indexed with .get() and
.set(), not with [].

Also, clean up the API: ‘lookup_table’ is a meaningless variable name,
and there was no information in the array that wasn’t also in the Map.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-09 22:01:00 -07:00
PIG208 7150fe5dc5 backend: Extract check_update_message from update_message_backend. 2021-05-09 20:44:04 -07:00
Ryan Rehman 5041616adb panels: Fix incorrect frb positioning.
The previous `top_offset` calculation didn't include the height
of the panels which led the calculations to be performed as if
a portion which was hidden behind the searchbox, was visible to
the user.

The new formula is corect as the frb_top calculation in
panel.resize_app also uses panels_height.
2021-05-09 20:42:27 -07:00
Ryan Rehman aa00ef3a32 refactor: Remove hardcoded frb height. 2021-05-09 20:42:27 -07:00
Adam Birds 589a7799dc integrations: Add Uptime Robot integration.
Note that the documentation cannot fully use our macros, because
Uptime Robot requires an & of the end of the URL, because of how it
passes its payload.

Fixes #13854. Fixes #13939.
2021-05-09 20:34:19 -07:00
Tim Abbott 831b7ca965 css: Fix style for buttons that are just a pencil icon. 2021-05-09 20:29:06 -07:00
Tim Abbott 1d9b5ffa92 lint: Fix badly quoted strings tagged for translation.
We also remove an aria-label on a placeholder that matches the input
element's actual label field.
2021-05-09 20:16:28 -07:00
akshatdalton 43aee21dcc linkifiers: Add frontend support to edit linkifier.
A modal is added to edit the realm linkifier which
supports ui_report error.

Puppeteer tests to verify linkifier update and an
invalid test to verify that linkifier error messages
are reported on the modal are added as well.
2021-05-09 20:12:25 -07:00
akshatdalton 8f290216ef linkifiers: Add `title` attribute to `Delete` button.
This commit adds `title` attribute and removes
`aria-hidden` attribute in `Delete` button in
linkifiers table.

`aria-hidden` attribute is used only for icons on buttons
that have a plain-text label.
2021-05-09 19:55:06 -07:00
Tim Abbott 99636c36a3 css: Remove inconsistent topic edit modal margin.
Similar elements in both the compose box and main message edit UI have
no margin in this location, and look better.
2021-05-09 19:47:27 -07:00
Tim Abbott 3e4a819722 css: Centralize topic edit modal CSS. 2021-05-09 19:47:08 -07:00
aryanshridhar 85fc8d5472 popovers: Allow Move topic's dropdown_list_widget to overflow.
Added a CSS overflow property to Move topic popover so that the
dropdown_list_widget doesn't hide behind the modal.
2021-05-09 19:35:51 -07:00
aryanshridhar 42c02f0788 popovers: Add search typeahead to Move topic popover.
Implemented dropdown_list_widget in Move topic popover which enables,
the functionality to search for streams while moving a particular topic.

The aim is to reduce the user effort by having an input
typeahead instead of haivng a dropdown list of streams.

Closes #14860.
2021-05-09 19:32:33 -07:00
aryanshridhar 2c50c67d07 dropdown_list_widget: Properly bind focus event to input field.
Previously, the focus event was triggering on a hidden
dropdown input field, which caused it to not gain focus when
clicked on dropdown button.

This is so because focus events cannot be triggered to
hidden elements or elements that aren't visible in DOM.

Added a fix by explicilty triggering the focus event to
dropdown input field only if the input field is visible in the DOM.
2021-05-09 19:26:40 -07:00
aryanshridhar a3baf90d3a move_topic_to_stream: Replace modal confirmation text to Confirm.
Followup of zulip#17926.
Basically, the aim is to concise modal texts
to use 'Confirm' instead of long labels since they can
tricky for translators and can also create bad strings
having long words.
2021-05-09 19:21:46 -07:00
Wesley Aptekar-Cassels 6639342892 shared: Add link to mobile @zulip/shared docs in README. 2021-05-09 19:12:09 -07:00
Tim Abbott 9a5ad4163e i18n: Rewrite text explaining default language panel.
* Explain what the percentages mean.
* Adjust old verbiage from before we had many translations.
2021-05-09 19:02:09 -07:00
Aman Agrawal 1152e0ffef default_language: Mark popup text for translation.
Provide link to Read the Docs translation guidelines page which
is more detailed.
2021-05-09 18:48:46 -07:00
Tim Abbott eff0014691 apps: Fix inconsistent sizing of hover bubbles.
They are all now approximately 110x110 squares, rather than having some be
substantially taller than others.
2021-05-09 18:42:13 -07:00