Show correct drawer message for pending community request (#20485)

This commit is contained in:
Parvesh Monu 2024-06-21 17:20:20 +05:30 committed by GitHub
parent b5a09a334a
commit 5ee5d70567
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 14 deletions

View File

@ -16,8 +16,13 @@
contact-id]) contact-id])
{:keys [contact-request-state community-id]} (rf/sub [:chats/current-chat-chat-view]) {:keys [contact-request-state community-id]} (rf/sub [:chats/current-chat-chat-view])
chat-type (rf/sub [:chats/chat-type]) chat-type (rf/sub [:chats/chat-type])
joined (rf/sub [:communities/community-joined community-chat? (= chat-type :community-chat)
community-id]) joined (when community-chat?
(rf/sub [:communities/community-joined
community-id]))
pending? (when community-chat?
(rf/sub [:communities/my-pending-request-to-join
community-id]))
contact-request-send? (or (not contact-request-state) contact-request-send? (or (not contact-request-state)
(= contact-request-state (= contact-request-state
constants/contact-request-state-none)) constants/contact-request-state-none))
@ -28,19 +33,28 @@
[rn/view {:style style/container} [rn/view {:style style/container}
[quo/permission-context [quo/permission-context
{:blur? true {:blur? true
:on-press (condp = chat-type :on-press (cond
:community-chat #(rf/dispatch [:open-modal :community-account-selection-sheet (and community-chat? (not pending?) (not joined))
{:community-id community-id}]) #(rf/dispatch [:open-modal :community-account-selection-sheet
{:community-id community-id}])
(not community-chat?)
#(rf/dispatch [:chat.ui/show-profile contact-id])) #(rf/dispatch [:chat.ui/show-profile contact-id]))
:type :action :type :action
:action-icon (cond :action-icon (cond
(= chat-type :community-chat) :i/communities community-chat? :i/communities
contact-request-pending? :i/pending-state contact-request-pending? :i/pending-state
:else :i/add-user) :else :i/add-user)
:action-label (cond :action-label (cond
(= chat-type :community-chat) community-chat?
(if joined (cond
pending?
(i18n/label :t/request-to-join-community-pending)
joined
(i18n/label :t/no-permissions-to-post) (i18n/label :t/no-permissions-to-post)
:else
(i18n/label :t/join-community-to-post)) (i18n/label :t/join-community-to-post))
(= chat-type :group-chat) (= chat-type :group-chat)

View File

@ -44,15 +44,15 @@
(def stack-slide-transition (def stack-slide-transition
{:push {:content {:translationX {:from (:width (rn/get-window)) {:push {:content {:translationX {:from (:width (rn/get-window))
:to 0 :to 0
:duration 200}}} :duration 250}}}
:pop {:content {:translationX {:from 0 :pop {:content {:translationX {:from 0
:to (:width (rn/get-window)) :to (:width (rn/get-window))
:duration 200}}}}) :duration 250}}}})
(def stack-transition-from-bottom (def stack-transition-from-bottom
{:push {:content {:translationY {:from (:height (rn/get-window)) {:push {:content {:translationY {:from (:height (rn/get-window))
:to 0 :to 0
:duration 200}}} :duration 250}}}
:pop {:content {:translationY {:from 0 :pop {:content {:translationY {:from 0
:to (:height (rn/get-window)) :to (:height (rn/get-window))
:duration 200}}}}) :duration 250}}}})

View File

@ -1276,6 +1276,7 @@
"request-to-join-disclaimer": "Joining the community will reveal your public addresses to the owner", "request-to-join-disclaimer": "Joining the community will reveal your public addresses to the owner",
"request-to-join": "Request to join", "request-to-join": "Request to join",
"request-to-join-community": "Request to join community", "request-to-join-community": "Request to join community",
"request-to-join-community-pending": "Request to join community pending",
"requested-to-join-community": "You requested to join “{{community}}”", "requested-to-join-community": "You requested to join “{{community}}”",
"request-transaction": "Request transaction", "request-transaction": "Request transaction",
"required-field": "Required field", "required-field": "Required field",