Commit Graph

43338 Commits

Author SHA1 Message Date
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
Tim Abbott 193d1e03c7 node tests: Fix test failure caused by rebase. 2021-06-29 17:53:25 -07:00
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 cfadb8297c tests: Extract can_edit_topic_of_any_message node test in a function.
This commit extracts the logic in can_edit_topic_of_any_message test
in a separate function test_message_policy. This change will help in
avoiding duplication while adding test for can_delete_own_message.
2021-06-29 17:37:52 -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 2bf19d5651 api: Remove incorrect realm setting in 'realm/update_dict' schema.
We incorrectly include many realm settings in the data section of
'realm/update_dict' schema. It should only contain the settings
related to message edit, realm icon, realm logo and authentication
methods and not other settings, becausea all the other settings send
'realm/update' event and not 'realm/update_dict' event.

This commit only removes 'allow_message_deleting' and others will
be removed separately.
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
sahil839 ce133dc762 models: Add can_edit_user_group helper.
This helper will be used to check whether
the user is allowed to edit user groups or
not. Currently it is not used, but will
be used in next commit where we will
refactor the user_group_edit_policy to use
COMMON_POLICY_TYPES.
2021-06-29 17:25:42 -07:00
PIG208 542516b07b integrations: Support params for events filtering.
We modify check_send_webhook_message to make it accept three new
parameters: only_events and exclude_events that are retrieved using REQ,
and complete_event_type, which is passed by the incoming webhook view
that is filtered according to the former two parameters.

Part of #18525.
2021-06-29 17:07:46 -07:00
PIG208 5ecbfecd77 webhook: Rename FIXTURE_DIR_NAME to WEBHOOK_DIR_NAME.
Since FIXTURE_DIR_NAME is the name of the folder that contains the view
and tests modules of the webhook and another folder called "fixtures" that
store the fixtures, it is more appropriate to call it WEBHOOK_DIR_NAME,
especially when we want to refer to the view module using this variable.
2021-06-29 17:01:54 -07:00
PIG208 b720e10d88 integrations: Reformat expected messages for readability. 2021-06-29 17:01:54 -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
Damian Parrino afe0b7df61 help: Add "Related articles" links around topic editing.
Based on @timabbott 's feedback, I'm adding a "Related articles" section to:
- Rename a topic.
- Move content to another stream.
2021-06-29 13:58:01 -07:00
Damian Parrino 846200f36e help: Add an article about moving content to another topic.
This commit addresses @timabbott 's comments, by adding a new article
"Move content to another topic".

Thanks to the new article, I also simplified a step from the "Rename a
topic" article to keep it focused on renaming only.
2021-06-29 13:57:57 -07:00
Damian Parrino caea7f167d help: Reorganize articles on editing topics.
* Move content on moving topics between streams to a dedicated
  article. We advertise it as "move content" to hint that one can move
  messages or split topics, and link to it.

* This deletes change-the-topic-of-a-message, because the same content
  is already covered in rename-a-topic.

* This commit mostly just moves content between articles. Most of that
  content was redundant with the first few paragraphs of the surviving
  "rename a topic" article. The former "This is useful for" se ntence
  was adapted to the remaining article.

* This commit also adds a redirect for the removed article, and
  updates related links.
2021-06-29 13:52:06 -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
Steve Howell 9e1d98a512 widgets: Add range checks on backend for indexes. 2021-06-29 13:40:33 -07:00
Steve Howell c25dbf7020 widgets: Validate todo data on the backend. 2021-06-29 13:40:33 -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
sahil839 f0b167e5a8 help: Fix section in deactivate-your-account help page. 2021-06-28 22:11:24 -07:00
sahil839 e0a6cfc708 help: Fix warning in deactivate-your-account help page.
After adding owner role, we allow last admin to deactivate
but not allow the last owner to deactivate, and this commit
fixes the warning about not allowing last admin.
2021-06-28 22:11:24 -07:00
Steve Howell dcb058ca8b docs: Remove BETA label for widget docs. 2021-06-28 21:59:22 -07:00
Vishnu KS d456f85e01 billing: Document model fields that are not self explanatory. 2021-06-28 21:44:16 -07:00
Alex Vandiver 88c19bf65a puppet: Catch when a comma is left out of puppet_classes.
With two space-separated classes in `puppet_classes`, the second one
is silently ignored.  With three of more, puppet generates the
following very opaque error message:

```
Error: Could not parse for environment production: This
Name has no effect. A value was produced and then forgotten (one or
more preceding expressions may have the wrong form)
```

Catch when this has happened, and give an error message to the user.

Fixes #18992.
2021-06-28 20:58:56 -04: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
Anders Kaseorg 06033545eb bootstrap-awscli: Remove executable bit.
Even though this looks like an independently runnable script, it
should not be run independently: a SHA-256 mismatch will fail to stop
the script, unless it was sourced from another script that has ‘set
-e’.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-28 17:13:57 -04: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
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
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
Anders Kaseorg 0ba9114c22 install-yarn: Rewrite Yarn installer.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-27 16:58:17 -07: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