about summary refs log tree commit diff
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-07-21 19:51:07 -0500
committermultiple creatures <dev@multiple-creature.party>2019-07-21 19:51:07 -0500
commitd9073f132b041fae818ae3894503065de123f257 (patch)
tree9c4bdd4dcfdf86458dfa444af1ca31e89ee8a410
parent61461a53239b18ee581dd1b57c1cd83c0900814b (diff)
add more options for time range of roars visible to anonymous public profile viewers
-rw-r--r--app/controllers/accounts_controller.rb4
-rw-r--r--app/controllers/settings/preferences_controller.rb1
-rw-r--r--app/lib/user_settings_decorator.rb15
-rw-r--r--app/models/account.rb2
-rw-r--r--app/models/user.rb20
-rwxr-xr-xapp/views/layouts/application.html.haml9
-rw-r--r--app/views/settings/preferences/show.html.haml4
-rw-r--r--config/locales/simple_form.en.yml14
8 files changed, 32 insertions, 37 deletions
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index 084201d85..4736b3596 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -60,7 +60,9 @@ class AccountsController < ApplicationController
     else
       scope = default_statuses.without_replies.without_reblogs
     end
-    current_user.blank? ? scope.where(created_at: 6.days.ago..Time.current) : scope
+    return scope if current_user
+    return Status.none unless @account&.user
+    scope.where(created_at: @account.user.max_public_history.to_i.days.ago..Time.current)
   end
 
   def default_statuses
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb
index 530d54a41..45bfd24b2 100644
--- a/app/controllers/settings/preferences_controller.rb
+++ b/app/controllers/settings/preferences_controller.rb
@@ -50,6 +50,7 @@ class Settings::PreferencesController < Settings::BaseController
       :setting_user_is_kobold,
       :setting_hide_mascot,
       :setting_hide_interactions,
+      :setting_max_public_history,
 
       :setting_default_privacy,
       :setting_default_sensitive,
diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb
index e47794072..bf6a9fe2c 100644
--- a/app/lib/user_settings_decorator.rb
+++ b/app/lib/user_settings_decorator.rb
@@ -30,12 +30,11 @@ class UserSettingsDecorator
     user.settings['hide_mntions_blocked']= hide_mntions_blocked_preference if change?('setting_hide_mntions_blocked')
     user.settings['hide_mntions_blocker']= hide_mntions_blocker_preference if change?('setting_hide_mntions_blocker')
     user.settings['hide_mntions_packm8'] = hide_mntions_packm8_preference if change?('setting_hide_mntions_packm8')
-    user.settings['gently_kobolds']      = gently_kobolds_preference if change?('setting_gently_kobolds')
-    user.settings['user_is_kobold']      = user_is_kobold_preference if change?('setting_user_is_kobold')
     user.settings['hide_captions']       = hide_captions_preference if change?('setting_hide_captions')
     user.settings['hide_mascot']         = hide_mascot_preference if change?('setting_hide_mascot')
     user.settings['hide_interactions']   = hide_interactions_preference if change?('setting_hide_interactions')
     user.settings['larger_emoji']        = larger_emoji_preference if change?('setting_larger_emoji')
+    user.settings['max_public_history']  = max_public_history_preference if change?('setting_max_public_history')
 
     user.settings['notification_emails'] = merged_notification_emails if change?('notification_emails')
     user.settings['interactions']        = merged_interactions if change?('interactions')
@@ -109,14 +108,6 @@ class UserSettingsDecorator
     boolean_cast_setting 'setting_hide_mntions_packm8'
   end
 
-  def gently_kobolds_preference
-    boolean_cast_setting 'setting_gently_kobolds'
-  end
-
-  def user_is_kobold_preference
-    boolean_cast_setting 'setting_user_is_kobold'
-  end
-
   def hide_mascot_preference
     boolean_cast_setting 'setting_hide_mascot'
   end
@@ -125,6 +116,10 @@ class UserSettingsDecorator
     boolean_cast_setting 'setting_hide_interactions'
   end
 
+  def max_public_history_preference
+    settings['setting_max_public_history']
+  end
+
   def merged_notification_emails
     user.settings['notification_emails'].merge coerced_settings('notification_emails').to_h
   end
diff --git a/app/models/account.rb b/app/models/account.rb
index 26d918714..b3afdbcf7 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -132,6 +132,7 @@ class Account < ApplicationRecord
            :defaults_to_sensitive?,
            :defaults_to_local_only?,
            :always_local_only?,
+           :max_public_history,
 
            :hides_interactions?,
            :hides_network?,
@@ -152,7 +153,6 @@ class Account < ApplicationRecord
            :wants_larger_emoji?,
            :hides_filtered_gap?,
            :hides_mascot?,
-           :hides_color_formatting?,
            :hides_captions?,
 
            to: :user,
