Skip to content

Commit d8435f2

Browse files
authored
Remove imports_exports and csv_imports_exports feature flags (#4089)
1 parent b1c1361 commit d8435f2

File tree

8 files changed

+27
-61
lines changed

8 files changed

+27
-61
lines changed

lib/plausible/imported.ex

+3-7
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,9 @@ defmodule Plausible.Imported do
4343
@spec tables() :: [String.t()]
4444
def tables, do: @table_names
4545

46-
@spec max_complete_imports(Site.t()) :: non_neg_integer()
47-
def max_complete_imports(site) do
48-
if FunWithFlags.enabled?(:imports_exports, for: site) do
49-
@max_complete_imports
50-
else
51-
1
52-
end
46+
@spec max_complete_imports() :: non_neg_integer()
47+
def max_complete_imports() do
48+
@max_complete_imports
5349
end
5450

5551
@spec load_import_data(Site.t()) :: Site.t()

lib/plausible_web/controllers/google_analytics_controller.ex

+1-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ defmodule PlausibleWeb.GoogleAnalyticsController do
4646

4747
redirect_route = Routes.site_path(conn, :settings_imports_exports, site.domain)
4848

49-
result =
50-
if FunWithFlags.enabled?(:imports_exports, for: site) do
51-
Google.API.list_properties_and_views(access_token)
52-
else
53-
Google.UA.API.list_views(access_token)
54-
end
49+
result = Google.API.list_properties_and_views(access_token)
5550

5651
error =
5752
case params["error"] do

lib/plausible_web/live/imports_exports_settings.ex

+2-9
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,10 @@ defmodule PlausibleWeb.Live.ImportsExportsSettings do
3737
|> assign_new(:current_user, fn ->
3838
Plausible.Repo.get(Plausible.Auth.User, user_id)
3939
end)
40-
|> assign_new(:max_imports, fn %{site: site} ->
41-
Imported.max_complete_imports(site)
42-
end)
4340

4441
:ok = Imported.listen()
4542

46-
{:ok, socket}
43+
{:ok, assign(socket, max_imports: Imported.max_complete_imports())}
4744
end
4845

4946
def render(assigns) do
@@ -55,8 +52,6 @@ defmodule PlausibleWeb.Live.ImportsExportsSettings do
5552

5653
at_maximum? = length(assigns.site_imports) >= assigns.max_imports
5754

58-
csv_imports_exports_enabled? = FunWithFlags.enabled?(:csv_imports_exports, for: assigns.site)
59-
6055
import_warning =
6156
cond do
6257
import_in_progress? ->
@@ -74,8 +69,7 @@ defmodule PlausibleWeb.Live.ImportsExportsSettings do
7469
assign(assigns,
7570
import_in_progress?: import_in_progress?,
7671
at_maximum?: at_maximum?,
77-
import_warning: import_warning,
78-
csv_imports_exports_enabled?: csv_imports_exports_enabled?
72+
import_warning: import_warning
7973
)
8074

8175
~H"""
@@ -90,7 +84,6 @@ defmodule PlausibleWeb.Live.ImportsExportsSettings do
9084
</.button_link>
9185
9286
<.button_link
93-
:if={@csv_imports_exports_enabled?}
9487
class="w-36 h-20"
9588
theme="bright"
9689
disabled={@import_in_progress? or @at_maximum?}

lib/plausible_web/templates/site/settings_imports_exports.html.heex

+18-24
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
</h2>
66
<p class="mt-1 text-sm leading-5 text-gray-500 dark:text-gray-200">
77
Import existing data from external sources.
8-
<%= if FunWithFlags.enabled?(:csv_imports_exports, for: @site) do %>
9-
Pick one of the options below to start a new import.
10-
<% else %>
11-
Click below to start a new import.
12-
<% end %>
8+
Pick one of the options below to start a new import.
139
</p>
1410

1511
<PlausibleWeb.Components.Generic.docs_info slug="google-analytics-import" />
@@ -20,23 +16,21 @@
2016
) %>
2117
</div>
2218

23-
<%= if FunWithFlags.enabled?(:csv_imports_exports, for: @site) or Plausible.Auth.is_super_admin?(@current_user) do %>
24-
<div class="shadow bg-white dark:bg-gray-800 dark:text-gray-200 sm:rounded-md sm:overflow-hidden py-6 px-4 sm:p-6">
25-
<header class="relative border-b border-gray-200 pb-4 mb-5">
26-
<h2 class="text-lg leading-6 font-medium text-gray-900 dark:text-gray-100">
27-
Export Data
28-
</h2>
29-
<p class="mt-1 text-sm leading-5 text-gray-500 dark:text-gray-200">
30-
Export all your data into CSV format.
31-
</p>
32-
</header>
19+
<div class="shadow bg-white dark:bg-gray-800 dark:text-gray-200 sm:rounded-md sm:overflow-hidden py-6 px-4 sm:p-6">
20+
<header class="relative border-b border-gray-200 pb-4 mb-5">
21+
<h2 class="text-lg leading-6 font-medium text-gray-900 dark:text-gray-100">
22+
Export Data
23+
</h2>
24+
<p class="mt-1 text-sm leading-5 text-gray-500 dark:text-gray-200">
25+
Export all your data into CSV format.
26+
</p>
27+
</header>
3328

34-
<%= live_render(@conn, PlausibleWeb.Live.CSVExport,
35-
session: %{
36-
"site_id" => @site.id,
37-
"email_to" => @current_user.email,
38-
"storage" => on_ee(do: "s3", else: "local")
39-
}
40-
) %>
41-
</div>
42-
<% end %>
29+
<%= live_render(@conn, PlausibleWeb.Live.CSVExport,
30+
session: %{
31+
"site_id" => @site.id,
32+
"email_to" => @current_user.email,
33+
"storage" => on_ee(do: "s3", else: "local")
34+
}
35+
) %>
36+
</div>

lib/plausible_web/views/layout_view.ex

+1-8
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ defmodule PlausibleWeb.LayoutView do
4949
end
5050

5151
def settings_tabs(conn) do
52-
imports_exports_key =
53-
if FunWithFlags.enabled?(:csv_imports_exports, for: conn.assigns.site) do
54-
"Imports & Exports"
55-
else
56-
"Imports"
57-
end
58-
5952
[
6053
%{key: "General", value: "general", icon: :rocket_launch},
6154
%{key: "People", value: "people", icon: :users},
@@ -66,7 +59,7 @@ defmodule PlausibleWeb.LayoutView do
6659
end,
6760
%{key: "Custom Properties", value: "properties", icon: :document_text},
6861
%{key: "Integrations", value: "integrations", icon: :arrow_path_rounded_square},
69-
%{key: imports_exports_key, value: "imports-exports", icon: :arrows_up_down},
62+
%{key: "Imports & Exports", value: "imports-exports", icon: :arrows_up_down},
7063
%{
7164
key: "Shields",
7265
icon: :shield_exclamation,

priv/repo/seeds.exs

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
# We recommend using the bang functions (`insert!`, `update!`
1111
# and so on) as they will fail if something goes wrong.
1212

13-
FunWithFlags.enable(:imports_exports)
14-
FunWithFlags.enable(:csv_imports_exports)
15-
1613
user = Plausible.Factory.insert(:user, email: "[email protected]", password: "plausible")
1714

1815
native_stats_range =

test/plausible_web/controllers/site_controller_test.exs

+2-2
Original file line numberDiff line numberDiff line change
@@ -679,15 +679,15 @@ defmodule PlausibleWeb.SiteControllerTest do
679679
end
680680

681681
test "disables import buttons when imports are at maximum", %{conn: conn, site: site} do
682-
insert_list(Plausible.Imported.max_complete_imports(site), :site_import,
682+
insert_list(Plausible.Imported.max_complete_imports(), :site_import,
683683
site: site,
684684
status: SiteImport.completed()
685685
)
686686

687687
conn = get(conn, "/#{site.domain}/settings/imports-exports")
688688

689689
assert html_response(conn, 200) =~
690-
"Maximum of #{Plausible.Imported.max_complete_imports(site)} imports is reached."
690+
"Maximum of #{Plausible.Imported.max_complete_imports()} imports is reached."
691691
end
692692

693693
test "considers older legacy imports when showing pageview count", %{conn: conn, site: site} do

test/test_helper.exs

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ end
55
{:ok, _} = Application.ensure_all_started(:ex_machina)
66
Mox.defmock(Plausible.HTTPClient.Mock, for: Plausible.HTTPClient.Interface)
77
Application.ensure_all_started(:double)
8-
FunWithFlags.enable(:imports_exports)
9-
FunWithFlags.enable(:csv_imports_exports)
108

119
# Temporary flag to test `experimental_reduced_joins` flag on all tests.
1210
if System.get_env("TEST_EXPERIMENTAL_REDUCED_JOINS") == "1" do

0 commit comments

Comments
 (0)