Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove channels feature flag #4972

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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: 1 addition & 3 deletions assets/js/dashboard/stats/sources/source-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
if (currentTab == 'all' && isRemovingFilter('channel')) {
setTab('channels')()
}
}, [query, currentTab])

Check warning on line 183 in assets/js/dashboard/stats/sources/source-list.js

View workflow job for this annotation

GitHub Actions / Build and test

React Hook useEffect has missing dependencies: 'previousQuery' and 'setTab'. Either include them or remove the dependency array

function setTab(tab) {
return () => {
Expand All @@ -197,9 +197,7 @@

return (
<div className="flex text-xs font-medium text-gray-500 dark:text-gray-400 space-x-2">
{site.flags.channels &&
<div className={currentTab === 'channels' ? activeClass : defaultClass} onClick={setTab('channels')}>Channels</div>
}
<div className={currentTab === 'channels' ? activeClass : defaultClass} onClick={setTab('channels')}>Channels</div>
<div className={currentTab === 'all' ? activeClass : defaultClass} onClick={setTab('all')}>Sources</div>

<Menu as="div" className="relative inline-block text-left">
Expand Down
12 changes: 2 additions & 10 deletions lib/plausible_web/controllers/stats_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ defmodule PlausibleWeb.StatsController do
csvs = %{
~c"visitors.csv" => fn -> main_graph_csv(site, query, conn.assigns[:current_user]) end,
~c"sources.csv" => fn -> Api.StatsController.sources(conn, params) end,
~c"channels.csv" => fn -> Api.StatsController.channels(conn, params) end,
~c"utm_mediums.csv" => fn -> Api.StatsController.utm_mediums(conn, params) end,
~c"utm_sources.csv" => fn -> Api.StatsController.utm_sources(conn, params) end,
~c"utm_campaigns.csv" => fn -> Api.StatsController.utm_campaigns(conn, params) end,
Expand All @@ -144,15 +145,6 @@ defmodule PlausibleWeb.StatsController do
~c"custom_props.csv" => fn -> Api.StatsController.all_custom_prop_values(conn, params) end
}

# credo:disable-for-lines:7
csvs =
if FunWithFlags.enabled?(:channels, for: site) ||
FunWithFlags.enabled?(:channels, for: conn.assigns[:current_user]) do
Map.put(csvs, ~c"channels.csv", fn -> Api.StatsController.channels(conn, params) end)
else
csvs
end

csv_values =
Map.values(csvs)
|> Plausible.ClickhouseRepo.parallel_tasks()
Expand Down Expand Up @@ -382,7 +374,7 @@ defmodule PlausibleWeb.StatsController do

defp get_flags(user, site),
do:
[:channels, :saved_segments, :scroll_depth]
[:saved_segments, :scroll_depth]
|> Enum.map(fn flag ->
{flag, FunWithFlags.enabled?(flag, for: user) || FunWithFlags.enabled?(flag, for: site)}
end)
Expand Down
Loading