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
compose: Check posting policy for direct messages. #25572
Conversation
8e9d2d0
to
7516b71
Compare
Looks good to me, other than the banner text change, which should be reverted. |
I have updated it, @alya, can you take look at updated screen capture(2nd one)? I think tooltip looks odd in this case. Should we increase width a little bit ? |
Can you please post just a screenshot with the corrected banner? In general, always use a screenshot, as the PR template notes. Screenshots are easier for me to review than videos, which can be nice additions, but aren't a replacement. |
Similarly, a screenshot would help review the tooltip question. |
web/src/tippyjs.js
Outdated
} | ||
return $t({ | ||
defaultMessage: "You do not have permission to post in this stream.", | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to avoid the code duplication that we have for these strings. One idea would be to extract a compose_recipient.get_posting_policy_error_message
function that returns ""
or the error string depending on whether you're allowed to send messages, and use that both here and in check_posting_policy_for_compose_box
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay what I commented earlier was pending for 10 hours and now got deleted.
I was saying that one thing to notice is I have created a new function in stream_data
which is get_sub_by_id
, to avoid 3 calls to get can_post_messages_in_stream
as "get stream name", "get stream" and "get can_post_messages_in_stream", Now it is using 2 calls.
Should I do this in a separate commit?
7516b71
to
66ae2af
Compare
@alya , I have updated Screenshots. I was talking about tooltip in first Screenshot, as there is too empty space at end which gives some odd look. |
Got it. Sure, giving the tooltips a bit more space so that the text fits in English seems helpful (in a separate commit). Thanks! |
Sure, So I am doing maxWidth to 350, which works on most of the zoom-ins and zoom-outs. |
0055e2b
to
085e2a5
Compare
Thanks! You should post updated screenshots. :) |
This mostly lgtm but I'm going to defer merging until screenshots are posted. Thanks @brijsiyag! |
Ooh yes I should have, an another bug caught my attention and I forgot to do so. |
085e2a5
to
4cf2fbc
Compare
@timabbott , I have updated the code, PTAL. |
The updated screenshots look good to me. @timabbott let me know if you'd like me to retest this PR. |
4cf2fbc
to
7ff97d1
Compare
I got rid of (Please comment if you see any problem with my changes). |
@timabbott , why I'm not able to see the changes in |
Prior this commit, changing the message type from a stream (where posting was not allowed) to a direct message using the compose box dropdown, did not changed the state of the send button from disabled to enabled even though direct messages were allowed in the organization. This was happening because `check_stream_posting_policy_for_compose_box` was only for streams. Now, function is updated to check for both streams and direct messages, as it checks if direct messages are allowed or not, and depending on that, it updates the send button's state, tooltip and displays a relevant banner.
Changes the tooltip max-width on the disabled send button from 300px to 350px to remove the weird looking padding at the end.
7ff97d1
to
5179cd0
Compare
Fixed. |
After the changes in zulip#25572, users were no longer able to start a direct message with bots if the organization disabled direct messages. However, we should allow direct messages to bots regardless of the policy because it's a useful interface for users to interact with various classes of bots. user_ids_string_to_ids_array was also modified to prevent cases where the split function returned an array of [0] rather than [] when dealing with a empty id string of "". Fixes: zulip#21896.
After the changes in zulip#25572, users were no longer able to start a direct message with bots if the organization disabled direct messages. However, we should allow direct messages to bots regardless of the policy because it's a useful interface for users to interact with various classes of bots. user_ids_string_to_ids_array was also modified to prevent cases where the split function returned an array of [0] rather than [] when dealing with a empty id string of "". Fixes: zulip#21896.
After the changes in zulip#25572, users were no longer able to start a direct message with bots if the organization disabled direct messages. However, we should allow direct messages to bots regardless of the policy because it's a useful interface for users to interact with various classes of bots. user_ids_string_to_ids_array was also modified to prevent cases where the split function returned an array of [0] rather than [] when dealing with a empty id string of "". Fixes: zulip#21896.
After the changes in zulip#25572, users were no longer able to start a direct message with bots if the organization disabled direct messages. However, we should allow direct messages to bots regardless of the policy because it's a useful interface for users to interact with various classes of bots. user_ids_string_to_ids_array was also modified to prevent cases where the split function returned an array of [0] rather than [] when dealing with a empty id string of "". Fixes: zulip#21896.
After the changes in #25572, users were no longer able to start a direct message with bots if the organization disabled direct messages. However, we should allow direct messages to bots regardless of the policy because it's a useful interface for users to interact with various classes of bots. user_ids_string_to_ids_array was also modified to prevent cases where the split function returned an array of [0] rather than [] when dealing with a empty id string of "". Fixes: #21896.
After the changes in zulip#25572, users were no longer able to start a direct message with bots if the organization disabled direct messages. However, we should allow direct messages to bots regardless of the policy because it's a useful interface for users to interact with various classes of bots. user_ids_string_to_ids_array was also modified to prevent cases where the split function returned an array of [0] rather than [] when dealing with a empty id string of "". Fixes: zulip#21896.
After the changes in zulip#25572, users were no longer able to start a direct message with bots if the organization disabled direct messages. However, we should allow direct messages to bots regardless of the policy because it's a useful interface for users to interact with various classes of bots. user_ids_string_to_ids_array was also modified to prevent cases where the split function returned an array of [0] rather than [] when dealing with a empty id string of "". Fixes: zulip#21896.
After the changes in zulip#25572, users were no longer able to start a direct message with bots if the organization disabled direct messages. However, we should allow direct messages to bots regardless of the policy because it's a useful interface for users to interact with various classes of bots. user_ids_string_to_ids_array was also modified to prevent cases where the split function returned an array of [0] rather than [] when dealing with a empty id string of "". Fixes: zulip#21896.
Prior this commit, changing the message type from a stream (where posting was not allowed) to a direct message using the compose box dropdown, did not changed the state of the submit button from disabled to enabled even though direct messages were allowed in the organization. Now, it checks if direct messages are allowed or not, and depending on that, it updates the send button's state, tooltip and displays a relevant banner.
Screenshots and screen captures:
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: