Add Fedibird new features policy setting

This commit is contained in:
noellabo 2022-02-16 18:55:06 +09:00
parent 1e6fbdea3a
commit 52177c5400
18 changed files with 76 additions and 1 deletions

View file

@ -77,6 +77,7 @@ class Settings::PreferencesController < Settings::BaseController
:setting_hide_following_count, :setting_hide_following_count,
:setting_hide_followers_count, :setting_hide_followers_count,
:setting_disable_joke_appearance, :setting_disable_joke_appearance,
:setting_new_features_policy,
notification_emails: %i(follow follow_request reblog favourite emoji_reaction mention digest report pending_account trending_tag), notification_emails: %i(follow follow_request reblog favourite emoji_reaction mention digest report pending_account trending_tag),
interactions: %i(must_be_follower must_be_following must_be_following_dm) interactions: %i(must_be_follower must_be_following must_be_following_dm)
) )

View file

@ -42,5 +42,6 @@ export const enable_limited_timeline = getMeta('enable_limited_timeline');
export const enableReaction = getMeta('enable_reaction'); export const enableReaction = getMeta('enable_reaction');
export const show_reply_tree_button = getMeta('show_reply_tree_button'); export const show_reply_tree_button = getMeta('show_reply_tree_button');
export const disable_joke_appearance = getMeta('disable_joke_appearance'); export const disable_joke_appearance = getMeta('disable_joke_appearance');
export const new_features_policy = getMeta('new_features_policy');
export default initialState; export default initialState;

View file

@ -702,6 +702,12 @@ html {
color: $fedibird-theme-color; color: $fedibird-theme-color;
background-color: rgba($fedibird-theme-color, 0.1); background-color: rgba($fedibird-theme-color, 0.1);
} }
.beta_features {
border-color: $gold-star;
color: $gold-star;
background-color: rgba($gold-star, 0.1);
}
} }
.fedibird_features { .fedibird_features {
@ -710,6 +716,12 @@ html {
background-color: rgba($fedibird-theme-color, 0.1); background-color: rgba($fedibird-theme-color, 0.1);
} }
.beta_features {
border-color: $gold-star;
color: $gold-star;
background-color: rgba($gold-star, 0.1);
}
.compose-form .compose-form__warning { .compose-form .compose-form__warning {
border-color: $ui-highlight-color; border-color: $ui-highlight-color;
background-color: rgba($ui-highlight-color, 0.1); background-color: rgba($ui-highlight-color, 0.1);

View file

@ -204,6 +204,8 @@
.account-role, .account-role,
.fedibird_features, .fedibird_features,
.simple_form .fedibird_features, .simple_form .fedibird_features,
.beta_features,
.simple_form .beta_features,
.simple_form .recommended { .simple_form .recommended {
padding: 4px 8px; padding: 4px 8px;
border-radius: 17px; border-radius: 17px;

View file

@ -22,6 +22,7 @@
&.boolean { &.boolean {
.fedibird_features, .fedibird_features,
.beta_features,
.recommended { margin: 0 8px } .recommended { margin: 0 8px }
.label_input>label { padding-top: 3px } .label_input>label { padding-top: 3px }

View file

@ -203,7 +203,9 @@
.account-role, .account-role,
.fedibird_features, .fedibird_features,
.beta_features,
.simple_form .fedibird_features, .simple_form .fedibird_features,
.simple_form .beta_features,
.simple_form .recommended { .simple_form .recommended {
display: inline-block; display: inline-block;
padding: 4px 6px; padding: 4px 6px;
@ -227,14 +229,24 @@
background-color: rgba(lighten($error-red, 12%), 0.1); background-color: rgba(lighten($error-red, 12%), 0.1);
border-color: rgba(lighten($error-red, 12%), 0.5); border-color: rgba(lighten($error-red, 12%), 0.5);
} }
&.float {
float: right;
}
} }
.fedibird_features, .fedibird_features,
.simple_form .fedibird_features { .simple_form .fedibird_features {
background-color: rgba($fedibird-theme-color, 0.5); background-color: rgba($fedibird-theme-color, 0.5);
border: 1px solid $fedibird-theme-color; border: 1px solid $fedibird-theme-color;
} }
.beta_features,
.simple_form .beta_features {
background-color: rgba($gold-star, 0.5);
border: 1px solid $gold-star;
}
.account__header__fields { .account__header__fields {
max-width: 100vw; max-width: 100vw;
padding: 0; padding: 0;

View file

@ -103,6 +103,7 @@ code {
} }
.fedibird_features, .fedibird_features,
.beta_features,
.recommended { .recommended {
position: absolute; position: absolute;
margin: 0 4px; margin: 0 4px;

View file

@ -510,4 +510,13 @@ body.rtl {
.circle-link .circle-delete-button { .circle-link .circle-delete-button {
text-align: right; text-align: right;
} }
.fedibird_features,
.simple_form .fedibird_features,
.beta_features,
.simple_form .beta_features {
&.float {
float: left;
}
}
} }

View file

@ -71,6 +71,7 @@ class UserSettingsDecorator
user.settings['hide_following_count'] = hide_following_count_preference if change?('setting_hide_following_count') user.settings['hide_following_count'] = hide_following_count_preference if change?('setting_hide_following_count')
user.settings['hide_followers_count'] = hide_followers_count_preference if change?('setting_hide_followers_count') user.settings['hide_followers_count'] = hide_followers_count_preference if change?('setting_hide_followers_count')
user.settings['disable_joke_appearance'] = disable_joke_appearance_preference if change?('setting_disable_joke_appearance') user.settings['disable_joke_appearance'] = disable_joke_appearance_preference if change?('setting_disable_joke_appearance')
user.settings['new_features_policy'] = new_features_policy if change?('setting_new_features_policy')
end end
def merged_notification_emails def merged_notification_emails
@ -241,6 +242,10 @@ class UserSettingsDecorator
boolean_cast_setting 'setting_disable_joke_appearance' boolean_cast_setting 'setting_disable_joke_appearance'
end end
def new_features_policy
settings['setting_new_features_policy']
end
def boolean_cast_setting(key) def boolean_cast_setting(key)
ActiveModel::Type::Boolean.new.cast(settings[key]) ActiveModel::Type::Boolean.new.cast(settings[key])
end end

View file

@ -132,6 +132,7 @@ class User < ApplicationRecord
:place_tab_bar_at_bottom,:show_tab_bar_label, :enable_limited_timeline, :enable_reaction, :place_tab_bar_at_bottom,:show_tab_bar_label, :enable_limited_timeline, :enable_reaction,
:show_reply_tree_button, :show_reply_tree_button,
:hide_statuses_count, :hide_following_count, :hide_followers_count, :disable_joke_appearance, :hide_statuses_count, :hide_following_count, :hide_followers_count, :disable_joke_appearance,
:new_features_policy,
to: :settings, prefix: :setting, allow_nil: false to: :settings, prefix: :setting, allow_nil: false

View file

@ -56,6 +56,7 @@ class InitialStateSerializer < ActiveModel::Serializer
store[:enable_reaction] = object.current_account.user.setting_enable_reaction store[:enable_reaction] = object.current_account.user.setting_enable_reaction
store[:show_reply_tree_button] = object.current_account.user.setting_show_reply_tree_button store[:show_reply_tree_button] = object.current_account.user.setting_show_reply_tree_button
store[:disable_joke_appearance] = object.current_account.user.setting_disable_joke_appearance store[:disable_joke_appearance] = object.current_account.user.setting_disable_joke_appearance
store[:new_features_policy] = object.current_account.user.setting_new_features_policy
else else
store[:auto_play_gif] = Setting.auto_play_gif store[:auto_play_gif] = Setting.auto_play_gif
store[:display_media] = Setting.display_media store[:display_media] = Setting.display_media

View file

@ -42,6 +42,10 @@
%h4= t 'preferences.fedibird_features' %h4= t 'preferences.fedibird_features'
.fields-group
%span.fedibird_features.float Fedibird
= f.input :setting_new_features_policy, collection: ['conservative', 'default', 'tester'], label_method: lambda { |item| t("simple_form.labels.defaults.setting_new_features_policy_#{item}") }, hint: t("simple_form.hints.defaults.setting_new_features_policy"), as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', wrapper: :with_floating_label
.fields-group .fields-group
= f.input :setting_show_follow_button_on_timeline, as: :boolean, wrapper: :with_label, fedibird_features: true = f.input :setting_show_follow_button_on_timeline, as: :boolean, wrapper: :with_label, fedibird_features: true

View file

@ -24,9 +24,18 @@ module FedibirdFeaturesComponent
end end
end end
module BetaFeaturesComponent
def beta_features(_wrapper_options = nil)
return unless options[:beta_features]
options[:label_text] = ->(raw_label_text, _required_label_text, _label_present) { safe_join([raw_label_text, ' ', content_tag(:span, I18n.t('simple_form.beta_features'), class: 'beta_features')]) }
nil
end
end
SimpleForm.include_component(AppendComponent) SimpleForm.include_component(AppendComponent)
SimpleForm.include_component(RecommendedComponent) SimpleForm.include_component(RecommendedComponent)
SimpleForm.include_component(FedibirdFeaturesComponent) SimpleForm.include_component(FedibirdFeaturesComponent)
SimpleForm.include_component(BetaFeaturesComponent)
SimpleForm.setup do |config| SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a # Wrappers are used by the form builder to generate a
@ -85,6 +94,7 @@ SimpleForm.setup do |config|
b.wrapper tag: :div, class: :label_input do |ba| b.wrapper tag: :div, class: :label_input do |ba|
ba.optional :recommended ba.optional :recommended
ba.optional :fedibird_features ba.optional :fedibird_features
ba.optional :beta_features
ba.use :label ba.use :label
ba.wrapper tag: :div, class: :label_input__wrapper do |bb| ba.wrapper tag: :div, class: :label_input__wrapper do |bb|

View file

@ -1231,6 +1231,7 @@ en:
too_few_options: must have more than one item too_few_options: must have more than one item
too_many_options: can't contain more than %{max} items too_many_options: can't contain more than %{max} items
preferences: preferences:
beta_features: Beta features
fedibird_features: Fedibird features fedibird_features: Fedibird features
other: Other other: Other
posting_defaults: Posting defaults posting_defaults: Posting defaults

View file

@ -1176,6 +1176,7 @@ ja:
too_few_options: は複数必要です too_few_options: は複数必要です
too_many_options: は%{max}個までです too_many_options: は%{max}個までです
preferences: preferences:
beta_features: ベータ機能
fedibird_features: Fedibirdの機能 fedibird_features: Fedibirdの機能
other: その他 other: その他
posting_defaults: デフォルトの投稿設定 posting_defaults: デフォルトの投稿設定

View file

@ -1,6 +1,7 @@
--- ---
en: en:
simple_form: simple_form:
beta_features: Beta
fedibird_features: Fedibird fedibird_features: Fedibird
hints: hints:
account_alias: account_alias:
@ -64,6 +65,7 @@ en:
setting_hide_following_count: The number of following will be hidden in your profile setting_hide_following_count: The number of following will be hidden in your profile
setting_hide_network: Who you follow and who follows you will be hidden on your profile setting_hide_network: Who you follow and who follows you will be hidden on your profile
setting_hide_statuses_count: The number of post will be hidden in your profile setting_hide_statuses_count: The number of post will be hidden in your profile
setting_new_features_policy: Set the acceptance policy when new features are added to Fedibird. The recommended setting will enable many new features, so set it to disabled if it is not desirable
setting_noindex: Affects your public profile and post pages setting_noindex: Affects your public profile and post pages
setting_place_tab_bar_at_bottom: When using a touch device, you can operate tabs within the reach of your fingers. setting_place_tab_bar_at_bottom: When using a touch device, you can operate tabs within the reach of your fingers.
setting_show_application: The application you use to post will be displayed in the detailed view of your posts setting_show_application: The application you use to post will be displayed in the detailed view of your posts
@ -209,6 +211,10 @@ en:
setting_hide_following_count: Hide your following count setting_hide_following_count: Hide your following count
setting_hide_network: Hide your social graph setting_hide_network: Hide your social graph
setting_hide_statuses_count: Hide your post count setting_hide_statuses_count: Hide your post count
setting_new_features_policy: Policy for new features
setting_new_features_policy_tester: Participate in the beta test
setting_new_features_policy_conservative: Leave it disabled. I use it if necessary
setting_new_features_policy_default: Follow recommendations (default)
setting_noindex: Opt-out of search engine indexing setting_noindex: Opt-out of search engine indexing
setting_place_tab_bar_at_bottom: Place the tab bar at the bottom setting_place_tab_bar_at_bottom: Place the tab bar at the bottom
setting_reduce_motion: Reduce motion in animations setting_reduce_motion: Reduce motion in animations

View file

@ -1,6 +1,7 @@
--- ---
ja: ja:
simple_form: simple_form:
beta_features: ベータ
fedibird_features: Fedibird fedibird_features: Fedibird
hints: hints:
account_alias: account_alias:
@ -64,6 +65,7 @@ ja:
setting_hide_following_count: フォロー数をプロフィールページで見られないようにします setting_hide_following_count: フォロー数をプロフィールページで見られないようにします
setting_hide_network: フォローとフォロワーの情報がプロフィールページで見られないようにします setting_hide_network: フォローとフォロワーの情報がプロフィールページで見られないようにします
setting_hide_statuses_count: 投稿数をプロフィールページで見られないようにします setting_hide_statuses_count: 投稿数をプロフィールページで見られないようにします
setting_new_features_policy: Fedibirdに新しい機能が追加された時の受け入れポリシーを設定します。推奨設定は多くの新機能を有効にするので、望ましくない場合は無効に設定してください
setting_noindex: 公開プロフィールおよび各投稿ページに影響します setting_noindex: 公開プロフィールおよび各投稿ページに影響します
setting_place_tab_bar_at_bottom: タッチデバイス使用時に、タブの操作を指の届く範囲で行えます setting_place_tab_bar_at_bottom: タッチデバイス使用時に、タブの操作を指の届く範囲で行えます
setting_show_application: 投稿するのに使用したアプリが投稿の詳細ビューに表示されるようになります setting_show_application: 投稿するのに使用したアプリが投稿の詳細ビューに表示されるようになります
@ -209,6 +211,10 @@ ja:
setting_hide_following_count: フォロー数を隠す setting_hide_following_count: フォロー数を隠す
setting_hide_network: 繋がりを隠す setting_hide_network: 繋がりを隠す
setting_hide_statuses_count: 投稿数を隠す setting_hide_statuses_count: 投稿数を隠す
setting_new_features_policy: 新機能へのポリシー
setting_new_features_policy_conservative: 無効にしておき、自分で判断する
setting_new_features_policy_default: 推奨に従う(デフォルト)
setting_new_features_policy_tester: ベータテストに参加する
setting_noindex: 検索エンジンによるインデックスを拒否する setting_noindex: 検索エンジンによるインデックスを拒否する
setting_place_tab_bar_at_bottom: タブバーを下に配置する setting_place_tab_bar_at_bottom: タブバーを下に配置する
setting_reduce_motion: アニメーションの動きを減らす setting_reduce_motion: アニメーションの動きを減らす

View file

@ -56,6 +56,7 @@ defaults: &defaults
hide_following_count: false hide_following_count: false
hide_followers_count: false hide_followers_count: false
disable_joke_appearance: false disable_joke_appearance: false
new_features_policy: 'default'
notification_emails: notification_emails:
follow: false follow: false
reblog: false reblog: false