Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
58ef2c5
activities (with has_many on_replace: :ignore)
lastcanal Jan 11, 2025
2091676
add more tables, test helpers
lastcanal Jan 12, 2025
593d30a
add more user activity attributes
lastcanal Jan 12, 2025
e4ce765
add Repo.insert_with_activity/2
lastcanal Jan 12, 2025
fcdc16a
add notifier
lastcanal Jan 12, 2025
11e786a
rename
lastcanal Jan 12, 2025
678d606
Repo.update/delete_with_activity
lastcanal Jan 12, 2025
2f4fc2f
test register github user activities
lastcanal Jan 12, 2025
bed8260
add coveralls
lastcanal Jan 12, 2025
c1a902a
add basic coverage for bounties, chat and reviews and coveralls.json
lastcanal Jan 13, 2025
b545cec
remove redundant
lastcanal Jan 13, 2025
e361e9e
remove ecto fork
lastcanal Jan 13, 2025
a640b20
Setup notifier and signal module
lastcanal Jan 8, 2025
2dafbd7
account coverage
lastcanal Jan 13, 2025
17ddfe2
update coveralls
lastcanal Jan 13, 2025
55b9a66
rename
lastcanal Jan 13, 2025
7f136b7
fetch user activities from nested children
lastcanal Jan 13, 2025
af43ec0
add notifier job template
lastcanal Jan 13, 2025
3295e78
satisfy the dialyzer
lastcanal Jan 13, 2025
5963692
filter out bounties without solver when onboarding dev, fix KeyError
lastcanal Jan 6, 2025
b15808b
lower Drawer z-index; it was hiding flash messages
lastcanal Jan 8, 2025
4f2df85
load association for activities
lastcanal Jan 16, 2025
2c71b39
use Dataloader for loading activity associations
lastcanal Jan 17, 2025
319183d
add Mox to dev
lastcanal Jan 17, 2025
8886615
add create_session to Stripe SeedImpl
lastcanal Jan 17, 2025
f8926ca
format
lastcanal Jan 17, 2025
da360b6
use map for activity table lookups
lastcanal Jan 18, 2025
41e1c02
add owned|created_tips to User
lastcanal Jan 18, 2025
42b3141
add bounty and tip activities
lastcanal Jan 18, 2025
a40c3a0
test
lastcanal Jan 18, 2025
27b448b
add activities dropdown in main nav and on company admin page
lastcanal Jan 18, 2025
d8205ae
implement Algora.Analytics.get_company_analytics/0-2
lastcanal Jan 7, 2025
6fa0067
remove transaction activities
lastcanal Jan 18, 2025
1f47e97
zero not implemented demo data
lastcanal Jan 18, 2025
19112b1
add activity redirect controller
lastcanal Jan 18, 2025
222d7a7
add User#received_tips
lastcanal Jan 18, 2025
1a50f73
cleanup
lastcanal Jan 18, 2025
ee763e3
typo
lastcanal Jan 18, 2025
256a115
load target association with Activities.get
lastcanal Jan 19, 2025
caed346
show activities in header
lastcanal Jan 20, 2025
e3fd023
Merge branch 'main' into activity-notifications
lastcanal Jan 20, 2025
7ac9651
Merge branch 'main' into activity-notifications
lastcanal Jan 20, 2025
1ae2e7a
fix merge
lastcanal Jan 21, 2025
afb88df
Protocol.UndefinedError for claims when creating tips
lastcanal Jan 21, 2025
b2025b0
adapt bounty testing to claims
lastcanal Jan 21, 2025
eac6b28
add on true to inner_lateral_join
lastcanal Jan 21, 2025
c09b2f9
add redirect url to email body
lastcanal Jan 21, 2025
cacbfed
remove vars from email subjects
lastcanal Jan 21, 2025
fed0f58
use schema.preload/1
lastcanal Jan 21, 2025
9e2601a
add claim_submitted and bounty_awarded activities
lastcanal Jan 21, 2025
643a601
add utility for making admins
lastcanal Jan 21, 2025
9c97221
remove unused alias
lastcanal Jan 21, 2025
da7145e
add mix algora.create_tip
lastcanal Jan 21, 2025
5eb7d4d
send email job
lastcanal Jan 21, 2025
f408123
rework activity views
lastcanal Jan 21, 2025
39a7834
assert mail job enqueued
lastcanal Jan 21, 2025
e155940
add todos
lastcanal Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ config :algora, Oban,
github_og_image: 5,
notify_bounty: 1,
notify_tip_intent: 1,
notify_claim: 1
notify_claim: 1,
activity_notifier: 1,
activity_mailer: 1
]

