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

Fixes #12192 -- Disable fetching more messages when status nodes are … #13450

Merged
merged 4 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Grey-out the fetch more messages button when status nodes are disabled
  • Loading branch information
ibrkhalil committed Jun 6, 2022
commit 9da68c0108256c3610adf41f2bed364dde443fea
8 changes: 8 additions & 0 deletions .calva/output-window/output.calva-repl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
; This is the Calva evaluation results output window.
; TIPS: The keyboard shortcut `ctrl+alt+o o` shows and focuses this window
; when connected to a REPL session.
; Please see https://calva.io/output/ for more info.
; Happy coding! ♥️

; Connecting ...
; No nrepl port file found.
6 changes: 6 additions & 0 deletions src/status_im/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
[status-im.ethereum.tokens :as tokens]
[status-im.ethereum.transactions.core :as transactions]
[status-im.fleet.core :as fleet]
[status-im.mailserver.core :as mailserver]
[status-im.group-chats.db :as group-chats.db]
[status-im.communities.core :as communities]
[status-im.group-chats.core :as group-chat]
Expand Down Expand Up @@ -2482,6 +2483,11 @@
(= (get-in mailserver [:id :value])
current-mailserver-id)))

(re-frame/reg-sub
:mailserver/use-status-nodes?
(fn [db _]
(boolean (mailserver/fetch-use-mailservers? {:db db}))))

(re-frame/reg-sub
:mailserver.edit/validation-errors
:<- [:mailserver.edit/mailserver]
Expand Down
5 changes: 3 additions & 2 deletions src/status_im/ui/screens/chat/message/gap.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@
gap-ids
chat-id]
connected? [:mailserver/connected?]
use-status-nodes? [:mailserver/use-status-nodes?]
first-gap? (= gap-ids #{:first-gap})]
(when (or (not first-gap?) public? community?)
[react/view {:style (style/gap-container)}
[react/touchable-highlight
{:on-press (when (and connected? (not in-progress?))
{:on-press (when (and connected? (and (not in-progress?) use-status-nodes?))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can simplify, as and is a multi-variadic function, so you can do:

(and
  connected?
  (not in-progress?)
  use-status-nodes?)

Which should be equivalent to:

 (and
    connected?
    (and
       (not in-progress?)
       use-status-nodes?))

Copy link
Contributor Author

@ibrkhalil ibrkhalil Jun 6, 2022

Choose a reason for hiding this comment

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

Thanks Andrea
Removed the redundant and function

(on-press chat-id gap-ids))
:style style/touchable}
[react/view {:style style/label-container}
(if in-progress?
[react/activity-indicator]
[react/nested-text
{:style (style/gap-text connected?)}
{:style (style/gap-text (and connected? use-status-nodes?))}
(i18n/label (if first-gap? :t/load-more-messages :t/fetch-messages))
(when first-gap?
[{:style style/date}
Expand Down