From 66c65e0071ff138c56c786fa59cb86e265e49274 Mon Sep 17 00:00:00 2001 From: Marko Saric <34340819+metmarkosaric@users.noreply.github.com> Date: Mon, 30 Jan 2023 09:43:53 +0100 Subject: [PATCH] Changes to the site settings danger zone (#2629) * Changes to the site settings danger zone The idea was to: 1. Show a transfer site ownership message to owners of the site only. This will make ownership transfer feature more discoverable. Will also help people to transfer ownership of a site rather than deleting the whole thing when that makes more sense 2. Add a note that site deletion is a delayed operation 3. Make some other tiny copy changes What did I break? :) * Fix markup so the long text wraps sooner * Fix indent --------- Co-authored-by: Adam Rutkowski --- .../site/settings_danger_zone.html.eex | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/plausible_web/templates/site/settings_danger_zone.html.eex b/lib/plausible_web/templates/site/settings_danger_zone.html.eex index a9f2343b5..bf9029513 100644 --- a/lib/plausible_web/templates/site/settings_danger_zone.html.eex +++ b/lib/plausible_web/templates/site/settings_danger_zone.html.eex @@ -4,13 +4,28 @@

Danger zone

Destructive actions below can result in irrecoverable data loss. Be careful.

+ <%= if @conn.assigns[:current_user_role] == :owner do %> +
  • +
    +

    + Transfer site ownership +

    +

    + Transfer ownership of the site to a different account +

    +
    + <%= link("Transfer #{@site.domain} ownership", to: Routes.membership_path(@conn, :transfer_ownership_form, @site.domain), class: "inline-block mt-4 px-4 py-2 border border-gray-300 dark:border-gray-500 text-sm leading-5 font-medium rounded-md text-red-700 bg-white dark:bg-gray-800 hover:text-red-500 dark:hover:text-red-400 focus:outline-none focus:border-blue-300 focus:ring active:text-red-800 active:bg-gray-50 transition ease-in-out duration-150") %> +
  • +
    + <% end %> +
  • Reset stats

    - Removes all pageviews but keeps the site configuration + Reset all stats but keep the site configuration intact

    <%= link("Reset #{@site.domain} stats", to: "/#{URI.encode_www_form(@site.domain)}/stats", method: :delete, class: "inline-block mt-4 px-4 py-2 border border-gray-300 dark:border-gray-500 text-sm leading-5 font-medium rounded-md text-red-700 bg-white dark:bg-gray-800 hover:text-red-500 dark:hover:text-red-400 focus:outline-none focus:border-blue-300 focus:ring active:text-red-800 active:bg-gray-50 transition ease-in-out duration-150", data: [confirm: "Resetting the stats cannot be reversed. Are you sure?"]) %> @@ -18,12 +33,12 @@
  • -
    +

    Delete site

    - Removes all stats along with the site configuration + Permanently remove all stats and the site configuration too. This process takes a few hours so you won't be able to immediately register the same site again

    <%= link "Delete #{@site.domain}", to: "/#{URI.encode_www_form(@site.domain)}", method: :delete, class: "inline-block px-4 py-2 border border-transparent font-medium rounded-md text-red-700 dark:text-red-800 bg-red-100 dark:bg-red-200 hover:bg-red-50 dark:hover:bg-red-300 focus:outline-none focus:border-red-300 focus:ring active:bg-red-200 transition ease-in-out duration-150 sm:text-sm sm:leading-5", data: [confirm: "Deleting the site data cannot be reversed. Are you sure?"] %>