Skip to content

A platform for community discussion. Free, open, simple.

DEV: Complete several legacy upcoming changes (#39742)

Martin Brennan4c44eec9d5f6
diff --git a/app/controllers/admin/impersonate_controller.rb b/app/controllers/admin/impersonate_controller.rb
index 8053c003e6d..5c386eec688 100644
--- a/app/controllers/admin/impersonate_controller.rb
+++ b/app/controllers/admin/impersonate_controller.rb
@@ -13,22 +13,14 @@ class Admin::ImpersonateController < Admin::AdminController
StaffActionLogger.new(current_user).log_impersonate(user)
- if UpcomingChanges.enabled_for_user?(:impersonate_without_logout, current_user)
- raise Discourse::InvalidAccess if current_user.is_impersonating
+ raise Discourse::InvalidAccess if current_user.is_impersonating
- start_impersonating_user(user)
- else
- log_on_user(user, impersonate: true)
- end
+ start_impersonating_user(user)
render body: nil
end
def destroy
- unless UpcomingChanges.enabled_for_user?(:impersonate_without_logout, impersonation_acting_user)
- raise Discourse::NotFound
- end
-
raise Discourse::InvalidAccess unless current_user.is_impersonating
impersonated_user = current_user
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 84657230e8f..c5d9fbbd28e 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -533,6 +533,10 @@ module ApplicationHelper
SiteSetting.splash_screen
end
+ def custom_splash_screen_enabled?
+ @custom_splash_screen_enabled ||= SiteSetting.splash_screen_image.is_a?(Upload)
+ end
+
def splash_screen_image_animated?
build_splash_screen_image unless defined?(@splash_screen_image_svg)
@splash_screen_image_svg.present? && @splash_screen_image_svg.match?(/@keyframes\s/)
diff --git a/app/views/common/_discourse_splash.html.erb b/app/views/common/_discourse_splash.html.erb
index 13873b419db..e716bc9e9ca 100644
--- a/app/views/common/_discourse_splash.html.erb
+++ b/app/views/common/_discourse_splash.html.erb
@@ -1,7 +1,7 @@
<section id="d-splash">
<style>
html {
- <%- if SiteSetting.splash_screen_image.is_a?(Upload) %>
+ <%- if custom_splash_screen_enabled? %>
overflow: hidden !important;
<%- else %>
overflow-y: hidden !important;
@@ -16,7 +16,7 @@
#d-splash {
--dot-color: #<%= light_color_hex_for_name("tertiary") %>;
- <%- if SiteSetting.splash_screen_image.is_a?(Upload) %>
+ <%- if custom_splash_screen_enabled? %>
<%- if splash_screen_image_animated? %>
--primary: #<%= light_color_hex_for_name("primary") %>;
--secondary: #<%= light_color_hex_for_name("secondary") %>;
@@ -33,7 +33,7 @@
#d-splash {
--dot-color: #<%= light_color_hex_for_name("tertiary") %>;
- <%- if SiteSetting.splash_screen_image.is_a?(Upload) %>
+ <%- if custom_splash_screen_enabled? %>
<%- if splash_screen_image_animated? %>
--primary: #<%= light_color_hex_for_name("primary") %>;
--secondary: #<%= light_color_hex_for_name("secondary") %>;
@@ -50,7 +50,7 @@
#d-splash {
--dot-color: #<%= dark_color_hex_for_name("tertiary") %>;
- <%- if SiteSetting.splash_screen_image.is_a?(Upload) %>
+ <%- if custom_splash_screen_enabled? %>
<%- if splash_screen_image_animated? %>
--primary: #<%= dark_color_hex_for_name("primary") %>;
--secondary: #<%= dark_color_hex_for_name("secondary") %>;
@@ -71,7 +71,7 @@
#d-splash {
--dot-color: #<%= light_color_hex_for_name("tertiary") %>;
- <%- if SiteSetting.splash_screen_image.is_a?(Upload) %>
+ <%- if custom_splash_screen_enabled? %>
<%- if splash_screen_image_animated? %>
--primary: #<%= light_color_hex_for_name("primary") %>;
--secondary: #<%= light_color_hex_for_name("secondary") %>;
@@ -91,7 +91,7 @@
#d-splash {
--dot-color: #<%= dark_color_hex_for_name("tertiary") %>;
- <%- if SiteSetting.splash_screen_image.is_a?(Upload) %>
+ <%- if custom_splash_screen_enabled? %>
<%- if splash_screen_image_animated? %>
--primary: #<%= dark_color_hex_for_name("primary") %>;
--secondary: #<%= dark_color_hex_for_name("secondary") %>;
@@ -118,7 +118,7 @@
#d-splash .preloader-image {
--splash-dot-size: max(1vw, 25px);
--splash-dot-spacing: calc(var(--splash-dot-size) * 1.5);
- <%- if SiteSetting.splash_screen_image.is_a?(Upload) %>
+ <%- if custom_splash_screen_enabled? %>
width: 700px;
@media (width < 700px) {
width: 320px;
@@ -154,7 +154,7 @@
}
}
- <%- if SiteSetting.splash_screen_image.is_a?(Upload) %>
+ <%- if custom_splash_screen_enabled? %>
#d-splash .dots-container {
position: relative;
width: calc((var(--splash-dot-size) + var(--splash-dot-spacing)) * 5);
@@ -170,7 +170,7 @@
animation-delay: calc(var(--n) * 0.15s);
position: absolute;
- <%- if SiteSetting.splash_screen_image.is_a?(Upload) %>
+ <%- if custom_splash_screen_enabled? %>
top: 0;
<%- else %>
top: calc(50% - var(--splash-dot-size) / 2);
@@ -206,7 +206,7 @@
}
}
- <%- if SiteSetting.splash_screen_image.is_a?(Upload) %>
+ <%- if custom_splash_screen_enabled? %>
#d-splash .preloader-image {
--splash-dot-size: max(0.7vw, 14px);
}
@@ -246,7 +246,7 @@
</style>
<div class="preloader-image" elementtiming="discourse-splash-visible">
- <%- if SiteSetting.splash_screen_image.is_a?(Upload) %>
+ <%- if custom_splash_screen_enabled? %>
<%- if splash_screen_image_animated? %>
<div class="splash-logo-container"><%= splash_screen_inline_svg %></div>
<%- else %>
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index e93987d1eea..73fdb8f0a4f 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2772,7 +2772,6 @@ en:
enable_auto_grid_images: "Automatically wraps images in [grid] tags when 3 or more images are uploaded in the composer."
enable_new_checkbox_style: "Enable the redesigned checkbox style for FormKit checkboxes."
enable_new_post_reactions_menu: "Enable the redesigned post likes and reactions menu, with infinite scroll and a native mobile experience."
- impersonate_without_logout: "Allow admins to impersonate a user without having to log out of their admin account."
experimental_impersonation_time_limit_minutes: "How long before an impersonation session is automatically ended."
page_loading_indicator: "Configure the loading indicator which appears during page navigations within Discourse. 'Spinner' is a full page indicator. 'Slider' shows a narrow bar at the top of the screen."
show_user_menu_avatars: "Show user avatars in the user menu"
diff --git a/config/site_settings.yml b/config/site_settings.yml
index 91591e4c9c2..28cc0439f8a 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -4315,14 +4315,9 @@ experimental:
learn_more_url: "https://meta.discourse.org/t/-/395768"
disallow_enabled_for_groups: true
enable_auto_grid_images:
- default: false
+ default: true
client: true
- hidden: true
area: "experimental"
- upcoming_change:
- status: "stable"
- impact: "feature,all_members"
- learn_more_url: "https://meta.discourse.org/t/-/394784"
enable_new_checkbox_style:
default: false
client: true
@@ -4349,20 +4344,7 @@ experimental:
learn_more_url: "https://meta.discourse.org/t/-/395099"
enable_form_templates:
client: true
- default: false
- hidden: true
- upcoming_change:
- status: "stable"
- impact: "feature,all_members"
- learn_more_url: "https://meta.discourse.org/t/-/278631"
- impersonate_without_logout:
- default: false
- client: true
- hidden: true
- upcoming_change:
- status: "stable"
- impact: "feature,staff"
- learn_more_url: "https://meta.discourse.org/t/-/119683"
+ default: true
experimental_impersonation_time_limit_minutes:
default: 15
hidden: true
diff --git a/spec/requests/admin/impersonate_controller_spec.rb b/spec/requests/admin/impersonate_controller_spec.rb
index fbeecb752a1..e3c94758893 100644
--- a/spec/requests/admin/impersonate_controller_spec.rb
+++ b/spec/requests/admin/impersonate_controller_spec.rb
@@ -121,10 +121,7 @@ RSpec.describe Admin::ImpersonateController do
describe "#destroy" do
before { sign_in(admin) }
- it "checks if experimental impersonation is allowed for the acting user" do
- SiteSettingGroup.create!(name: "impersonate_without_logout", group_ids: "1|2")
- SiteSetting.refresh!
-
+ it "succeeds and logs the impersonation" do
post "/admin/impersonate.json", params: { username_or_email: user.username }
delete "/admin/impersonate.json"
diff --git a/spec/system/impersonation_spec.rb b/spec/system/impersonation_spec.rb
index 5ff95f36871..950047f7cba 100644
--- a/spec/system/impersonation_spec.rb
+++ b/spec/system/impersonation_spec.rb
@@ -6,11 +6,7 @@ describe "Impersonation" do
let(:dialog) { PageObjects::Components::Dialog.new }
- before do
- SiteSetting.impersonate_without_logout = true
-
- sign_in(admin)
- end
+ before { sign_in(admin) }
it "allows you to start and stop impersonating with the click of a button" do
visit("/admin/users/#{user.id}/#{user.username}")