Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deactivated user compose error state does not clear when recipient is changed #22278

Open
alya opened this issue Jun 21, 2022 · 12 comments
Open
Labels
area: compose (banners & validation) Validation and banners in the compose box bug help wanted

Comments

@alya
Copy link
Contributor

alya commented Jun 21, 2022

Repro:

  1. Attempt to send a PM to a deactivated user.
  2. An error message is correctly displayed:

Screen Shot 2022-06-21 at 3 33 03 PM

3. Change the recipient to a valid one without closing the compose box.

Expected: It should now be possible to send a message. Ideally, the error banner would disappear.
Actual: The error banner remains and nothing seems to happen when one tries to send the message (via keyboard or "Send" button).

Screen Shot 2022-06-21 at 3 31 23 PM

@rixant
Copy link
Collaborator

rixant commented Jun 22, 2022

@zulipbot claim

@rixant
Copy link
Collaborator

rixant commented Jun 26, 2022

@alya I am working trying to reproduce the bug. How do I find or get the deactivated user?

@alya
Copy link
Contributor Author

alya commented Jun 29, 2022

You can deactivate a user as an admin in the development environment.

Also, please take a look at the Zulip contributor guide, and keep in mind the following guideline:

Before you claim an issue, you should be confident that you will be able to tackle it effectively.

I will go ahead and unassign this issue, and you should feel free to re-claim it once you have figured out how to approach it (or pick a different one if you prefer).

@rixant
Copy link
Collaborator

rixant commented Jun 29, 2022

@zulipbot claim

@zulipbot
Copy link
Member

zulipbot commented Jul 9, 2022

@rixant You have been unassigned from this issue because you have not made any updates for over 14 days. Please feel free to reclaim the issue if you decide to pick up again. Thanks!

@rixant rixant removed their assignment Jul 13, 2022
@rixant
Copy link
Collaborator

rixant commented Jul 13, 2022

@zulipbot claim

@timabbott
Copy link
Sponsor Member

@evykassirer is this issue still present following your compose_banner project?

@evykassirer
Copy link
Collaborator

Yes, the banner project was almost entirely UI and not UX changes. There's a lot that can be improved with when banners disappear, and this is one of them.

@palashb01
Copy link
Collaborator

palashb01 commented Feb 1, 2023

Hey @alya @timabbott , I think this issue is no longer relevant. Perhaps we should also remove the code for the banner from the codebase. I recently worked on a PR #23899 and an issue #23408 that automatically updates the compose_box based on the user's status. If a user is deactivated, the compose_box will automatically close and display a tooltip saying, Message can't be sent to a deactivated user. With this update, the banner won't appear. Shall I remove the code for it?

@alya
Copy link
Contributor Author

alya commented Feb 2, 2023

If #23899 should resolve this issue, please note that in the PR / commit message. I think we should keep it open until the PR has been merged.

palashb01 added a commit to palashb01/zulip that referenced this issue Feb 3, 2023
If a user is deactivated, change empty PM/group PM view text
and keep the compose_box closed and blocked for the PM with
deactivated user.

Created a function inside `people.js` to verify,
if the given user_id is active or not, returns boolean.

Inside compose_actions.js, wrote a function that returns a boolean
indicating whether there is a deactivated user in a group or single
private message, as well as the number of users in the array of users
to be private messaged with.

To block the compose_box in case of deactivated users and expand it in
case of stream/private button, a function was written to check the
opts.trigger and msg_type.

The compose box needs to be disabled in all the cases where a deactivated user
is present in pm-with/ group-pm-with or all message narrow. To make this functional
update_reply_recipient_label is a function that is called everytime a selected_message
changes or user switches to pm. This is the same behaviour what disable the compose_box
is expected, to make this work, called a function inside update_reply_recipient_label to
update the status of the compose box and added few if-else conditions since on-reloading
certain properites are not present instantaneously to execute the function thus return
the normal behaviour.

Whenever a user is deactivated or activated, server events are updated
simultaneously without reloading to make the compose_box do the same without
reload. The "update_compose_box_deactivated_user function" is called from the
"compose_closed_ui.js" file in both cases of activation and deactivation. However,
to ensure that the compose_box closes if it is open, the "cancel" function from
the "compose_actions.js" file is called in the "compose_closed_ui.js" file.

if the user is deactivated update the left-sidebar-pm-user-popover to show
"User is deactivated" instead of "last active".

Changed the `/frontend_tests/node_tests/compose_actions.js`,
according to the new changes made inside the `compose_actions.js`.
Changed the /node_tests/people.js, according to the function
created in people.js.
Changed the /node_tests/narrow.js, according to the changes made
in narrow_banner.js
Changed the /node_tests/buddy_data.js, according to the changes made
in buddy_data.js.
Changed the /node_tests/dispatch.js, according to the changes made
in server_events_dispatch.js
Changed the /node_tests/example4.js.

Fixes: zulip#23408 , zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Feb 6, 2023
If a user is deactivated, change empty PM/group PM view text
and keep the compose_box closed and blocked for the PM with
deactivated user.

Created a function inside `people.js` to verify,
if the given user_id is active or not, returns boolean.

Inside compose_actions.js, wrote a function that returns a boolean
indicating whether there is a deactivated user in a group or single
private message, as well as the number of users in the array of users
to be private messaged with.

To block the compose_box in case of deactivated users and expand it in
case of stream/private button, a function was written to check the
opts.trigger and msg_type.

