Show bounty open & balance update feed items in context of repo

For bounty related activity feed items:
* show full repository name in activity item title instead of admin name
* show owner avatar instead of admin avatar

Fixes: #41
This commit is contained in:
Teemu Patja 2017-03-16 22:37:07 +02:00
parent a3ec1591b5
commit 3ba4956a78
No known key found for this signature in database
GPG Key ID: F5B7035E6580FD4C
8 changed files with 28 additions and 6 deletions

View File

@ -0,0 +1,18 @@
ALTER TABLE "public"."repositories" ADD COLUMN "owner_avatar_url" character varying(255);
create or replace view bounties_view as
select
i.title as issue_title,
i.issue_number,
r.repo as repo_name,
r.owner as repo_owner,
concat(r.owner, '/', r.repo)::varchar(128) as user_name,
r.owner_avatar_url as user_avatar_url,
i.payout_receipt,
i.balance,
i.updated as updated
FROM issues i, repositories r
WHERE r.repo_id = i.repo_id
and contract_address is not null
and comment_id is not null
order by updated;

View File

@ -72,17 +72,18 @@ AND repo = :repo;
-- :name create-repository! :<! :1
-- :doc creates repository if not exists
INSERT INTO repositories (repo_id, user_id, owner, repo, state)
INSERT INTO repositories (repo_id, user_id, owner, repo, state, owner_avatar_url)
SELECT
:repo_id,
:user_id,
:owner,
:repo,
:state
:state,
:owner_avatar_url
WHERE NOT exists(SELECT 1
FROM repositories
WHERE repo_id = :repo_id)
RETURNING repo_id, user_id, owner, repo, state;
RETURNING repo_id, user_id, owner, repo, state, owner_avatar_url;
-- :name get-enabled-repositories :? :*
-- :doc returns enabled repositories for a given user-id

View File

@ -11,7 +11,8 @@
(or
(db/create-repository! con-db (-> repo
(rename-keys {:id :repo_id
:name :repo})
:name :repo
:owner-avatar-url :owner_avatar_url})
(merge {:state 0})))
(db/get-repo {:repo (:name repo)
:owner (:owner repo)}))))

View File

@ -75,6 +75,7 @@
(map #(merge
{:owner-login (get-in % [:owner :login])}
{:owner-type (get-in % [:owner :type])}
{:owner-avatar-url (get-in % [:owner :avatar_url])}
(select-keys % repo-fields))
(repos/repos (merge (auth-params token) {:type "all"
:all-pages true})))

View File

@ -64,6 +64,7 @@
user-id :id} user
{repo-id :id
full-repo :full_name
owner-avatar-url :owner-avatar-url
repo :name} params
[owner _] (str/split full-repo #"/")
db-user (users/get-user (:id user))]

View File

@ -16,7 +16,7 @@
{:href (issue-url repo-owner repo-name issue-number)}
issue-title]]
(case item-type
"new-bounty" [:div "Opened a bounty for " issue-link]
"new-bounty" [:div "New bounty opened for issue " issue-link]
"claim-payout" [:div "Received " [:span.balance "ETH " balance]
" for " issue-link]
"open-claim" [:div "Submitted a claim for " issue-link]

View File

@ -173,7 +173,7 @@
:on-success #(dispatch [:repo-toggle-success %])
:on-error #(dispatch [:repo-toggle-error repo %])
:finally #(println "finally" %)
:params (select-keys repo [:id :owner :full_name :name])}}))
:params (select-keys repo [:id :owner :owner-avatar-url :full_name :name])}}))
(reg-event-db