mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-11 10:06:20 +00:00
193 review fixes
This commit is contained in:
parent
596e6c9439
commit
c66691ca23
@ -69,6 +69,7 @@
|
||||
[lein-auto "0.1.2"]
|
||||
[lein-less "1.7.5"]
|
||||
[lein-shell "0.5.0"]
|
||||
[cider/cider-nrepl "0.15.0-SNAPSHOT"]
|
||||
[lein-sha-version "0.1.1"]]
|
||||
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE users
|
||||
DROP COLUMN is_hidden;
|
||||
|
||||
-- restore the previous version of the view
|
||||
CREATE OR REPLACE VIEW "public"."claims_view" AS
|
||||
SELECT
|
||||
@ -32,4 +29,7 @@ SELECT
|
||||
AND i.comment_id IS NOT NULL
|
||||
ORDER BY p.updated;
|
||||
|
||||
ALTER TABLE users
|
||||
DROP COLUMN is_hidden_in_hunters;
|
||||
|
||||
COMMIT;
|
||||
|
@ -1,7 +1,7 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE users
|
||||
ADD COLUMN is_hidden BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
ADD COLUMN is_hidden_in_hunters BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
CREATE OR REPLACE VIEW "public"."claims_view" AS
|
||||
SELECT
|
||||
@ -29,7 +29,7 @@ SELECT
|
||||
AND p.user_id = u.id
|
||||
AND i.contract_address IS NOT NULL
|
||||
AND i.comment_id IS NOT NULL
|
||||
AND NOT u.is_hidden -- added
|
||||
AND NOT u.is_hidden_in_hunters -- added
|
||||
ORDER BY p.updated;
|
||||
|
||||
COMMIT;
|
||||
|
@ -85,7 +85,7 @@
|
||||
IPersistentVector
|
||||
(sql-value [value] (to-pg-json value)))
|
||||
|
||||
(defmacro with-trx [& body]
|
||||
(defmacro with-tx [& body]
|
||||
"Performs a set of queries in transaction."
|
||||
`(conman/with-transaction [*db*]
|
||||
~@body))
|
||||
|
@ -227,11 +227,11 @@
|
||||
:auth-rules authenticated?
|
||||
:current-user user
|
||||
:body [body {(s/optional-key :address) s/Str
|
||||
(s/optional-key :is_hidden) s/Bool}]
|
||||
(s/optional-key :is_hidden_in_hunters) s/Bool}]
|
||||
:summary "Updates user's fields."
|
||||
|
||||
(let [user-id (:id user)
|
||||
fields (select-keys body [:address :is_hidden])]
|
||||
fields (select-keys body [:address :is_hidden_in_hunters])]
|
||||
|
||||
(when (empty? fields)
|
||||
(bad-request! "No incoming fields were found."))
|
||||
@ -241,11 +241,9 @@
|
||||
(log/debugf "POST /user: Wrong address %s" address)
|
||||
(bad-request! (format "Invalid Ethereum address: %s" address))))
|
||||
|
||||
(db/with-trx
|
||||
|
||||
(db/with-tx
|
||||
(when-not (db/user-exists? {:id user-id})
|
||||
(not-found! "No such a user."))
|
||||
|
||||
(db/update! :users fields ["id = ?" user-id]))
|
||||
|
||||
(ok)))
|
||||
|
@ -62,11 +62,6 @@
|
||||
(fn [db [_ path value]]
|
||||
(assoc-in db path value)))
|
||||
|
||||
(reg-event-db
|
||||
:update-in
|
||||
(fn [db [_ path func & args]]
|
||||
(apply update-in db path func args)))
|
||||
|
||||
(reg-event-db
|
||||
:set-active-page
|
||||
(fn [db [_ page]]
|
||||
@ -322,6 +317,10 @@
|
||||
{:db db
|
||||
:dispatch [:set-active-page :update-address]}))
|
||||
|
||||
(reg-event-db
|
||||
:update-user
|
||||
(fn [db [_ fields]]
|
||||
(update db :user merge fields)))
|
||||
|
||||
(reg-event-fx
|
||||
:save-user-fields
|
||||
@ -330,7 +329,7 @@
|
||||
:http {:method POST
|
||||
:url "/api/user"
|
||||
:on-success #(do
|
||||
(dispatch [:update-in [:user] merge fields])
|
||||
(dispatch [:update-user fields])
|
||||
(dispatch [:set-flash-message
|
||||
:success
|
||||
"Settings saved"]))
|
||||
|
@ -10,7 +10,7 @@
|
||||
(let [db (rf/subscribe [:db])
|
||||
updating-user (rf/subscribe [:get-in [:updating-user]])
|
||||
address (r/atom @(rf/subscribe [:get-in [:user :address]]))
|
||||
hidden (rf/subscribe [:get-in [:user :is_hidden]])]
|
||||
is-hidden (rf/subscribe [:get-in [:user :is_hidden_in_hunters]])]
|
||||
|
||||
(fn []
|
||||
(let [web3 (:web3 @db)
|
||||
@ -23,7 +23,7 @@
|
||||
[:div.field
|
||||
(if-not (empty? web3-accounts)
|
||||
; Add value of address if it's missing from items list.
|
||||
; If address is empty, add title
|
||||
; If address is empty, add title
|
||||
(let [accounts (map str/lower-case web3-accounts)
|
||||
addr @address
|
||||
title "Select address"
|
||||
@ -35,7 +35,7 @@
|
||||
items (cond->> web3-accounts
|
||||
addr-not-in-web3? (into [addr])
|
||||
(not addr) (into [title]))]
|
||||
[dropdown {:class "address-input"}
|
||||
[dropdown {:class "address-input"}
|
||||
title
|
||||
address
|
||||
items])
|
||||
@ -55,15 +55,14 @@
|
||||
|
||||
[:h3 "Settings"]
|
||||
[:div
|
||||
|
||||
[:input
|
||||
{:type :checkbox
|
||||
:disabled @updating-user
|
||||
:id :input-hidden
|
||||
:checked @hidden
|
||||
:checked @is-hidden
|
||||
:on-change
|
||||
(fn [e]
|
||||
(let [value (-> e .-target .-checked)]
|
||||
(rf/dispatch [:save-user-fields {:is_hidden value}])))}]
|
||||
(rf/dispatch [:save-user-fields {:is_hidden_in_hunters value}])))}]
|
||||
|
||||
[:label {:for :input-hidden} "Disguise myself from the top hunters and activity lists."]]]]))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user