The compose box needs to be disabled in all the cases where a deactivated user
is present in pm-with/ group-pm-with or all message narrow. To make this functional
update_reply_recipient_label is a function that is called everytime a selected_message
changes or user switches to pm. This is the same behaviour what disable the compose_box
is expected, to make this work, called a function inside update_reply_recipient_label to
update the status of the compose box and added few if-else conditions since on-reloading
certain properites are not present instantaneously to execute the function thus return
the normal behaviour.

Whenever a user is deactivated or activated, server events are updated
simultaneously without reloading to make the compose_box do the same without
reload. The "update_compose_box_deactivated_user function" is called from the
"compose_closed_ui.js" file in both cases of activation and deactivation. However,
to ensure that the compose_box closes if it is open, the "cancel" function from
the "compose_actions.js" file is called in the "compose_closed_ui.js" file.

if the user is deactivated update the left-sidebar-pm-user-popover to show
"User is deactivated" instead of "last active".

Changed the `/frontend_tests/node_tests/compose_actions.js`,
according to the new changes made inside the `compose_actions.js`.
Changed the /node_tests/people.js, according to the function
created in people.js.
Changed the /node_tests/narrow.js, according to the changes made
in narrow_banner.js
Changed the /node_tests/buddy_data.js, according to the changes made
in buddy_data.js.
Changed the /node_tests/dispatch.js, according to the changes made
in server_events_dispatch.js
Changed the /node_tests/example4.js.

Fixes: zulip#23408 , zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Feb 6, 2023
If a user is deactivated, change empty PM/group PM view text
and keep the compose_box closed and blocked for the PM with
deactivated user.

Created a function inside `people.js` to verify,
if the given user_id is active or not, returns boolean.

Inside compose_actions.js, wrote a function that returns a boolean
indicating whether there is a deactivated user in a group or single
private message, as well as the number of users in the array of users
to be private messaged with.

To block the compose_box in case of deactivated users and expand it in
case of stream/private button, a function was written to check the
opts.trigger and msg_type.

The compose box needs to be disabled in all the cases where a deactivated user
is present in pm-with/ group-pm-with or all message narrow. To make this functional
update_reply_recipient_label is a function that is called everytime a selected_message
changes or user switches to pm. This is the same behaviour what disable the compose_box
is expected, to make this work, called a function inside update_reply_recipient_label to
update the status of the compose box and added few if-else conditions since on-reloading
certain properites are not present instantaneously to execute the function thus return
the normal behaviour.

Whenever a user is deactivated or activated, server events are updated
simultaneously without reloading to make the compose_box do the same without
reload. The "update_compose_box_deactivated_user function" is called from the
"compose_closed_ui.js" file in both cases of activation and deactivation. However,
to ensure that the compose_box closes if it is open, the "cancel" function from
the "compose_actions.js" file is called in the "compose_closed_ui.js" file.

if the user is deactivated update the left-sidebar-pm-user-popover to show
"User is deactivated" instead of "last active".

Changed the `/frontend_tests/node_tests/compose_actions.js`,
according to the new changes made inside the `compose_actions.js`.
Changed the /node_tests/people.js, according to the function
created in people.js.
Changed the /node_tests/narrow.js, according to the changes made
in narrow_banner.js
Changed the /node_tests/buddy_data.js, according to the changes made
in buddy_data.js.
Changed the /node_tests/dispatch.js, according to the changes made
in server_events_dispatch.js
Changed the /node_tests/example4.js.

Fixes: zulip#23408 , zulip#22278
@palashb01
Copy link
Collaborator

palashb01 commented Feb 6, 2023

I am unassigning myself from this issue to work on other issues. Since this issue is resolved in my other PR #23899 and it is under integration review, I will continue working on the PR for any required changes. Thanks.

@palashb01 palashb01 removed their assignment Feb 6, 2023
palashb01 added a commit to palashb01/zulip that referenced this issue Feb 8, 2023
If a user is deactivated, change empty PM/group PM view text
and keep the compose_box closed and blocked for the PM with
deactivated user.

Created a function inside `people.js` to verify,
if the given user_id is active or not, returns boolean.

Inside compose_actions.js, wrote a function that returns a boolean
indicating whether there is a deactivated user in a group or single
private message, as well as the number of users in the array of users
to be private messaged with.

To block the compose_box in case of deactivated users and expand it in
case of stream/private button, a function was written to check the
opts.trigger and msg_type.

In a group PM containing deactivated users, when the message feed is emptied,
a function is written inside people.js to return an array containing the
full names of all the deactivated users from the given user_ids array,
which will then display one of the deactivated user names in the narrow banner.

The compose box needs to be disabled in all the cases where a deactivated user
is present in pm-with/ group-pm-with or all message narrow. To make this functional
update_reply_recipient_label is a function that is called everytime a selected_message
changes or user switches to pm. This is the same behaviour what disable the compose_box
is expected, to make this work, called a function inside update_reply_recipient_label to
update the status of the compose box and added few if-else conditions since on-reloading
certain properites are not present instantaneously to execute the function thus return
the normal behaviour.

Whenever a user is deactivated or activated, server events are updated
simultaneously without reloading to make the compose_box do the same without
reload. The "update_compose_box_deactivated_user function" is called from the
"compose_closed_ui.js" file in both cases of activation and deactivation. However,
to ensure that the compose_box closes if it is open, the "cancel" function from
the "compose_actions.js" file is called in the "compose_closed_ui.js" file.

