Merge branch 'develop'
This commit is contained in:
commit
d52adc6c06
|
@ -0,0 +1,79 @@
|
||||||
|
DROP VIEW "public"."claims_view" CASCADE;
|
||||||
|
|
||||||
|
CREATE VIEW "public"."claims_view" AS SELECT i.title AS issue_title,
|
||||||
|
i.issue_number,
|
||||||
|
r.repo AS repo_name,
|
||||||
|
r.owner AS repo_owner,
|
||||||
|
COALESCE(u.name, u.login) AS user_name,
|
||||||
|
u.avatar_url AS user_avatar_url,
|
||||||
|
i.payout_receipt,
|
||||||
|
p.updated,
|
||||||
|
i.updated AS issue_updated,
|
||||||
|
i.balance_eth,
|
||||||
|
i.tokens,
|
||||||
|
i.value_usd,
|
||||||
|
p.state AS pr_state,
|
||||||
|
i.is_open AS issue_open,
|
||||||
|
(case when u.address IS NULL THEN false ELSE true END) AS user_has_address
|
||||||
|
FROM issues i,
|
||||||
|
users u,
|
||||||
|
repositories r,
|
||||||
|
pull_requests p
|
||||||
|
WHERE r.repo_id = i.repo_id
|
||||||
|
AND p.issue_id = i.issue_id
|
||||||
|
AND p.user_id = u.id
|
||||||
|
AND i.contract_address IS NOT NULL
|
||||||
|
AND i.comment_id IS NOT NULL
|
||||||
|
ORDER BY p.updated;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW "public"."activity_feed_view" AS
|
||||||
|
SELECT 'open-claim'::text AS type,
|
||||||
|
claims_view.issue_title,
|
||||||
|
claims_view.repo_name,
|
||||||
|
claims_view.repo_owner,
|
||||||
|
claims_view.issue_number,
|
||||||
|
claims_view.user_name,
|
||||||
|
claims_view.user_avatar_url,
|
||||||
|
claims_view.balance_eth,
|
||||||
|
claims_view.tokens,
|
||||||
|
claims_view.value_usd,
|
||||||
|
claims_view.user_has_address,
|
||||||
|
claims_view.updated
|
||||||
|
FROM claims_view
|
||||||
|
WHERE claims_view.pr_state = 0
|
||||||
|
AND claims_view.payout_receipt IS NULL
|
||||||
|
AND claims_view.issue_open IS TRUE
|
||||||
|
UNION
|
||||||
|
SELECT 'claim-pending'::text AS type,
|
||||||
|
claims_view.issue_title,
|
||||||
|
claims_view.repo_name,
|
||||||
|
claims_view.repo_owner,
|
||||||
|
claims_view.issue_number,
|
||||||
|
claims_view.user_name,
|
||||||
|
claims_view.user_avatar_url,
|
||||||
|
claims_view.balance_eth,
|
||||||
|
claims_view.tokens,
|
||||||
|
claims_view.value_usd,
|
||||||
|
claims_view.user_has_address,
|
||||||
|
claims_view.issue_updated AS updated
|
||||||
|
FROM claims_view
|
||||||
|
WHERE claims_view.pr_state = 1
|
||||||
|
AND claims_view.payout_receipt IS NULL
|
||||||
|
UNION
|
||||||
|
SELECT 'claim-payout'::text AS type,
|
||||||
|
claims_view.issue_title,
|
||||||
|
claims_view.repo_name,
|
||||||
|
claims_view.repo_owner,
|
||||||
|
claims_view.issue_number,
|
||||||
|
claims_view.user_name,
|
||||||
|
claims_view.user_avatar_url,
|
||||||
|
claims_view.balance_eth,
|
||||||
|
claims_view.tokens,
|
||||||
|
claims_view.value_usd,
|
||||||
|
claims_view.user_has_address,
|
||||||
|
claims_view.issue_updated AS updated
|
||||||
|
FROM claims_view
|
||||||
|
WHERE claims_view.pr_state = 1
|
||||||
|
AND claims_view.payout_receipt IS NOT NULL
|
||||||
|
ORDER BY 12 DESC;
|
|
@ -571,6 +571,7 @@ SELECT
|
||||||
balance_eth,
|
balance_eth,
|
||||||
tokens,
|
tokens,
|
||||||
value_usd,
|
value_usd,
|
||||||
|
user_has_address,
|
||||||
updated
|
updated
|
||||||
FROM activity_feed_view
|
FROM activity_feed_view
|
||||||
ORDER BY updated DESC
|
ORDER BY updated DESC
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
[commiteth.eth.core :as eth]
|
[commiteth.eth.core :as eth]
|
||||||
[commiteth.github.core :as github]
|
[commiteth.github.core :as github]
|
||||||
[clojure.tools.logging :as log]
|
[clojure.tools.logging :as log]
|
||||||
[commiteth.eth.core :as eth]
|
|
||||||
[commiteth.config :refer [env]]
|
[commiteth.config :refer [env]]
|
||||||
[commiteth.util.util :refer [usd-decimal->str
|
[commiteth.util.util :refer [usd-decimal->str
|
||||||
eth-decimal->str]]
|
eth-decimal->str]]
|
||||||
|
@ -155,7 +154,8 @@
|
||||||
:issue_number :issue-number
|
:issue_number :issue-number
|
||||||
:value_usd :value-usd
|
:value_usd :value-usd
|
||||||
:claim_count :claim-count
|
:claim_count :claim-count
|
||||||
:balance_eth :balance-eth}]
|
:balance_eth :balance-eth
|
||||||
|
:user_has_address :user-has-address}]
|
||||||
(map #(-> %
|
(map #(-> %
|
||||||
(rename-keys renames)
|
(rename-keys renames)
|
||||||
(update :value-usd usd-decimal->str)
|
(update :value-usd usd-decimal->str)
|
||||||
|
@ -185,28 +185,9 @@
|
||||||
(dissoc :email)
|
(dissoc :email)
|
||||||
(assoc :status-team-member? status-member?))}))
|
(assoc :status-team-member? status-member?))}))
|
||||||
|
|
||||||
;; NOTE: This assumes username can be trusted and not tampered with
|
(defn user-whitelisted? [user]
|
||||||
(def user-whitelisted?
|
(let [whitelist (env :user-whitelist #{})]
|
||||||
#{"oskarth"
|
(whitelist user)))
|
||||||
"tpatja"
|
|
||||||
"carlbennetts"
|
|
||||||
"jarradh"
|
|
||||||
"anna02test"
|
|
||||||
"anna03test"
|
|
||||||
"anna04test"
|
|
||||||
"anna05test"
|
|
||||||
"anna06test"
|
|
||||||
"anna07test"
|
|
||||||
"anna08test"
|
|
||||||
"anna09test"
|
|
||||||
"pablanopete"
|
|
||||||
"andytudhope"
|
|
||||||
"ara4n"
|
|
||||||
"commitethtest"
|
|
||||||
"noman-land"
|
|
||||||
"cancuncoconut"
|
|
||||||
"Chu127001"
|
|
||||||
"izqui"})
|
|
||||||
|
|
||||||
(defapi service-routes
|
(defapi service-routes
|
||||||
(when (:dev env)
|
(when (:dev env)
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
item-type
|
item-type
|
||||||
repo-owner
|
repo-owner
|
||||||
repo-name
|
repo-name
|
||||||
issue-number] :as item}]
|
issue-number
|
||||||
|
user-has-address] :as item}]
|
||||||
(let [issue-link [:a
|
(let [issue-link [:a
|
||||||
{:href (issue-url repo-owner repo-name issue-number)}
|
{:href (issue-url repo-owner repo-name issue-number)}
|
||||||
issue-title]]
|
issue-title]]
|
||||||
|
@ -21,7 +22,10 @@
|
||||||
" for " issue-link]
|
" for " issue-link]
|
||||||
"open-claim" [:div "Submitted a claim for " issue-link]
|
"open-claim" [:div "Submitted a claim for " issue-link]
|
||||||
"balance-update" [:div issue-link " bounty increased to USD " value-usd]
|
"balance-update" [:div issue-link " bounty increased to USD " value-usd]
|
||||||
"claim-pending" [:div "Won USD " value-usd " for " issue-link " (payout pending maintainer confirmation)"]
|
"claim-pending" [:div "Won USD " value-usd " for " issue-link
|
||||||
|
(if user-has-address
|
||||||
|
" (payout pending maintainer confirmation)"
|
||||||
|
" (payout pending user to update ETH address)")]
|
||||||
"")))
|
"")))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue