Skip to content

Commit 0887395

Browse files
committed
fix failing tests
1 parent 7a6c1d9 commit 0887395

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lib/algora/bounties/bounties.ex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ defmodule Algora.Bounties do
121121
opts \\ []
122122
) do
123123
command_id = opts[:command_id]
124+
shared_with = opts[:shared_with] || []
124125

125126
Repo.transact(fn ->
126127
with {:ok, %{installation_id: installation_id, token: token}} <-
@@ -137,15 +138,15 @@ defmodule Algora.Bounties do
137138
amount: amount,
138139
ticket: ticket,
139140
visibility: opts[:visibility],
140-
shared_with: opts[:shared_with]
141+
shared_with: shared_with
141142
})
142143

143144
:set ->
144145
existing
145146
|> Bounty.changeset(%{
146147
amount: amount,
147148
visibility: opts[:visibility],
148-
shared_with: opts[:shared_with]
149+
shared_with: shared_with
149150
})
150151
|> Repo.update()
151152

@@ -154,7 +155,7 @@ defmodule Algora.Bounties do
154155
|> Bounty.changeset(%{
155156
amount: Money.add!(existing.amount, amount),
156157
visibility: opts[:visibility],
157-
shared_with: opts[:shared_with]
158+
shared_with: shared_with
158159
})
159160
|> Repo.update()
160161
end),

lib/algora/bounties/schemas/bounty.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ defmodule Algora.Bounties.Bounty do
1212
field :status, Ecto.Enum, values: [:open, :cancelled, :paid]
1313
field :number, :integer, default: 0
1414
field :autopay_disabled, :boolean, default: false
15-
field :visibility, Ecto.Enum, values: [:community, :exclusive, :public], default: :public
16-
field :shared_with, {:array, :string}, default: []
15+
field :visibility, Ecto.Enum, values: [:community, :exclusive, :public], null: false, default: :public
16+
field :shared_with, {:array, :string}, null: false, default: []
1717

1818
belongs_to :ticket, Algora.Workspace.Ticket
1919
belongs_to :owner, User

priv/repo/migrations/20250321152115_add_shared_with_to_bounties.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule Algora.Repo.Migrations.AddSharedWithToBounties do
33

44
def change do
55
alter table(:bounties) do
6-
add :shared_with, {:array, :citext}, default: [], null: false
6+
add :shared_with, {:array, :citext}, default: "{}", null: false
77
end
88
end
99
end

0 commit comments

Comments
 (0)