about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/settings/preferences_controller.rb1
-rw-r--r--app/controllers/user_webapp_css_controller.rb20
-rw-r--r--app/lib/user_settings_decorator.rb5
-rw-r--r--app/models/user.rb1
-rw-r--r--app/views/settings/preferences/appearance/show.html.haml1
-rw-r--r--config/locales/simple_form.en-MP.yml1
6 files changed, 28 insertions, 1 deletions
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb
index c0f54b197..eb7d2ca07 100644
--- a/app/controllers/settings/preferences_controller.rb
+++ b/app/controllers/settings/preferences_controller.rb
@@ -66,6 +66,7 @@ class Settings::PreferencesController < Settings::BaseController
       :setting_style_underline_a,
       :setting_style_css_profile,
       :setting_style_css_webapp,
+      :setting_style_wide_media,
       :setting_publish_in,
       :setting_unpublish_in,
       :setting_unpublish_delete,
diff --git a/app/controllers/user_webapp_css_controller.rb b/app/controllers/user_webapp_css_controller.rb
index 8ad9fbd2e..f00b96be5 100644
--- a/app/controllers/user_webapp_css_controller.rb
+++ b/app/controllers/user_webapp_css_controller.rb
@@ -41,12 +41,30 @@ class UserWebappCssController < ApplicationController
     )
   end
 
+  def css_wide_media
+    return unless @account.user&.setting_style_wide_media
+
+    %(
+      .media-gallery
+      { height: auto !important; }
+
+      .media-gallery__item
+      { width: 100% !important; }
+
+      .spoiler-button + .media-gallery__item
+      { height: 5em !important; }
+
+      .spoiler-button--minified + .media-gallery__item
+      { height: 280px !important; }
+    )
+  end
+
   def css_webapp
     @account.user&.setting_style_css_webapp_errors.blank? ? (@account.user&.setting_style_css_webapp || '') : ''
   end
 
   def css
-    "#{css_dashed_nest}\n#{css_underline_a}\n#{css_webapp}".squish
+    "#{css_dashed_nest}\n#{css_underline_a}\n#{css_wide_media}\n#{css_webapp}".squish
   end
 
   def set_account
diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb
index 69affa303..28f40dc73 100644
--- a/app/lib/user_settings_decorator.rb
+++ b/app/lib/user_settings_decorator.rb
@@ -53,6 +53,7 @@ class UserSettingsDecorator
     user.settings['style_underline_a']   = style_underline_a_preference if change?('setting_style_underline_a')
     user.settings['style_css_profile']   = style_css_profile_preference if change?('setting_style_css_profile')
     user.settings['style_css_webapp']    = style_css_webapp_preference if change?('setting_style_css_webapp')
+    user.settings['style_wide_media']    = style_wide_media_preference if change?('setting_style_wide_media')
     user.settings['publish_in']          = publish_in_preference if change?('setting_publish_in')
     user.settings['unpublish_in']        = unpublish_in_preference if change?('setting_unpublish_in')
     user.settings['unpublish_delete']    = unpublish_delete_preference if change?('setting_unpublish_delete')
@@ -197,6 +198,10 @@ class UserSettingsDecorator
     css
   end
 
+  def style_wide_media_preference
+    boolean_cast_setting 'setting_style_wide_media'
+  end
+
   def publish_in_preference
     settings['setting_publish_in'].to_i
   end
diff --git a/app/models/user.rb b/app/models/user.rb
index cdb32f214..8e10d6e9d 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -116,6 +116,7 @@ class User < ApplicationRecord
            :default_content_type, :system_emoji_font,
            :manual_publish, :style_dashed_nest, :style_underline_a, :style_css_profile,
            :style_css_profile_errors, :style_css_webapp, :style_css_webapp_errors,
+           :style_wide_media,
            :publish_in, :unpublish_in, :unpublish_delete, :boost_every, :boost_jitter,
            :boost_random,
            to: :settings, prefix: :setting, allow_nil: false
diff --git a/app/views/settings/preferences/appearance/show.html.haml b/app/views/settings/preferences/appearance/show.html.haml
index c89ca6e28..48031a973 100644
--- a/app/views/settings/preferences/appearance/show.html.haml
+++ b/app/views/settings/preferences/appearance/show.html.haml
@@ -31,6 +31,7 @@
     = f.input :setting_system_emoji_font, as: :boolean, wrapper: :with_label
 
   .fields-group
+    = f.input :setting_style_wide_media, as: :boolean, wrapper: :with_label
     = f.input :setting_style_dashed_nest, as: :boolean, wrapper: :with_label
     = f.input :setting_style_underline_a, as: :boolean, wrapper: :with_label
 
diff --git a/config/locales/simple_form.en-MP.yml b/config/locales/simple_form.en-MP.yml
index dc06e9fb3..8b9e09b65 100644
--- a/config/locales/simple_form.en-MP.yml
+++ b/config/locales/simple_form.en-MP.yml
@@ -58,6 +58,7 @@ en-MP:
         setting_style_css_webapp: Custom CSS for web interface
         setting_style_dashed_nest: Use dashed nest level indicators
         setting_style_underline_a: Underline hyperlinks
+        setting_style_wide_media: Wide media attachments
         setting_boost_every: Automatically queue and space out boosts
         setting_boost_jitter: Add a random delay up to
         setting_boost_random: In random order