if the user is deactivated update the left-sidebar-pm-user-popover to show
"User is deactivated" instead of "last active".

Changed the `/frontend_tests/node_tests/compose_actions.js`,
according to the new changes made inside the `compose_actions.js`.
Changed the /node_tests/people.js, according to the function
created in people.js.
Changed the /node_tests/narrow.js, according to the changes made
in narrow_banner.js
Changed the /node_tests/buddy_data.js, according to the changes made
in buddy_data.js.
Changed the /node_tests/dispatch.js, according to the changes made
in server_events_dispatch.js
Changed the /node_tests/example4.js.

Fixes: zulip#23408 , zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Feb 24, 2023
If a user is deactivated, change empty PM/group PM view text
and keep the compose_box closed and blocked for the PM with
deactivated user.

Created a function inside `people.js` to verify,
if the given user_id is active or not, returns boolean.

Inside compose_actions.js, wrote a function that returns a boolean
indicating whether there is a deactivated user in a group or single
private message, as well as the number of users in the array of users
to be private messaged with.

To block the compose_box in case of deactivated users and expand it in
case of stream/private button, a function was written to check the
opts.trigger and msg_type.

In a group PM containing deactivated users, when the message feed is
emptied, a function is written inside people.js to return an array
containing the full names of all the deactivated users from the given
user_ids array, which will then display one of the deactivated user names
in the narrow banner.

The compose box needs to be disabled in all the cases where a deactivated
user is present in pm-with/ group-pm-with or all message narrow. To make
this functional update_reply_recipient_label is a function that is called
everytime a selected_message changes or user switches to pm. This is the
same behaviour what disable the compose_box is expected, to make this work,
called a function inside update_reply_recipient_label to update the status
of the compose box and added few if-else conditions since on-reloading
certain properites are not present instantaneously to execute the function
thus return the normal behaviour.

Whenever a user is deactivated or activated, server events are updated
simultaneously without reloading to make the compose_box do the same without
reload. The "update_compose_box_deactivated_user function" is called from the
"compose_closed_ui.js" file in both cases of activation and deactivation.
However, to ensure that the compose_box closes if it is open, the "cancel"
function from the "compose_actions.js" file is called in the
"compose_closed_ui.js" file.

if the user is deactivated update the left-sidebar-pm-user-popover to show
"User is deactivated" instead of "last active".

Changed the `/frontend_tests/node_tests/compose_actions.js`,
according to the new changes made inside the `compose_actions.js`.
Changed the /node_tests/people.js, according to the function
created in people.js.
Changed the /node_tests/narrow.js, according to the changes made
in narrow_banner.js
Changed the /node_tests/buddy_data.js, according to the changes made
in buddy_data.js.
Changed the /node_tests/dispatch.js, according to the changes made
in server_events_dispatch.js
Changed the /node_tests/example4.js.

Fixes: zulip#23408 , zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Feb 24, 2023
If a user is deactivated, change empty PM/group PM view text
and keep the compose_box closed and blocked for the PM with
deactivated user.

Created a function inside `people.js` to verify,
if the given user_id is active or not, returns boolean.

Inside compose_actions.js, wrote a function that returns a boolean
indicating whether there is a deactivated user in a group or single
private message, as well as the number of users in the array of users
to be private messaged with.

To block the compose_box in case of deactivated users and expand it in
case of stream/private button, a function was written to check the
opts.trigger and msg_type.

In a group PM containing deactivated users, when the message feed is
emptied, a function is written inside people.js to return an array
containing the full names of all the deactivated users from the given
user_ids array, which will then display one of the deactivated user names
in the narrow banner.

The compose box needs to be disabled in all the cases where a deactivated
user is present in pm-with/ group-pm-with or all message narrow. To make
this functional update_reply_recipient_label is a function that is called
everytime a selected_message changes or user switches to pm. This is the
same behaviour what disable the compose_box is expected, to make this work,
called a function inside update_reply_recipient_label to update the status
of the compose box and added few if-else conditions since on-reloading
certain properites are not present instantaneously to execute the function
thus return the normal behaviour.

Whenever a user is deactivated or activated, server events are updated
simultaneously without reloading to make the compose_box do the same without
reload. The "update_compose_box_deactivated_user function" is called from the
"compose_closed_ui.js" file in both cases of activation and deactivation.
However, to ensure that the compose_box closes if it is open, the "cancel"
function from the "compose_actions.js" file is called in the
"compose_closed_ui.js" file.

if the user is deactivated update the left-sidebar-pm-user-popover to show
"User is deactivated" instead of "last active".

Changed the `/frontend_tests/node_tests/compose_actions.js`,
according to the new changes made inside the `compose_actions.js`.
Changed the /node_tests/people.js, according to the function
created in people.js.
Changed the /node_tests/narrow.js, according to the changes made
in narrow_banner.js
Changed the /node_tests/buddy_data.js, according to the changes made
in buddy_data.js.
Changed the /node_tests/dispatch.js, according to the changes made
in server_events_dispatch.js
Changed the /node_tests/example4.js.

Fixes: zulip#23408 , zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Feb 25, 2023
If a user is deactivated, change empty PM/group PM view text
and keep the compose_box closed and blocked for the PM with
deactivated user.

Created a function inside `people.js` to verify,
if the given user_id is active or not, returns boolean.

Inside compose_actions.js, wrote a function that returns a boolean
indicating whether there is a deactivated user in a group or single
private message, as well as the number of users in the array of users
to be private messaged with.

