Commit Graph

3804 Commits

Author SHA1 Message Date
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
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
YashRE42 1e2f154775 quote-and-reply: Add tests for caret position.
This was rebased and significantly modified by @showell:
    * introduce vars for textarea_val and textarea_caret_pos
    * simplify mock_esm call
    * use override for hash_util
    * minor things like whitespace cleanup

(see #18849 for the original PR)
2021-06-28 08:22:17 -07:00
Steve Howell 5e824a6d6d node tests: Only expose mock_template via run_test.
We now only expose mock_template as a helper in run_test.

This has the following advantages:

    * less boilerplate at the top of the file
    * more surgical control with setting exercise_templates
    * no more "f" hack (or render_foo consts)
    * we force devs to explicitly mock the template

See frontend_tests/zjsunit for the substantive changes.

All the changes to the tests are very mechanical in nature.
2021-06-27 23:00:34 -04:00
Steve Howell e8b40a9a03 node tests: Use mock_template in i18n.
This appears to be a silly case of using mock_template,
since the tests directly "require" the template, but
we are using it here to set up a generalization.

13 choose 1 is obviously 13, but it's also 13! divided
by the product of 12! and 1!.

The cruftiest part of this change gets fixed by the
subsequent commit (no need to call mock_template at
the top level).
2021-06-27 23:00:34 -04:00
Steve Howell 78ada11e31 node tests: Use mock_template in rendered_markdown. 2021-06-27 13:45:52 -04:00
Steve Howell b9e852b1a4 node tests: Use mock_template in stream_edit. 2021-06-27 11:01:12 -04:00
Steve Howell 3ec190d30b node tests: Use mock_template in settings_user_groups. 2021-06-27 11:01:12 -04:00
Steve Howell fb15d297da node tests: Use mock_template for pill_typeahead. 2021-06-27 11:01:12 -04:00
Steve Howell df88291d98 node tests: Use mock_template for input_pill. 2021-06-27 11:01:12 -04:00
Steve Howell 92ce51f1f0 node tests: Use mock_template in composebox_typeahead. 2021-06-27 11:01:12 -04:00
Steve Howell cc4c29fb4a node tests: Use mock_template for activity. 2021-06-27 11:01:12 -04: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
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
Riken Shah 0e65225d06 hashchange: Show default view when the hash is unknown.
Fixes #18870.
2021-06-23 17:41:09 -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 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
Tim Abbott fcb2f66725 popovers: Show user profile popover for all humans. 2021-06-21 17:16:50 -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 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
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 417faa0465 node tests: Fix failure resulting from recent rebase. 2021-06-16 16:40:39 -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
Steve Howell d5c4495fa5 zjsunit: Wire $ to zjquery by default.
I introduce `mock_jquery` for modules that
want their own mock implementation.
2021-06-16 12:55:53 -04:00
Steve Howell 9e657dd795 node tests: Use {override} in run_test. 2021-06-16 12:55:53 -04: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
Ganesh Pawar e3a099d732 deprecated_feature_notice: Move code to a separate module. 2021-06-15 11:58:45 -07:00
Steve Howell 3d1aae6253 zjsunit: Optionally exercise template code.
If you call mock_template(fn, true), we will
call the actual template code and pass it to your
stub for verification.

We make this opt-in to prevent false positives
on template line coverage.

We special-case our handling of static/js/templates.js,
since it's important that all of our tests have
the Zulip-specific handlers for Handlebars pre-registered.

This runs in roughly the same amount of time as the
previous commit.
2021-06-15 12:33:26 -04: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
Steve Howell 1e58e145ab node tests: Use mock_template in stream_list. 2021-06-14 12:05:10 -04:00
Steve Howell 1991218f6c node tests: Use mock_template in rendered_markdown. 2021-06-14 12:05:10 -04:00
Steve Howell 75f196b932 node tests: Use mock_template in recent_topics. 2021-06-14 12:05:10 -04:00
Abhijeet Prasad Bodas 5a36496ce5 node tests: Use mock_template in typeahead_helper. 2021-06-14 09:17:50 -04:00
Abhijeet Prasad Bodas 3c2dbf1537 node tests: Use mock_template in subs. 2021-06-14 09:17:50 -04:00
Abhijeet Prasad Bodas 9f857e5fc5 node tests: Use mock_template in stream_edit. 2021-06-14 09:17:50 -04:00
Abhijeet Prasad Bodas 1586907371 node tests: Use mock_template in settings_user_groups. 2021-06-14 09:17:50 -04:00
Abhijeet Prasad Bodas de6988b16d node tests: Use mock_template in settings_profile_fields. 2021-06-14 09:17:50 -04:00
Abhijeet Prasad Bodas 30023d4b76 node tests: Use mock_template in settings_org. 2021-06-14 09:17:50 -04:00
Abhijeet Prasad Bodas 9e324c0338 node tests: Use mock_template in popovers. 2021-06-14 09:17:50 -04:00
Abhijeet Prasad Bodas 8a214c9d63 node tests: Use mock_template in drafts. 2021-06-14 09:17:50 -04:00
Abhijeet Prasad Bodas 177eafb72b node tests: Use mock_template in compose_video. 2021-06-14 09:17:50 -04:00
Abhijeet Prasad Bodas b564d5c2f1 node tests: Use mock_template in compose_validate. 2021-06-14 09:17:50 -04:00
m-e-l-u-h-a-n f76e904154 minor: Add complete tests for pill_typeahead.
Functions for input pill typeahead in pill_typeahead.js
were dependent on other modules for testing, and most of
those only tested the part required to ensure coverage.

As part of changes done to pill_typeahead for code clarity we
split its functions logic to clearly handle three types of
pills instead of hacky checks. So to completely test the logic
for various possible combinations of types, we add separate tests
for these functions.
2021-06-12 07:59:43 -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
Steve Howell 0b4338b998 node tests: Use mock_template in poll_widget. 2021-06-11 09:54:25 -04:00
Steve Howell 25a0c700d3 node tests: Use mock_template in compose. 2021-06-11 09:54:25 -04:00
Steve Howell d067bdff2d node tests: Use mock_template in alert_words_ui. 2021-06-11 09:54:25 -04:00
Steve Howell ddeb15114d zjsunit: Add mock_template helper.
We want to eliminate stub_templates.
2021-06-11 09:54:25 -04: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
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
Riken Shah f95c539122 custom_check: Avoid use of assert to avoid confusion with assert.equal.
This commit bans the use of `assert` and replaces it
with `assert.ok` to avoid confusion with `assert.equal`.

Fixes #18687.
2021-06-10 09:15:57 -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
Palash Raghuwanshi 2718a8ea63 node tests: Replace incorrect assert with assert.equal in dispatch.js.
This commit fixes the invalid assert call in dispatch.js and also fixes the
invalid settings parameter of update_display_settings__default_view_all_messages
fixture in event.js, it should be all_messages instead of 1.

Fixes #18685.
2021-06-08 10:28:21 -07:00
Anders Kaseorg 40880aa496 node_tests: Use assert.equal.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-08 10:16:53 -07:00
Anders Kaseorg f6663fe0d1 node_tests: Use assert.deepEqual.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-08 10:16:53 -07:00
Anders Kaseorg 0d4c142f0b node_tests: Use assert.fail.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-08 10:16:53 -07:00
Anders Kaseorg b700b048eb node_tests: Use assert.notEqual.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-08 10:16:53 -07:00
Anders Kaseorg f4235b258e eslint: Fix import/extensions.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-08 10:15:52 -07:00
Steve Howell 94ffef4de9 zjquery: Eliminate css() helper.
We use css() pretty rarely in our codebase, and
it can sometimes be used mistakenly, when a better
alternative is to toggle a class for external css.

It's hard to support the full API in zjquery, so
we just punt and tell folks to create their own
stubs.

Most of the existing tests that were "fixed" here
weren't actually verifying the behavior of the css()
calls, and for those I just create no-op stubs.

In a few places I verify that css() was called as
expected.
2021-06-04 20:08:19 -07:00
Riken Shah 38d9e26a6c refactor: Rename `delete_draft_after_send` to `delete_active_draft`.
This commit renames `delete_draft_after_send` to
`delete_active_draft` for two main reasons:

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

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

This separation of UI elements is fine as these two settings are
separate in database also and also helps in removing excess if-else
conditions and switch cases.
2021-06-03 18:45:29 -07:00
sahil839 8846df6b53 node_tests: Deduplicate test_sync_realm_settings in settings_org tests.
There was a lot of duplicate code in test_sync_realm_settings where
each value in common_policy_values was being tested for different
policies (create_stream_policy and invite_to_stream_policy).

This commit deduplicates is by using a for-loop for testing all
common_policy values and extracting the code as a function to test
different policies.
2021-06-03 18:45:29 -07:00
m-e-l-u-h-a-n fa34f793a7 recent topics: Display other sender names in tooltip.
It is a follow up for #18451.
2021-06-03 14:55:40 -07:00
Tim Abbott 746d3e8dcb presence: Disable 'Idle' for users with idle status.
Previously, we oddly displayed "Last active: Just now" for users in
this situation, which doesn't make any sense.
2021-06-03 14:53:21 -07:00
Tim Abbott 16bd6e6b1d presence: Use consistent logic for displaying last active time.
Previously, we had this complicated layering where the right sidebar
logic would display "Last active: foo" but the user popovers would
just display "foo", which doens't make any sense, since the two
settings have equal context about the string.

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

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

(One of the jQuery handler code got reformatted due to it fitting
the line limit due to one character deletion for the selector)
2021-06-03 12:41:10 -07:00
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
Vishnu KS 9b9d30152a tests: Replace incorrect asserts with assert.equal. 2021-06-03 09:24:38 -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
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 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 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 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 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
Steve Howell 11d837620f node tests: Prevent security bugs in rendered_markdown.
Obviously this isn't completely foolproof, but it can
weed out naive bugs.
2021-05-26 08:00:35 -04:00
Steve Howell f5755c23d8 node tests: Avoid misleading class syntax for stubs. 2021-05-25 15:30:40 -07:00
Steve Howell 2dd7a8864c node tests: Get 100% coverage on rendered_markdown. 2021-05-25 15:30:40 -07:00
Steve Howell 83e6c66355 node tests: Test rtl for rendered_markdown. 2021-05-25 15:30:40 -07:00
Steve Howell 64e56f7187 node tests: Test email mentions. 2021-05-25 15:30:40 -07:00
Steve Howell ab9d954cf1 node tests: Test wildcard mentions. 2021-05-25 15:30:40 -07:00
Steve Howell 69c92e9bee node tests: Test bogus user group id. 2021-05-25 15:30:40 -07:00
Steve Howell 1e8e0acd6b node tests: Test missing timestamp does nothing. 2021-05-25 15:30:40 -07:00
Steve Howell 82be0176a9 node tests: Add coverage for code playground. 2021-05-25 15:30:40 -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 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
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
Sumanth V Rao 83a2479a5a build_pygments_data: Reprioritize and categorize pygment language codes.
We now organize the pygment language codes into meaningful categories
- default, custom and aliases.

Further the `lang.json` list now contains a dataset extracted from the
"language" section of https://insights.stackoverflow.com/survey/2020
and is prioritized based on current language trends.
2021-05-24 23:15:39 -07:00
sahil839 6a792c93df setting: Add moderator option in email visibility setting in frontend. 2021-05-23 14:26:00 -07:00
Riken Shah 51e24519b8 refactor: Rename `panels.js` to `navbar_alerts.js` as it better explains it. 2021-05-21 17:49:12 -07:00
m-e-l-u-h-a-n 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 cafe2b4d11 colorspace: Remove unused methods.
The getDecimalColor, getLighterColor & getHexColor were unused.
2021-05-21 16:53:30 -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 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
Aman Agrawal f701bfff28 reactions: Cleanup dead reactions code. 2021-05-20 14:41:40 -07:00
akshatdalton 78b59fa756 people: Fix `get_mention_syntax` when `full_name` matches wildcard.
When quoting a reply or mentioning a person having full name matching
wildcard mention, in such case, `get_mention_syntax` doesn't return
mention syntax of format: **full_name|user_id**.
As a result, a normal user can't mention such users and users who
can mention them may unwillingly trigger wildcard mention.
This commit fixes such issue.
2021-05-20 11:41:56 -07:00
akshatdalton b636a9199b compose: Add typeahead for user group silent mentions.
Prior to this, we restricted to show any user group suggestions
if silent mention syntax is used. But with the addition of
user group silent mentions, there are cases where one may want to
refer to some user groups without actually notifying them.
So, we add typeahead logic for such cases.

Test cases for silent syntax (@_*) and non-silent syntax (@*)
are added.
2021-05-20 11:41:55 -07:00
akshatdalton bf96d7eae8 markdown: Add support for local rendering of user group mention in quote.
This also adds test cases to test the local rendering of
user group mention in blockquotes.
2021-05-20 11:35:04 -07:00
akshatdalton 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
Anders Kaseorg b741e758f0 node_tests: Silence KaTeX warning in markdown test.
Fixes this KaTeX warning:

Warning: KaTeX doesn't work in quirks mode. Make sure your website has
a suitable doctype.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-20 10:41:44 -07:00
Steve Howell a699e4ea74 node tests: Clean up document stub. 2021-05-19 15:55:03 -04:00
Steve Howell cbd1ac24f4 node tests: Set platform more explicitly. 2021-05-19 15:55:03 -04:00
Steve Howell 1ee8157239 node tests: Remove document set_global. 2021-05-19 15:55:03 -04:00
Steve Howell 09ce61f18f node test: Eliminate mock_channel_post helper.
We now do a single override that closes on
current_message.
2021-05-19 15:55:03 -04:00
Steve Howell 5a90edf5e7 node tests: Use override more in compose tests. 2021-05-19 15:55:03 -04:00
Steve Howell cc6310b57d node tests: Localize MockDate call. 2021-05-19 15:55:03 -04:00
Steve Howell b543116193 node tests: Eliminate redundant "social" sub. 2021-05-19 15:55:03 -04:00
Steve Howell 62eca19b86 node tests: Eliminate sloppy_$ for compose tests. 2021-05-19 15:55:03 -04:00
Steve Howell 967506bbc7 node tests: Simplify rtl testing. 2021-05-19 15:55:03 -04:00
Steve Howell 394c4b32cf minor: Sort zrequire statements. 2021-05-19 15:55:03 -04:00
Steve Howell 7eece8a80e node tests: Remove sloppy_$ for compose_validate. 2021-05-19 15:55:03 -04:00
Steve Howell 48e5077201 node tests: Extract compose_validate.js
This is pretty much a verbatim code move,
except that I inlined noop and reset_jquery
in the new file.

Also, in the last test, I no longer reset
the compose state.
2021-05-19 15:55:03 -04:00
Steve Howell 338d2dc29a node tests: Localize overrides for compose test. 2021-05-19 15:55:03 -04:00
akshatdalton 9554514d3c refactor: Merge `markdown_katex.js` test file with `markdown.js`.
We split them in the commit: c50dbf8297
because at that time we thought markdown_katex was gonna
require rewireproxy magic in the later commits.
But we later removed the rewiremock dependency in the
commit: 30c7108955.

So now, we can safely merge `markdown_katex.js` test file
with `markdown.js` test file.
2021-05-19 11:59:28 -07: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
Steve Howell ef4446204d node tests: Add test wrapper for message_list_view. 2021-05-19 11:20:23 -04:00
Steve Howell 664afd2a1c node tests: Clean up electron_bridge test.
We use with_field to avoid leaks and then
just organize things better.
2021-05-19 11:06:18 -04: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
Steve Howell bdb2fa707c node tests: Use override for insert_or_move. 2021-05-18 18:34:17 -04:00
Steve Howell 1246970c23 node tests: Tweak test for first/prev/next. 2021-05-18 18:34:17 -04:00
Steve Howell eb46ac408d node tests: Add activity.clear_for_testing(). 2021-05-18 18:34:17 -04:00
Steve Howell fb0ba995c3 node tests: Use real version of keydown_util. 2021-05-18 18:34:17 -04:00
Steve Howell 5cbeaf1728 node test: Simplify presence statuses.
The test() wrapper makes a new map every time
with only "mark" as the idle user.
2021-05-18 18:34:17 -04:00
Steve Howell 2d02297f43 node tests: Use test() wrapper consistently.
The diff is slightly noisy due to some lexical
code moves, but otherwise it's search/replace.
2021-05-18 18:34:17 -04:00
Steve Howell 36077774fc node tests: Use override for fill_screen_with_content. 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
Steve Howell 7a3ba26c78 zjquery: Support $(...)[i] syntax. 2021-05-18 18:34:17 -04:00
Steve Howell 976374ed04 buddy_list: Localize overrides for buddy_list. 2021-05-18 18:34:17 -04:00
Steve Howell b7a188fde8 node tests: Deepen filter_user_ids test.
We now test that activity.build_user_sidebar
integrates with the user_search code.
2021-05-18 18:34:17 -04:00
Steve Howell 45fb7165b1 node tests: Test list cursor more directly.
This tests the basic mechanics of list_cursor
more directly than the activity node tests.

It also sets the stage to eliminate some
tests from activity.js while maintaining
100% coverage on list_cursor.
2021-05-18 14:16:55 -04:00
Steve Howell dbd60d18fe minor: Tweak list_cursor tests.
We just make the config a bit more explicit in
each test, and we use override to ensure that
stub functions aren't cruft.
2021-05-18 14:16:55 -04:00
Steve Howell cd1510c0ef node tests: Extract user_search tests.
This is mostly moving tests from activity.js
into user_search.js, but it's not a verbatim
code move.

The new module continues to make sure that
the boundary between activity and user_search
is correct, as most of the testing uses
the configuration of UserSearch from
static/js/activity.js.

It does not use a real buddy_list, though,
which simplifies some tests.

I cleaned up some tests by making sure we
were testing both sides of conditions more
rigorously.

After this change we no longer need the
bloated activity.js tests to maintain full
coverage on static/js/user_search.js.
2021-05-18 14:16:55 -04:00
Steve Howell ee066a1a91 node tests: Use per-test overrides for activity tests. 2021-05-18 14:16:55 -04:00
Steve Howell eee8ff40b4 node tests: Fix false positive for muted user.
The test was passing here because we didn't add
selma. We want to make sure it's due to the actual
muting.
2021-05-16 11:48:50 -04:00
Steve Howell 9825be339b node tests: Test buddy_data.get_items_for_users. 2021-05-16 11:48:50 -04:00
Steve Howell 4a20c968d0 node tests: Test level/description for buddy_data. 2021-05-16 11:48:50 -04:00
Vishnu KS 27a2317e65 billing: Add node template test for plan change form. 2021-05-14 15:10:02 -07: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
Steve Howell 78c2279c93 node tests: Clear muted users before each test. 2021-05-13 14:53:14 -04: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
sahil839 6f4af26585 node_tests: Extract main logic of testing policies in a common function.
This commit extracts the logic for testing user_can_invite_others_to_realm
user_can_create_streams, and user_can_subscribe_other_users to a single
function test_policy and this function test_policy is called passing
different policies and validation functions as arguments.

This helps in removing a lot of duplicated code.
2021-05-13 08:42:24 -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
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
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 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
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 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 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 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
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 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 42abc1b635 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 18:07:13 -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
Abhijeet Prasad Bodas 9519221bb5 mute user: Remove development environment checks. 2021-05-10 16:38:21 -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
Anders Kaseorg 544bbd5398 docs: Fix capitalization mistakes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 09:57:26 -07:00
Abhijeet Prasad Bodas eadbce4b0c message list: Don't exclude 1:1 PMs with muted users in pm-with narrows.
Previously, we used to hide 1:1 PMs with muted users everywhere
in the UI. This commit makes it so that such messages will now be
visible in `pm-with/<muted_user>` narrows, meaning these will not
be excluded from message lists, but will still be hidden under
the "This message was hidden." dialog implemented earlier.
2021-05-07 16:21:35 -07:00
Abhijeet Prasad Bodas a59f545136 message lists: Exclude 1:1 PMs with muted users.
* We hide 1:1 PMs from and to muted users throughout
the UI, because doing so will not lead to loss of
conversational context. The "to" part is also important,
because the last few messages sent to a user before
muting them would probably be asking them to stop
spamming.

* After this change, we will need to do filtering for either
user or topic muting in pretty much all narrows, so we need
to keep the `_all_items` list in MessageListData always
up-to-date.

* A further commit will relax this and make it possible to
view these messages only when in a `pm-with/muted_user`
narrow.
2021-05-07 16:21:35 -07:00
Abhijeet Prasad Bodas e64e5936ce message lists: Don't allow user/topic mute message filtering independently.
This basically reverts 4bd7ec7c36 and
3a9dfc02e6.

The plan earlier was to have compeletely different codepaths
for user and topic muting, so that we could call seperate
functions in the message list class on receiving the respective
events.

However, this cannot be done, because if we, for example, on
receiving a `muted_users` event, filter `_all_items` based on
just user mutes, and store the result in `_items`, then, that
result may still contain topic-muted messages, which is
undesirable. Hence whenever we filter messages, we must do so
based on both user as well as topic muting.
(The code for the former will be added in further commits.)

So, we will have a single function which will handle updating
the message lists for muting.
2021-05-07 16:21:35 -07:00
Abhijeet Prasad Bodas 2fc87ec644 node tests: Prefer actual Filter instances over dummy objects.
These mock objects did not buy any ease in testing, as
evident from the fact that this commit hardly contains
any changes to the tests themselves.

This commit also removes some unnecessary `filter: undefined`,
parameters sent to MessageList constructor.
2021-05-07 16:21:35 -07:00
Aman Agrawal d2e3dbeb50 list_widget: Allow instance to change load_count as per state.
Add a function which is called before every render to
get the number of items it can render. This can be used by
instance to load custom number of items as per its state.
2021-05-07 16:07:52 -07:00
Aman Agrawal 7d6b65e8f4 list_widget: Give instances more control over scrolling behaviour.
We allow ListWidget instances to pass functions in opts that can
be called after scrolling to determine when to render.
Also, allow a callback function to be called pre render.
2021-05-07 16:07:52 -07:00
Aman Agrawal 51acbefc8a recent_topics: Display compose box & enable compose hotkeys.
We move compose from being a part of message feed to
being a part of  middle column which is a common parent of recent
topics and message feed. This allows us to use a common compose
box for both the views. Fortunately, compose actions were
independent of this change so there weren't any evident
side effects.

Fixes #17543
2021-05-07 16:07:51 -07:00
Vishnu KS 752fd2e2d1 corporate: Fix string encoding in billing and sponsorship endpoints. 2021-05-07 09:37:40 -07:00
Riken Shah 089ca2bdcf node_tests: Add remaining tests for `panels.js`.
In this commit, we add the node tests for `panels.js`, which started
in 2f36c5aefc commit (it added tests for
the server upgrade alert).
2021-05-07 08:41:41 -07:00
Riken Shah babe24fa02 node_tests: Update alert words tests to handle a corner case.
This corner case was reported in #17320, basically, the
issue was when two or more alert words were used
consecutively with a single space between them, it didn't
detect the even number word as `alert word`.
2021-05-07 08:36:43 -07:00
Riken Shah 2f36c5aefc navbar_alerts: Add button to hide "Server Upgrade" alert for 7 days.
This button will allow users to avoid a distracting red banner across
their screen, while they wait for their sysadmin to do the upgrade
work.

Fixes: #18359
2021-05-06 15:55:40 -07:00
Aman Agrawal 707d23d1e8 recent_topics: Don't rerender when topic_data is unchanged.
Since we don't process private messages yet, we don't
need to re-render when we receive a new private message
as it doesn't change any data related to recent_topics.
2021-05-06 12:06:22 -07:00
Abhijeet Prasad Bodas 65249d90e9 compose_typeahead: Exclude muted users from results.
Hides muted users from PM recipients and compose box
mention typeaheads.
2021-05-05 09:42:30 -07:00
Abhijeet Prasad Bodas 04c355c248 typing notifications: Exclude muted typists. 2021-05-05 09:35:27 -07:00
Abhijeet Prasad Bodas 47764ded76 user muting: Add helpers to filter out muted users.
This will allow us to avoid duplication of array filtering
logic of the form-
`Array.filter((user_id) => !muting.is_user_muted(user_id))` and
`Array.filter((person) => !muting.is_user_muted(person.user_id))`
2021-05-05 09:34:39 -07:00
Abhijeet Prasad Bodas 615e1f9e05 node tests: Clean up user_pill.js tests.
* Add a `test` wrapper for clearing data before each test.
* Simplify dummy `pill_widget` object creation.
2021-05-05 09:34:39 -07:00
Abhijeet Prasad Bodas e4d5114c3c filter: Add new is_non_huddle_pm method.
We want to exclude 1:1 PMs from muted users everywhere
except in `pm-with/<muted_user>`.
This method will help us determine whether we are in such
a narrow.
2021-05-05 09:29:51 -07:00
Abhijeet Prasad Bodas 9f6ad779e4 message view: Allow revealing hidden message from muted sender.
* We show a "Click here to reveal." hyperlink in the hidden
message dialog for user to click on and read a hidden message.

* The "reveal" action is temporary, in the sense that a revealed
message will again be hidden once the broswer tab reloads or
if the user renarrows.

* When a message is revealed, we make sure to show the sender
of that message, even if it isn't the first message of it's group.
This is because the first message of that message group (which
would have otherwise shown the sender) can still be hidden.

* Reactions and background color after revealing a message are
the same as if the message hadn'e been hidden at all in the
first place.
2021-05-05 09:15:45 -07:00