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

fix(chat input): should be disabled if user is not able to post #13825

Conversation

caybro
Copy link
Member

@caybro caybro commented Mar 4, 2024

What does the PR do

  • extend isUserAllowedToSendMessage to also cover Constants.chatType.communityChat
  • let admin always satisfy the permissions
  • hide the add emoji/reaction button instead of disabling it when the permissions are not met
  • adjust the error msg to better reflect the reality (tokens vs. permissions)

Fixes #13777

Affected areas

StatusChatInput,ChatColumnView

Screenshot of functionality (including design for comparison)

  • I've checked the design and this PR matches it
Zaznam.obrazovky.z.2024-03-04.11-17-37.webm

@caybro caybro linked an issue Mar 4, 2024 that may be closed by this pull request
@status-im-auto
Copy link
Member

status-im-auto commented Mar 4, 2024

Jenkins Builds

Click to see older builds (18)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 484bd7a #1 2024-03-04 10:09:25 ~5 min tests/nim 📄log
✔️ 484bd7a #1 2024-03-04 10:12:11 ~8 min macos/aarch64 🍎dmg
✔️ 484bd7a #1 2024-03-04 10:14:27 ~10 min tests/ui 📄log
✔️ 484bd7a #1 2024-03-04 10:16:10 ~12 min macos/x86_64 🍎dmg
✔️ 484bd7a #1 2024-03-04 10:21:22 ~17 min linux/x86_64 📦tgz
✔️ 484bd7a #1 2024-03-04 10:28:09 ~24 min windows/x86_64 💿exe
a91f577 #2 2024-03-05 09:02:14 ~2 min macos/aarch64 📄log
a91f577 #2 2024-03-05 09:04:04 ~4 min macos/x86_64 📄log
✔️ a91f577 #2 2024-03-05 09:05:11 ~5 min tests/nim 📄log
a91f577 #2 2024-03-05 09:07:45 ~8 min linux/x86_64 📄log
✔️ a91f577 #2 2024-03-05 09:09:52 ~10 min tests/ui 📄log
a91f577 #2 2024-03-05 09:22:58 ~23 min windows/x86_64 📄log
c2e7fb4 #3 2024-03-05 09:28:06 ~2 min macos/aarch64 📄log
c2e7fb4 #3 2024-03-05 09:29:47 ~4 min macos/x86_64 📄log
✔️ c2e7fb4 #3 2024-03-05 09:31:31 ~6 min tests/nim 📄log
c2e7fb4 #3 2024-03-05 09:33:53 ~8 min linux/x86_64 📄log
✔️ c2e7fb4 #3 2024-03-05 09:36:59 ~11 min tests/ui 📄log
c2e7fb4 #3 2024-03-05 09:40:31 ~15 min windows/x86_64 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 1006085 #4 2024-03-05 09:52:40 ~4 min macos/aarch64 🍎dmg
✔️ 1006085 #4 2024-03-05 09:54:54 ~6 min tests/nim 📄log
✔️ 1006085 #4 2024-03-05 09:56:00 ~7 min macos/x86_64 🍎dmg
✔️ ff3b36f #5 2024-03-05 10:03:17 ~4 min macos/aarch64 🍎dmg
✔️ ff3b36f #5 2024-03-05 10:05:45 ~6 min tests/nim 📄log
✔️ ff3b36f #5 2024-03-05 10:05:58 ~6 min macos/x86_64 🍎dmg
✔️ ff3b36f #5 2024-03-05 10:09:39 ~10 min tests/ui 📄log
✔️ ff3b36f #5 2024-03-05 10:17:10 ~18 min linux/x86_64 📦tgz
✔️ ff3b36f #5 2024-03-05 10:19:05 ~19 min windows/x86_64 💿exe

@caybro caybro changed the title fixc(chat input): should be disabled if user is not able to post fix(chat input): should be disabled if user is not able to post Mar 4, 2024
@caybro caybro marked this pull request as ready for review March 4, 2024 10:18
@@ -1246,7 +1246,7 @@ Rectangle {
padding: 0
// This is needed to make sure the text area is disabled when the input is disabled
Binding on enabled {
value: root.enabled
value: control.enabled
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The top element is called control here, not root

Copy link
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this branch because I needed to also modify something relative to the blocked chat input and while testing I found a bug. As soon as a channel has a permission, you can no longer post on it. In this case, I am a TM and the field says that all is good, but I can click on the input an write

input.webm

@jrainville
Copy link
Member

FYI, I opened a PR that adds a new disabled message for when a permission is pending.

A dumb way to fix the issue for now would be to disable the input when the placeholder text is not Message

@caybro caybro force-pushed the 13777-chat-input-should-be-disabled-if-user-is-not-able-to-post branch from 484bd7a to a91f577 Compare March 5, 2024 08:58
@caybro caybro force-pushed the 13777-chat-input-should-be-disabled-if-user-is-not-able-to-post branch 2 times, most recently from c2e7fb4 to 1006085 Compare March 5, 2024 09:48
- extend `isUserAllowedToSendMessage` to also cover
`Constants.chatType.communityChat`
- let `admin` always satisfy the permissions
- hide the add emoji/reaction button instead of disabling it when the
permissions are not met
- adjust the error msg to better reflect the reality (tokens vs.
permissions)

Fixes #13777
@caybro caybro force-pushed the 13777-chat-input-should-be-disabled-if-user-is-not-able-to-post branch from 1006085 to ff3b36f Compare March 5, 2024 09:58
Copy link
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. I'll test it

Copy link
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine!

Copy link
Contributor

@alexjba alexjba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@caybro caybro merged commit b623c8f into master Mar 5, 2024
8 checks passed
@caybro caybro deleted the 13777-chat-input-should-be-disabled-if-user-is-not-able-to-post branch March 5, 2024 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chat input should be disabled if user is not able to post
4 participants