To block the compose_box in case of deactivated users and expand it in
case of stream/private button, a function was written to check the
opts.trigger and msg_type.

In a group PM containing deactivated users, when the message feed is
emptied, a function is written inside people.js to return an array
containing the full names of all the deactivated users from the given
user_ids array, which will then display one of the deactivated user names
in the narrow banner.

The compose box needs to be disabled in all the cases where a deactivated
user is present in pm-with/ group-pm-with or all message narrow. To make
this functional update_reply_recipient_label is a function that is called
everytime a selected_message changes or user switches to pm. This is the
same behaviour what disable the compose_box is expected, to make this work,
called a function inside update_reply_recipient_label to update the status
of the compose box and added few if-else conditions since on-reloading
certain properites are not present instantaneously to execute the function
thus return the normal behaviour.

Whenever a user is deactivated or activated, server events are updated
simultaneously without reloading to make the compose_box do the same without
reload. The "update_compose_box_deactivated_user function" is called from the
"compose_closed_ui.js" file in both cases of activation and deactivation.
However, to ensure that the compose_box closes if it is open, the "cancel"
function from the "compose_actions.js" file is called in the
"compose_closed_ui.js" file.

if the user is deactivated update the left-sidebar-pm-user-popover to show
"User is deactivated" instead of "last active".

Changed the `/frontend_tests/node_tests/compose_actions.js`,
according to the new changes made inside the `compose_actions.js`.
Changed the /node_tests/people.js, according to the function
created in people.js.
Changed the /node_tests/narrow.js, according to the changes made
in narrow_banner.js
Changed the /node_tests/buddy_data.js, according to the changes made
in buddy_data.js.
Changed the /node_tests/dispatch.js, according to the changes made
in server_events_dispatch.js
Changed the /node_tests/example4.js.

Fixes: zulip#23408 , zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Feb 28, 2023
If a user is deactivated, change empty PM/group PM view text
and keep the compose_box closed and blocked for the PM with
deactivated user.

Created a function inside `people.js` to verify,
if the given user_id is active or not, returns boolean.

Inside compose_actions.js, wrote a function that returns a boolean
indicating whether there is a deactivated user in a group or single
private message, as well as the number of users in the array of users
to be private messaged with.

To block the compose_box in case of deactivated users and expand it in
case of stream/private button, a function was written to check the
opts.trigger and msg_type.

In a group PM containing deactivated users, when the message feed is
emptied, a function is written inside people.js to return an array
containing the full names of all the deactivated users from the given
user_ids array, which will then display one of the deactivated user names
in the narrow banner.

The compose box needs to be disabled in all the cases where a deactivated
user is present in pm-with/ group-pm-with or all message narrow. To make
this functional update_reply_recipient_label is a function that is called
everytime a selected_message changes or user switches to pm. This is the
same behaviour what disable the compose_box is expected, to make this work,
called a function inside update_reply_recipient_label to update the status
of the compose box and added few if-else conditions since on-reloading
certain properites are not present instantaneously to execute the function
thus return the normal behaviour.

Whenever a user is deactivated or activated, server events are updated
simultaneously without reloading to make the compose_box do the same without
reload. The "update_compose_box_deactivated_user function" is called from the
"compose_closed_ui.js" file in both cases of activation and deactivation.
However, to ensure that the compose_box closes if it is open, the "cancel"
function from the "compose_actions.js" file is called in the
"compose_closed_ui.js" file.

if the user is deactivated update the left-sidebar-pm-user-popover to show
"User is deactivated" instead of "last active".

Changed the `/frontend_tests/node_tests/compose_actions.js`,
according to the new changes made inside the `compose_actions.js`.
Changed the /node_tests/people.js, according to the function
created in people.js.
Changed the /node_tests/narrow.js, according to the changes made
in narrow_banner.js
Changed the /node_tests/buddy_data.js, according to the changes made
in buddy_data.js.
Changed the /node_tests/dispatch.js, according to the changes made
in server_events_dispatch.js
Changed the /node_tests/example4.js.

Fixes: zulip#23408 , zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Mar 1, 2023
If a user is deactivated, change empty PM/group PM view text
and keep the compose_box closed and blocked for the PM with
deactivated user.

Created a function inside `people.js` to verify,
if the given user_id is active or not, returns boolean.

Inside compose_actions.js, wrote a function that returns a boolean
indicating whether there is a deactivated user in a group or single
private message, as well as the number of users in the array of users
to be private messaged with.

To block the compose_box in case of deactivated users and expand it in
case of stream/private button, a function was written to check the
opts.trigger and msg_type.

In a group PM containing deactivated users, when the message feed is
emptied, a function is written inside people.js to return an array
containing the full names of all the deactivated users from the given
user_ids array, which will then display one of the deactivated user names
in the narrow banner.

The compose box needs to be disabled in all the cases where a deactivated
user is present in pm-with/ group-pm-with or all message narrow. To make
this functional update_reply_recipient_label is a function that is called
everytime a selected_message changes or user switches to pm. This is the
same behaviour what disable the compose_box is expected, to make this work,
called a function inside update_reply_recipient_label to update the status
of the compose box and added few if-else conditions since on-reloading
certain properites are not present instantaneously to execute the function
thus return the normal behaviour.

