about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-11-12 10:17:22 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-11-12 10:17:22 +0100
commitfdfacb0ec0e81e323e67abde0d4b5b16f0d8bf0a (patch)
tree2d1b24eb11fe85b7d02b98d1a34606a6df845ff0
parent6df9d388e7cb3d90a6d1fb0a920c1ce16db60822 (diff)
Revert "Revert "Change "Allow trends without prior review" setting to include statuses (#17977)""
This reverts commit bfc539cfb4f040fcffac740b36791c26c2a74119.
-rw-r--r--app/javascript/styles/mastodon/accounts.scss9
-rw-r--r--app/javascript/styles/mastodon/forms.scss3
-rw-r--r--app/models/account.rb4
-rw-r--r--config/i18n-tasks.yml2
-rw-r--r--config/initializers/simple_form.rb5
-rw-r--r--config/locales/simple_form.en.yml1
6 files changed, 20 insertions, 4 deletions
diff --git a/app/javascript/styles/mastodon/accounts.scss b/app/javascript/styles/mastodon/accounts.scss
index 54b65bfc8..c007eb4b5 100644
--- a/app/javascript/styles/mastodon/accounts.scss
+++ b/app/javascript/styles/mastodon/accounts.scss
@@ -202,7 +202,8 @@
 }
 
 .account-role,
-.simple_form .recommended {
+.simple_form .recommended,
+.simple_form .not_recommended {
   display: inline-block;
   padding: 4px 6px;
   cursor: default;
@@ -227,6 +228,12 @@
   }
 }
 
+.simple_form .not_recommended {
+  color: lighten($error-red, 12%);
+  background-color: rgba(lighten($error-red, 12%), 0.1);
+  border-color: rgba(lighten($error-red, 12%), 0.5);
+}
+
 .account__header__fields {
   max-width: 100vw;
   padding: 0;
diff --git a/app/javascript/styles/mastodon/forms.scss b/app/javascript/styles/mastodon/forms.scss
index 4c731be43..a3ddc7636 100644
--- a/app/javascript/styles/mastodon/forms.scss
+++ b/app/javascript/styles/mastodon/forms.scss
@@ -103,7 +103,8 @@ code {
         }
       }
 
-      .recommended {
+      .recommended,
+      .not_recommended {
         position: absolute;
         margin: 0 4px;
         margin-top: -2px;
diff --git a/app/models/account.rb b/app/models/account.rb
index 7059c555f..ab8a65720 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -260,6 +260,10 @@ class Account < ApplicationRecord
     update!(memorial: true)
   end
 
+  def trendable
+    boolean_with_default('trendable', Setting.trendable_by_default)
+  end
+
   def sign?
     true
   end
diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml
index 6117e6e5b..8bed34638 100644
--- a/config/i18n-tasks.yml
+++ b/config/i18n-tasks.yml
@@ -50,7 +50,7 @@ ignore_unused:
   - 'activerecord.errors.*'
   - '{devise,pagination,doorkeeper}.*'
   - '{date,datetime,time,number}.*'
-  - 'simple_form.{yes,no,recommended}'
+  - 'simple_form.{yes,no,recommended,not_recommended}'
   - 'simple_form.{placeholders,hints,labels}.*'
   - 'simple_form.{error_notification,required}.:'
   - 'errors.messages.*'
diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb
index 3a2097d2f..92cffc5a2 100644
--- a/config/initializers/simple_form.rb
+++ b/config/initializers/simple_form.rb
@@ -11,7 +11,10 @@ end
 module RecommendedComponent
   def recommended(_wrapper_options = nil)
     return unless options[:recommended]
-    options[:label_text] = ->(raw_label_text, _required_label_text, _label_present) { safe_join([raw_label_text, ' ', content_tag(:span, I18n.t('simple_form.recommended'), class: 'recommended')]) }
+
+    key = options[:recommended].is_a?(Symbol) ? options[:recommended] : :recommended
+    options[:label_text] = ->(raw_label_text, _required_label_text, _label_present) { safe_join([raw_label_text, ' ', content_tag(:span, I18n.t(key, scope: 'simple_form'), class: key)]) }
+
     nil
   end
 end
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
index 464aa5774..6edf7b4e9 100644
--- a/config/locales/simple_form.en.yml
+++ b/config/locales/simple_form.en.yml
@@ -298,6 +298,7 @@ en:
         events: Enabled events
         url: Endpoint URL
     'no': 'No'
+    not_recommended: Not recommended
     recommended: Recommended
     required:
       mark: "*"