Skip to content

Commit d738d2e

Browse files
committed
Remove
1 parent bd0870b commit d738d2e

8 files changed

Lines changed: 18 additions & 254 deletions

File tree

config/config.exs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ config :ua_inspector,
1919
config :ref_inspector,
2020
database_path: "priv/ref_inspector"
2121

22-
config :plausible,
23-
paddle_api: Plausible.Billing.PaddleApi,
24-
google_api: Plausible.Google.Api
25-
2622
config :plausible,
2723
# 30 minutes
2824
session_timeout: 1000 * 60 * 30,

config/test.exs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ config :plausible, Plausible.ClickhouseRepo,
1212
loggers: [Ecto.LogEntry],
1313
pool_size: 5
1414

15-
config :plausible,
16-
paddle_api: Plausible.PaddleApi.Mock,
17-
google_api: Plausible.Google.Api.Mock
18-
19-
config :bamboo, :refute_timeout, 10
2015

2116
config :geolix,
2217
databases: [

lib/mix/tasks/clean_clickhouse.ex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
defmodule Mix.Tasks.CleanClickhouse do
2+
use Mix.Task
3+
4+
def run(_) do
5+
clean_events = "ALTER TABLE events DELETE WHERE 1"
6+
clean_sessions = "ALTER TABLE sessions DELETE WHERE 1"
7+
Ecto.Adapters.SQL.query!(Plausible.ClickhouseRepo, clean_events)
8+
Ecto.Adapters.SQL.query!(Plausible.ClickhouseRepo, clean_sessions)
9+
end
10+
end

lib/plausible/event/write_buffer.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
defmodule Plausible.Event.WriteBuffer do
22
use GenServer
33
require Logger
4+
# telemetry will be brought back once we integrate the plausible codebase
45
# use OpenTelemetryDecorator
56

67
def start_link(_opts) do

lib/plausible/session/write_buffer.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
defmodule Plausible.Session.WriteBuffer do
22
use GenServer
33
require Logger
4+
# telemetry will be brought back once we integrate the plausible codebase
45
# use OpenTelemetryDecorator
56

67
def start_link(_opts) do
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
defmodule PlausibleWeb.AuthPlug do
22
import Plug.Conn
3+
import Ecto.Query
4+
5+
alias Plausible.Repo
36

47
def init(options) do
58
options
69
end
710

811
def call(conn, _opts) do
9-
assign(conn, :current_user, %Plausible.Auth.User{
10-
updated_at: ~N[2022-08-26 13:37:51],
11-
inserted_at: ~N[2022-08-26 13:37:51],
12-
email_verified: true,
13-
theme: "system",
14-
trial_expiry_date: ~D[2122-08-26],
15-
last_seen: ~N[2026-01-09 14:58:17],
16-
name: "Recruitee",
17-
email: "developer@recruitee.com"
18-
})
12+
user = Plausible.Auth.User |> limit(1) |> Repo.one()
13+
14+
assign(conn, :current_user, user)
1915
end
2016
end

test/plausible_web/plugs/auth_plug_test.exs

Lines changed: 0 additions & 44 deletions
This file was deleted.

test/support/factory.ex

Lines changed: 0 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ defmodule Plausible.Factory do
1515
merge_attributes(user, attrs)
1616
end
1717

18-
def spike_notification_factory do
19-
%Plausible.Site.SpikeNotification{
20-
threshold: 10
21-
}
22-
end
23-
2418
def site_factory do
2519
domain = sequence(:domain, &"example-#{&1}.com")
2620

@@ -104,191 +98,6 @@ defmodule Plausible.Factory do
10498
}
10599
end
106100