Whenever a user is deactivated or activated, server events are updated
simultaneously without reloading to make the compose_box do the same without
reload. The "update_compose_box_deactivated_user function" is called from the
"compose_closed_ui.js" file in both cases of activation and deactivation.
However, to ensure that the compose_box closes if it is open, the "cancel"
function from the "compose_actions.js" file is called in the
"compose_closed_ui.js" file.

if the user is deactivated update the left-sidebar-pm-user-popover to show
"User is deactivated" instead of "last active".

Changed the `/frontend_tests/node_tests/compose_actions.js`,
according to the new changes made inside the `compose_actions.js`.
Changed the /node_tests/people.js, according to the function
created in people.js.
Changed the /node_tests/narrow.js, according to the changes made
in narrow_banner.js
Changed the /node_tests/buddy_data.js, according to the changes made
in buddy_data.js.
Changed the /node_tests/dispatch.js, according to the changes made
in server_events_dispatch.js
Changed the /node_tests/example4.js.

Fixes: zulip#23408 , zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Mar 18, 2023
This commit updates the compose box for deactivated users.

There are three different locations where the compose box should
be updated for deactivated users:

- PM & group PM
- Recent conversations narrow
- All messages narrow

In all the above cases, the recipient label inside the compose box
changes, which is the key starting point to implement this feature.

To ensure the compose box does not open when clicked on in the case
of a deactivated user, a function 'check_pm_deactivated' was added
inside the 'compose_actions.js' file. Since there is no 'opts' to
determine the recipients for a closed_compose_box, this function
takes two arguments and is required for updating the
closed_compose_box as well. This function checks if the given
user_ids array contains any deactivated users. If so, it returns two
values: the first is a boolean value indicating whether there is a
deactivated user or not, and the second indicates the number of
deactivated users, which is helpful for updating the tooltip
accordingly. Even if the user is deactivated and the compose_box is
disabled, the other two buttons 'New Topic' and 'New Private Message'
should still work, as checked by the 'check_new_topic_or_pm_trigger'
function.

To update the compose box for deactivated users, a function
'update_reply_button_deactivated_users' was added inside
'compose_closed_ui.js'. This function is used to verify if there are
any deactivated users among the recipients and update the compose box
accordingly. To get the recipients, there are three different
approaches for the three cases defined above:

- pm-with: narrow_state contains the pm_ids, which are used to get
            the recipients

- group-pm-with & all messages narrow: the selected message row can be
            used, and to distinguish between stream and pm messages,
            the 'is_Array' function is used, since for stream
            messages, the 'selected_message().display_recipient' is a
            string, but for pm messages, it is an array

- recent conversations narrow: the focused row message is used to get
            the recipients, and to distinguish between stream and pm
            messages, one argument message is passed, which has the
            'display_reply_to' attribute for all pm messages and the
            attribute is 'stream' for stream messages.

To live-update the compose box whenever a user is deactivated or
activated, the server_events_dispatch is used, which simultaneously
updates when the user is deactivated or activated.

Node tests are added according to the changes made.

Fixes: zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Mar 18, 2023
This commit updates the compose box for deactivated users.

There are three different locations where the compose box should
be updated for deactivated users:

- PM & group PM
- Recent conversations narrow
- All messages narrow

In all the above cases, the recipient label inside the compose box
changes, which is the key starting point to implement this feature.

To ensure the compose box does not open when clicked on in the case
of a deactivated user, a function 'check_pm_deactivated' was added
inside the 'compose_actions.js' file. Since there is no 'opts' to
determine the recipients for a closed_compose_box, this function
takes two arguments and is required for updating the
closed_compose_box as well. This function checks if the given
user_ids array contains any deactivated users. If so, it returns two
values: the first is a boolean value indicating whether there is a
deactivated user or not, and the second indicates the number of
deactivated users, which is helpful for updating the tooltip
accordingly. Even if the user is deactivated and the compose_box is
disabled, the other two buttons 'New Topic' and 'New Private Message'
should still work, as checked by the 'check_new_topic_or_pm_trigger'
function.

To update the compose box for deactivated users, a function
'update_reply_button_deactivated_users' was added inside
'compose_closed_ui.js'. This function is used to verify if there are
any deactivated users among the recipients and update the compose box
accordingly. To get the recipients, there are three different
approaches for the three cases defined above:

- pm-with: narrow_state contains the pm_ids, which are used to get
            the recipients

- group-pm-with & all messages narrow: the selected message row can be
            used, and to distinguish between stream and pm messages,
            the 'is_Array' function is used, since for stream
            messages, the 'selected_message().display_recipient' is a
            string, but for pm messages, it is an array

- recent conversations narrow: the focused row message is used to get
            the recipients, and to distinguish between stream and pm
            messages, one argument message is passed, which has the
            'display_reply_to' attribute for all pm messages and the
            attribute is 'stream' for stream messages.

To live-update the compose box whenever a user is deactivated or
activated, the server_events_dispatch is used, which simultaneously
updates when the user is deactivated or activated.

Node tests are added according to the changes made.

Fixes: zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Apr 25, 2023
This commit updates the compose box for deactivated users.

There are three different locations where the compose box should
be updated for deactivated users:

- PM & group PM
- Recent conversations narrow
- All messages narrow

In all the above cases, the recipient label inside the compose box
changes, which is the key starting point to implement this feature.