# Configures the mailer
Expand Down
4 changes: 4 additions & 0 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ config :algora,
cloudflare_tunnel: System.get_env("CLOUDFLARE_TUNNEL"),
swift_mode: false,
auto_start_pollers: System.get_env("AUTO_START_POLLERS") == "true"

config :algora, :stripe,
test_customer_id: System.get_env("STRIPE_TEST_CUSTOMER_ID"),
test_account_id: System.get_env("STRIPE_TEST_ACCOUNT_ID")
29 changes: 29 additions & 0 deletions coveralls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"skip_files": [
"lib/algora/integrations",
"lib/algora/shared/*",
"lib/algora/admin/admin.ex",
"lib/algora_web/components",
"lib/algora_web",
"lib/mix/tasks",
"priv/",
"test/support"
],
"default_stop_words": [
"defmodule",
"defrecord",
"defimpl",
"def.+(.+\/\/.+).+do",
"typed_schema",
"use .+"
],

"custom_stop_words": [
],

"coverage_options": {
"treat_no_relevant_lines_as_covered": true,
"output_dir": "cover/",
"html_filter_full_covered": true
}
}
10 changes: 10 additions & 0 deletions lib/algora/accounts/accounts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,16 @@ defmodule Algora.Accounts do
Repo.one(query)
end

def get_user_by_handle(handle) do
query =
from(u in User,
where: u.handle == ^handle,
select: u
)

Repo.one(query)
end

def get_access_token(%User{} = user) do
case Repo.one(from(i in Identity, where: i.user_id == ^user.id and i.provider == "github")) do
%Identity{provider_token: token} -> {:ok, token}
Expand Down
5 changes: 5 additions & 0 deletions lib/algora/accounts/schemas/identity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ defmodule Algora.Accounts.Identity do

alias Algora.Accounts.Identity
alias Algora.Accounts.User
alias Algora.Activities.Activity

@derive {Inspect, except: [:provider_token, :provider_meta]}
typed_schema "identities" do
Expand All @@ -17,6 +18,8 @@ defmodule Algora.Accounts.Identity do

belongs_to :user, User

has_many :activities, {"identity_activities", Activity}, foreign_key: :assoc_id

timestamps()
end

Expand All @@ -40,6 +43,7 @@ defmodule Algora.Accounts.Identity do
:provider_name,
:provider_id
])
|> Activity.put_activity(%Identity{}, %{type: :identity_created})
|> generate_id()
|> validate_required([:provider_token, :provider_email, :provider_name, :provider_id])
|> validate_length(:provider_meta, max: 10_000)
Expand All @@ -66,6 +70,7 @@ defmodule Algora.Accounts.Identity do
:provider_name,
:provider_id
])
|> Activity.put_activity(%Identity{}, %{type: :identity_created})
|> generate_id()
|> validate_required([:provider_token, :provider_email, :provider_name, :provider_id])
|> validate_length(:provider_meta, max: 10_000)
Expand Down
10 changes: 10 additions & 0 deletions lib/algora/accounts/schemas/user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ defmodule Algora.Accounts.User do

alias Algora.Accounts.Identity
alias Algora.Accounts.User
alias Algora.Activities.Activity
alias Algora.Bounties.Bounty
alias Algora.Bounties.Tip
alias Algora.Contracts.Contract
alias Algora.MoneyUtils
alias Algora.Organizations.Member
Expand Down Expand Up @@ -76,6 +78,9 @@ defmodule Algora.Accounts.User do
has_many :members, Member, foreign_key: :org_id
has_many :owned_bounties, Bounty, foreign_key: :owner_id
has_many :created_bounties, Bounty, foreign_key: :creator_id
has_many :owned_tips, Tip, foreign_key: :owner_id
has_many :created_tips, Tip, foreign_key: :creator_id
has_many :received_tips, Tip, foreign_key: :recipient_id
has_many :attempts, Algora.Bounties.Attempt
has_many :claims, Algora.Bounties.Claim
has_many :projects, Algora.Projects.Project
Expand All @@ -85,6 +90,7 @@ defmodule Algora.Accounts.User do
has_many :connected_installations, Installation, foreign_key: :connected_user_id
has_many :contractor_contracts, Contract, foreign_key: :contractor_id
has_many :client_contracts, Contract, foreign_key: :client_id
has_many :activities, {"user_activities", Activity}, foreign_key: :assoc_id

has_one :customer, Algora.Payments.Customer, foreign_key: :user_id

Expand Down Expand Up @@ -295,6 +301,10 @@ defmodule Algora.Accounts.User do
|> unique_constraint([:provider, :provider_id])
end

def is_admin_changeset(user, is_admin) do
cast(user, %{is_admin: is_admin}, [:is_admin])
end

def validate_timezone(changeset) do
validate_inclusion(changeset, :timezone, Tzdata.zone_list())
end
Expand Down
Loading
Loading