107-
def goal_factory do
108-
%Plausible.Goal{}
109-
end
110-
111-
def subscription_factory do
112-
%Plausible.Billing.Subscription{
113-
paddle_subscription_id: sequence(:paddle_subscription_id, &"subscription-#{&1}"),
114-
paddle_plan_id: sequence(:paddle_plan_id, &"plan-#{&1}"),
115-
cancel_url: "cancel.com",
116-
update_url: "cancel.com",
117-
status: "active",
118-
next_bill_amount: "6.00",
119-
next_bill_date: Timex.today(),
120-
last_bill_date: Timex.today(),
121-
currency_code: "USD"
122-
}
123-
end
124-
125-
def enterprise_plan_factory do
126-
%Plausible.Billing.EnterprisePlan{
127-
paddle_plan_id: sequence(:paddle_plan_id, &"plan-#{&1}"),
128-
billing_interval: :monthly,
129-
monthly_pageview_limit: 1_000_000,
130-
hourly_api_request_limit: 3000,
131-
site_limit: 100
132-
}
133-
end
134-
135-
def google_auth_factory do
136-
%Plausible.Site.GoogleAuth{
137-
email: sequence(:google_auth_email, &"email-#{&1}@email.com"),
138-
refresh_token: "123",
139-
access_token: "123",
140-
expires: Timex.now() |> Timex.shift(days: 1)
141-
}
142-
end
143-
144-
def custom_domain_factory do
145-
%Plausible.Site.CustomDomain{
146-
domain: sequence(:custom_domain, &"domain-#{&1}.com")
147-
}
148-
end
149-
150-
def weekly_report_factory do
151-
%Plausible.Site.WeeklyReport{}
152-
end
153-
154-
def monthly_report_factory do
155-
%Plausible.Site.MonthlyReport{}
156-
end
157-
158-
def shared_link_factory do
159-
%Plausible.Site.SharedLink{
160-
name: "Link name",
161-
slug: Nanoid.generate()
162-
}
163-
end
164-
165-
def invitation_factory do
166-
%Plausible.Auth.Invitation{
167-
invitation_id: Nanoid.generate(),
168-
email: sequence(:email, &"email-#{&1}@example.com"),
169-
role: :admin
170-
}
171-
end
172-
173-
def api_key_factory do
174-
key = :crypto.strong_rand_bytes(64) |> Base.url_encode64() |> binary_part(0, 64)
175-
176-
%Plausible.Auth.ApiKey{
177-
name: "api-key-name",
178-
key: key,
179-
key_hash: Plausible.Auth.ApiKey.do_hash(key),
180-
key_prefix: binary_part(key, 0, 6)
181-
}
182-
end
183-
184-
def imported_visitors_factory do
185-
%{
186-
table: "imported_visitors",
187-
date: Timex.today(),
188-
visitors: 1,
189-
pageviews: 1,
190-
bounces: 0,
191-
visits: 1,
192-
visit_duration: 10
193-
}
194-
end
195-
196-
def imported_sources_factory do
197-
%{
198-
table: "imported_sources",
199-
date: Timex.today(),
200-
source: "",
201-
visitors: 1,
202-
visits: 1,
203-
bounces: 0,
204-
visit_duration: 10
205-
}
206-
end
207-
208-
def imported_pages_factory do
209-
%{
210-
table: "imported_pages",
211-
date: Timex.today(),
212-
page: "",
213-
visitors: 1,
214-
pageviews: 1,
215-
exits: 0,
216-
time_on_page: 10
217-
}
218-
end
219-
220-
def imported_entry_pages_factory do
221-
%{
222-
table: "imported_entry_pages",
223-
date: Timex.today(),
224-
entry_page: "",
225-
visitors: 1,
226-
entrances: 1,
227-
bounces: 0,
228-
visit_duration: 10
229-
}
230-
end
231-
232-
def imported_exit_pages_factory do
233-
%{
234-
table: "imported_exit_pages",
235-
date: Timex.today(),
236-
exit_page: "",
237-
visitors: 1,
238-
exits: 1
239-
}
240-
end
241-
242-
def imported_locations_factory do
243-
%{
244-
table: "imported_locations",
245-
date: Timex.today(),
246-
country: "",
247-
region: "",
248-
city: 0,
249-
visitors: 1,
250-
visits: 1,
251-
bounces: 0,
252-
visit_duration: 10
253-
}
254-
end
255-
256-
def imported_devices_factory do
257-
%{
258-
table: "imported_devices",
259-
date: Timex.today(),
260-
device: "",
261-
visitors: 1,
262-
visits: 1,
263-
bounces: 0,
264-
visit_duration: 10
265-
}
266-
end
267-
268-
def imported_browsers_factory do
269-
%{
270-
table: "imported_browsers",
271-
date: Timex.today(),
272-
browser: "",
273-
visitors: 1,
274-
visits: 1,
275-
bounces: 0,
276-
visit_duration: 10
277-
}
278-
end
279-
280-
def imported_operating_systems_factory do
281-
%{
282-
table: "imported_operating_systems",
283-
date: Timex.today(),
284-
operating_system: "",
285-
visitors: 1,
286-
visits: 1,
287-
bounces: 0,
288-
visit_duration: 10
289-
}
290-
end
291-
292101
defp hash_key() do
293102
Keyword.fetch!(
294103
Application.get_env(:plausible, PlausibleWeb.Endpoint),

0 commit comments

Comments
 (0)