To ensure the compose box does not open when clicked on in the case
of a deactivated user, a function 'check_pm_deactivated' was added
inside the 'compose_actions.js' file. Since there is no 'opts' to
determine the recipients for a closed_compose_box, this function
takes two arguments and is required for updating the
closed_compose_box as well. This function checks if the given
user_ids array contains any deactivated users. If so, it returns two
values: the first is a boolean value indicating whether there is a
deactivated user or not, and the second indicates the number of
deactivated users, which is helpful for updating the tooltip
accordingly. Even if the user is deactivated and the compose_box is
disabled, the other two buttons 'New Topic' and 'New Private Message'
should still work, as checked by the 'check_new_topic_or_pm_trigger'
function.

To update the compose box for deactivated users, a function
'update_reply_button_deactivated_users' was added inside
'compose_closed_ui.js'. This function is used to verify if there are
any deactivated users among the recipients and update the compose box
accordingly. To get the recipients, there are three different
approaches for the three cases defined above:

- pm-with: narrow_state contains the pm_ids, which are used to get
            the recipients

- group-pm-with & all messages narrow: the selected message row can be
            used, and to distinguish between stream and pm messages,
            the 'is_Array' function is used, since for stream
            messages, the 'selected_message().display_recipient' is a
            string, but for pm messages, it is an array

- recent conversations narrow: the focused row message is used to get
            the recipients, and to distinguish between stream and pm
            messages, one argument message is passed, which has the
            'display_reply_to' attribute for all pm messages and the
            attribute is 'stream' for stream messages.

To live-update the compose box whenever a user is deactivated or
activated, the server_events_dispatch is used, which simultaneously
updates when the user is deactivated or activated.

Node tests are added according to the changes made.

Fixes: zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Apr 25, 2023
This commit updates the compose box for deactivated users.

There are three different locations where the compose box should
be updated for deactivated users:

- PM & group PM
- Recent conversations narrow
- All messages narrow

In all the above cases, the recipient label inside the compose box
changes, which is the key starting point to implement this feature.

To ensure the compose box does not open when clicked on in the case
of a deactivated user, a function 'check_pm_deactivated' was added
inside the 'compose_actions.js' file. Since there is no 'opts' to
determine the recipients for a closed_compose_box, this function
takes two arguments and is required for updating the
closed_compose_box as well. This function checks if the given
user_ids array contains any deactivated users. If so, it returns two
values: the first is a boolean value indicating whether there is a
deactivated user or not, and the second indicates the number of
deactivated users, which is helpful for updating the tooltip
accordingly. Even if the user is deactivated and the compose_box is
disabled, the other two buttons 'New Topic' and 'New Private Message'
should still work, as checked by the 'check_new_topic_or_pm_trigger'
function.

To update the compose box for deactivated users, a function
'update_reply_button_deactivated_users' was added inside
'compose_closed_ui.js'. This function is used to verify if there are
any deactivated users among the recipients and update the compose box
accordingly. To get the recipients, there are three different
approaches for the three cases defined above:

- pm-with: narrow_state contains the pm_ids, which are used to get
            the recipients

- group-pm-with & all messages narrow: the selected message row can be
            used, and to distinguish between stream and pm messages,
            the 'is_Array' function is used, since for stream
            messages, the 'selected_message().display_recipient' is a
            string, but for pm messages, it is an array

- recent conversations narrow: the focused row message is used to get
            the recipients, and to distinguish between stream and pm
            messages, one argument message is passed, which has the
            'display_reply_to' attribute for all pm messages and the
            attribute is 'stream' for stream messages.

To live-update the compose box whenever a user is deactivated or
activated, the server_events_dispatch is used, which simultaneously
updates when the user is deactivated or activated.

Node tests are added according to the changes made.

Fixes: zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Apr 25, 2023
This commit updates the compose box for deactivated users.

There are three different locations where the compose box should
be updated for deactivated users:

- PM & group PM
- Recent conversations narrow
- All messages narrow

In all the above cases, the recipient label inside the compose box
changes, which is the key starting point to implement this feature.

To ensure the compose box does not open when clicked on in the case
of a deactivated user, a function 'check_pm_deactivated' was added
inside the 'compose_actions.js' file. Since there is no 'opts' to
determine the recipients for a closed_compose_box, this function
takes two arguments and is required for updating the
closed_compose_box as well. This function checks if the given
user_ids array contains any deactivated users. If so, it returns two
values: the first is a boolean value indicating whether there is a
deactivated user or not, and the second indicates the number of
deactivated users, which is helpful for updating the tooltip
accordingly. Even if the user is deactivated and the compose_box is
disabled, the other two buttons 'New Topic' and 'New Private Message'
should still work, as checked by the 'check_new_topic_or_pm_trigger'
function.

To update the compose box for deactivated users, a function
'update_reply_button_deactivated_users' was added inside
'compose_closed_ui.js'. This function is used to verify if there are
any deactivated users among the recipients and update the compose box
accordingly. To get the recipients, there are three different
approaches for the three cases defined above:

- pm-with: narrow_state contains the pm_ids, which are used to get
            the recipients

- group-pm-with & all messages narrow: the selected message row can be
            used, and to distinguish between stream and pm messages,
            the 'is_Array' function is used, since for stream
            messages, the 'selected_message().display_recipient' is a
            string, but for pm messages, it is an array

- recent conversations narrow: the focused row message is used to get
            the recipients, and to distinguish between stream and pm
            messages, one argument message is passed, which has the
            'display_reply_to' attribute for all pm messages and the
            attribute is 'stream' for stream messages.

To live-update the compose box whenever a user is deactivated or
activated, the server_events_dispatch is used, which simultaneously
updates when the user is deactivated or activated.

Node tests are added according to the changes made.

Fixes: zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue May 28, 2023
This commit updates the compose box for deactivated users.

There are three different locations where the compose box should
be updated for deactivated users:

- PM & group PM
- Recent conversations narrow
- All messages narrow

In all the above cases, the recipient label inside the compose box
changes, which is the key starting point to implement this feature.

To ensure the compose box does not open when clicked on in the case
of a deactivated user, a function 'check_pm_deactivated' was added
inside the 'compose_actions.js' file. Since there is no 'opts' to
determine the recipients for a closed_compose_box, this function
takes two arguments and is required for updating the
closed_compose_box as well. This function checks if the given
user_ids array contains any deactivated users. If so, it returns two
values: the first is a boolean value indicating whether there is a
deactivated user or not, and the second indicates the number of
deactivated users, which is helpful for updating the tooltip
accordingly. Even if the user is deactivated and the compose_box is
disabled, the other two buttons 'New Topic' and 'New Private Message'
should still work, as checked by the 'check_new_topic_or_pm_trigger'
function.

To update the compose box for deactivated users, a function
'update_reply_button_deactivated_users' was added inside
'compose_closed_ui.js'. This function is used to verify if there are
any deactivated users among the recipients and update the compose box
accordingly. To get the recipients, there are three different
approaches for the three cases defined above:

- pm-with: narrow_state contains the pm_ids, which are used to get
            the recipients

- group-pm-with & all messages narrow: the selected message row can be
            used, and to distinguish between stream and pm messages,
            the 'is_Array' function is used, since for stream
            messages, the 'selected_message().display_recipient' is a
            string, but for pm messages, it is an array

- recent conversations narrow: the focused row message is used to get
            the recipients, and to distinguish between stream and pm
            messages, one argument message is passed, which has the
            'display_reply_to' attribute for all pm messages and the
            attribute is 'stream' for stream messages.

To live-update the compose box whenever a user is deactivated or
activated, the server_events_dispatch is used, which simultaneously
updates when the user is deactivated or activated.

Node tests are added according to the changes made.

Fixes: zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Jun 8, 2023
This commit updates the compose box for deactivated users.

There are three different locations where the compose box should
be updated for deactivated users:

- PM & group PM
- Recent conversations narrow
- All messages narrow

In all the above cases, the recipient label inside the compose box
changes, which is the key starting point to implement this feature.

To ensure the compose box does not open when clicked on in the case
of a deactivated user, a function 'check_pm_deactivated' was added
inside the 'compose_actions.js' file. Since there is no 'opts' to
determine the recipients for a closed_compose_box, this function
takes two arguments and is required for updating the
closed_compose_box as well. This function checks if the given
user_ids array contains any deactivated users. If so, it returns two
values: the first is a boolean value indicating whether there is a
deactivated user or not, and the second indicates the number of
deactivated users, which is helpful for updating the tooltip
accordingly. Even if the user is deactivated and the compose_box is
disabled, the other two buttons 'New Topic' and 'New Private Message'
should still work, as checked by the 'check_new_topic_or_pm_trigger'
function.

To update the compose box for deactivated users, a function
'update_reply_button_deactivated_users' was added inside
'compose_closed_ui.js'. This function is used to verify if there are
any deactivated users among the recipients and update the compose box
accordingly. To get the recipients, there are three different
approaches for the three cases defined above:

- pm-with: narrow_state contains the pm_ids, which are used to get
            the recipients

- group-pm-with & all messages narrow: the selected message row can be
            used, and to distinguish between stream and pm messages,
            the 'is_Array' function is used, since for stream
            messages, the 'selected_message().display_recipient' is a
            string, but for pm messages, it is an array

- recent conversations narrow: the focused row message is used to get
            the recipients, and to distinguish between stream and pm
            messages, one argument message is passed, which has the
            'display_reply_to' attribute for all pm messages and the
            attribute is 'stream' for stream messages.

To live-update the compose box whenever a user is deactivated or
activated, the server_events_dispatch is used, which simultaneously
updates when the user is deactivated or activated.

Node tests are added according to the changes made.

Fixes zulip#22278
@palashb01
Copy link
Collaborator

Commenting here to inform you that I have an open PR for this issue. I'm not sure why I couldn't link my PR to this issue, even after correcting the PR description or commit description. In any case, I am providing the link to the PR for cross-referencing.
#23899

palashb01 added a commit to palashb01/zulip that referenced this issue Jul 17, 2023
This commit updates the compose box for deactivated users.

There are three different locations where the compose box should
be updated for deactivated users:

- PM & group PM
- Recent conversations narrow
- All messages narrow

In all the above cases, the recipient label inside the compose box
changes, which is the key starting point to implement this feature.

To ensure the compose box does not open when clicked on in the case
of a deactivated user, a function 'check_pm_deactivated' was added
inside the 'compose_actions.js' file. Since there is no 'opts' to
determine the recipients for a closed_compose_box, this function
takes two arguments and is required for updating the
closed_compose_box as well. This function checks if the given
user_ids array contains any deactivated users. If so, it returns two
values: the first is a boolean value indicating whether there is a
deactivated user or not, and the second indicates the number of
deactivated users, which is helpful for updating the tooltip
accordingly. Even if the user is deactivated and the compose_box is
disabled, the other two buttons 'New Topic' and 'New Private Message'
should still work, as checked by the 'check_new_topic_or_pm_trigger'
function.

