Skip to content

Commit 42b3141

Browse files
committed
add bounty and tip activities
1 parent 41e1c02 commit 42b3141

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/algora/activities/schemas/activity.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ defmodule Algora.Activities.Activity do
1414
transaction_failed
1515
transaction_processed
1616
identity_created
17+
bounty_awarded
18+
bounty_posted
19+
bounty_repriced
20+
claim_submitted
21+
claim_approved
22+
tip_awarded
1723
}a
1824

1925
typed_schema "activities" do

lib/algora/bounties/bounties.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ defmodule Algora.Bounties do
4949
creator_id: creator.id
5050
})
5151

52-
case Repo.insert(changeset) do
52+
changeset
53+
|> Repo.insert_with_activity(%{type: :bounty_posted})
54+
|> case do
5355
{:ok, bounty} ->
5456
{:ok, bounty}
5557

@@ -182,7 +184,7 @@ defmodule Algora.Bounties do
182184
]
183185

184186
Repo.transact(fn ->
185-
with {:ok, tip} <- Repo.insert(changeset),
187+
with {:ok, tip} <- Repo.insert_with_activity(changeset, %{type: :tip_awarded}),
186188
{:ok, _charge} <-
187189
initialize_charge(%{
188190
id: charge_id,

0 commit comments

Comments
 (0)