add more options for time range of roars visible to anonymous public profile viewers

staging
multiple creatures 2019-07-21 19:51:07 -05:00
parent 61461a5323
commit d9073f132b
8 changed files with 32 additions and 37 deletions

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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