To update the compose box for deactivated users, a function
'update_reply_button_deactivated_users' was added inside
'compose_closed_ui.js'. This function is used to verify if there are
any deactivated users among the recipients and update the compose box
accordingly. To get the recipients, there are three different
approaches for the three cases defined above:

- pm-with: narrow_state contains the pm_ids, which are used to get
            the recipients

- group-pm-with & all messages narrow: the selected message row can be
            used, and to distinguish between stream and pm messages,
            the 'is_Array' function is used, since for stream
            messages, the 'selected_message().display_recipient' is a
            string, but for pm messages, it is an array

- recent conversations narrow: the focused row message is used to get
            the recipients, and to distinguish between stream and pm
            messages, one argument message is passed, which has the
            'display_reply_to' attribute for all pm messages and the
            attribute is 'stream' for stream messages.

To live-update the compose box whenever a user is deactivated or
activated, the server_events_dispatch is used, which simultaneously
updates when the user is deactivated or activated.

Node tests are added according to the changes made.

Fixes zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Aug 13, 2023
This commit updates the compose box for deactivated users.

There are three different locations where the compose box should
be updated for deactivated users:

- PM & group PM
- Recent conversations narrow
- All messages narrow

In all the above cases, the recipient label inside the compose box
changes, which is the key starting point to implement this feature.

To ensure the compose box does not open when clicked on in the case
of a deactivated user, a function 'check_pm_deactivated' was added
inside the 'compose_actions.js' file. Since there is no 'opts' to
determine the recipients for a closed_compose_box, this function
takes two arguments and is required for updating the
closed_compose_box as well. This function checks if the given
user_ids array contains any deactivated users. If so, it returns two
values: the first is a boolean value indicating whether there is a
deactivated user or not, and the second indicates the number of
deactivated users, which is helpful for updating the tooltip
accordingly. Even if the user is deactivated and the compose_box is
disabled, the other two buttons 'New Topic' and 'New Private Message'
should still work, as checked by the 'check_new_topic_or_pm_trigger'
function.

To update the compose box for deactivated users, a function
'update_reply_button_deactivated_users' was added inside
'compose_closed_ui.js'. This function is used to verify if there are
any deactivated users among the recipients and update the compose box
accordingly. To get the recipients, there are three different
approaches for the three cases defined above:

- pm-with: narrow_state contains the pm_ids, which are used to get
            the recipients

- group-pm-with & all messages narrow: the selected message row can be
            used, and to distinguish between stream and pm messages,
            the 'is_Array' function is used, since for stream
            messages, the 'selected_message().display_recipient' is a
            string, but for pm messages, it is an array

- recent conversations narrow: the focused row message is used to get
            the recipients, and to distinguish between stream and pm
            messages, one argument message is passed, which has the
            'display_reply_to' attribute for all pm messages and the
            attribute is 'stream' for stream messages.

To live-update the compose box whenever a user is deactivated or
activated, the server_events_dispatch is used, which simultaneously
updates when the user is deactivated or activated.

Node tests are added according to the changes made.

Fixes zulip#22278
palashb01 added a commit to palashb01/zulip that referenced this issue Sep 6, 2023
This commit updates the compose box for deactivated users.

There are three different locations where the compose box should
be updated for deactivated users:

- PM & group PM
- Recent conversations narrow
- All messages narrow

In all the above cases, the recipient label inside the compose box
changes, which is the key starting point to implement this feature.

To ensure the compose box does not open when clicked on in the case
of a deactivated user, a function 'check_pm_deactivated' was added
inside the 'compose_actions.js' file. Since there is no 'opts' to
determine the recipients for a closed_compose_box, this function
takes two arguments and is required for updating the
closed_compose_box as well. This function checks if the given
user_ids array contains any deactivated users. If so, it returns two
values: the first is a boolean value indicating whether there is a
deactivated user or not, and the second indicates the number of
deactivated users, which is helpful for updating the tooltip
accordingly. Even if the user is deactivated and the compose_box is
disabled, the other two buttons 'New Topic' and 'New Private Message'
should still work, as checked by the 'check_new_topic_or_pm_trigger'
function.

To update the compose box for deactivated users, a function
'update_reply_button_deactivated_users' was added inside
'compose_closed_ui.js'. This function is used to verify if there are
any deactivated users among the recipients and update the compose box
accordingly. To get the recipients, there are three different
approaches for the three cases defined above:

- pm-with: narrow_state contains the pm_ids, which are used to get
            the recipients

- group-pm-with & all messages narrow: the selected message row can be
            used, and to distinguish between stream and pm messages,
            the 'is_Array' function is used, since for stream
            messages, the 'selected_message().display_recipient' is a
            string, but for pm messages, it is an array

- recent conversations narrow: the focused row message is used to get
            the recipients, and to distinguish between stream and pm
            messages, one argument message is passed, which has the
            'display_reply_to' attribute for all pm messages and the
            attribute is 'stream' for stream messages.

To live-update the compose box whenever a user is deactivated or
activated, the server_events_dispatch is used, which simultaneously
updates when the user is deactivated or activated.

Node tests are added according to the changes made.

Fixes zulip#22278
@timabbott timabbott added area: compose (banners & validation) Validation and banners in the compose box and removed area: compose (misc) labels Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: compose (banners & validation) Validation and banners in the compose box bug help wanted
Projects
None yet
Development

No branches or pull requests

6 participants