diff --git a/app/models/user.rb b/app/models/user.rb
index b8151e7ed..eeefce075 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -107,7 +107,6 @@ class User < ApplicationRecord
     :always_local,
     :rawr_federated,
     :hide_stats,
-    :disable_color,
     :hide_captions,
     :larger_menus,
     :larger_buttons,
@@ -121,10 +120,9 @@ class User < ApplicationRecord
     :hide_mntions_blocked,
     :hide_mntions_blocker,
     :hide_mntions_packm8,
-    :gently_kobolds,
-    :user_is_kobold,
     :hide_mascot,
     :hide_interactions,
+    :max_public_history,
 
     :auto_play_gif,
     :default_sensitive,
@@ -279,14 +277,6 @@ class User < ApplicationRecord
     @hides_mentions_outside_scope ||= (settings.hide_mntions_packm8 || true)
   end
 
-  def gentlies_kobolds?
-    @gentlies_kobolds ||= (settings.gently_kobolds || false)
-  end
-
-  def is_a_kobold?
-    @is_a_kobold ||= (settings.user_is_kobold || false)
-  end
-
   def hides_mascot?
     @hides_mascot ||= (settings.hide_mascot || false)
   end
@@ -295,6 +285,10 @@ class User < ApplicationRecord
     @hides_interactions ||= (settings.hide_interactions || false)
   end
 
+  def max_public_history
+    @_max_public_history ||= (settings.max_public_history || 6)
+  end
+
   def defaults_to_local_only?
     @defaults_to_local_only ||= (settings.default_local || false)
   end
@@ -307,10 +301,6 @@ class User < ApplicationRecord
     @wants_raw_federated ||= (settings.rawr_federated || false)
   end
 
-  def hides_color_formatting?
-    @hides_color_formatting ||= (settings.disable_color || false)
-  end
-
   def hides_stats?
     @hides_stats ||= (settings.hide_stats || false)
   end
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 856f4b045..1110942ac 100755
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -37,15 +37,6 @@
     - if Setting.custom_css.present?
       = stylesheet_link_tag custom_css_path, media: 'all'
 
-    - if current_account&.user_hides_color_formatting?
-      :css
-        .status__content p > span,
-        .reply-indicator__content p > span,
-        .composer--reply > .content p > span,
-        .account__header__content p > span,
-        .account__header__fields p > span
-        { color: inherit !important }
-
     - if current_account&.user_hides_captions?
       :css
         div .media-caption,
diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml
index d7a69d980..5d5a277d2 100644
--- a/app/views/settings/preferences/show.html.haml
+++ b/app/views/settings/preferences/show.html.haml
@@ -43,6 +43,9 @@
     = f.input :setting_show_application, as: :boolean, wrapper: :with_label
     = f.input :setting_noindex, as: :boolean, wrapper: :with_label
 
+  .fields-group
+    = f.input :setting_max_public_history, collection: [1, 3, 6, 7, 14, 30, 60, 90, 180, 365, 730, 1095, 2190], wrapper: :with_label, include_blank: false, label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.setting_max_public_history_#{item}")]) }, selected: current_user.max_public_history.to_i
+
   - unless Setting.hide_followers_count
     .fields-group
       = f.input :setting_hide_followers_count, as: :boolean, wrapper: :with_label
@@ -52,7 +55,6 @@
   .fields-group
     = f.input :setting_auto_play_gif, as: :boolean, wrapper: :with_label
     = f.input :setting_reduce_motion, as: :boolean, wrapper: :with_label
-    = f.input :setting_disable_color, as: :boolean, wrapper: :with_label
     = f.input :setting_system_font_ui, as: :boolean, wrapper: :with_label
     = f.input :setting_hide_captions, as: :boolean, wrapper: :with_label
     = f.input :setting_larger_menus, as: :boolean, wrapper: :with_label
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
index f9cb2ec3f..dacbb5b37 100644
--- a/config/locales/simple_form.en.yml
+++ b/config/locales/simple_form.en.yml
@@ -153,6 +153,20 @@ en:
         setting_favourite_modal: Show confirmation dialog before admiring (in Glitch flavour)
         setting_hide_followers_count: Hide your packmates count
         setting_hide_network: Make your packmate lists private
+        setting_max_public_history: Limit history of roars on public profile to
+        setting_max_public_history_1: 1 day
+        setting_max_public_history_3: 3 days
+        setting_max_public_history_6: 6 days
+        setting_max_public_history_7: 1 week
+        setting_max_public_history_14: 2 weeks
+        setting_max_public_history_30: 6 weeks
+        setting_max_public_history_60: 2 months
+        setting_max_public_history_90: 3 months
+        setting_max_public_history_180: 6 months
+        setting_max_public_history_365: 1 year
+        setting_max_public_history_730: 2 years
+        setting_max_public_history_1095: 3 years
+        setting_max_public_history_2190: 6 years
         setting_noindex: Opt-out of search engine indexing
         setting_reduce_motion: Reduce motion in animations
         setting_show_application: Disclose application used to send roars