]> cat aescling's git repositories - mastodon.git/commitdiff
rename replies_policy enumerables (#15304)
authortrwnh <a@trwnh.com>
Wed, 9 Dec 2020 03:34:17 +0000 (21:34 -0600)
committerGitHub <noreply@github.com>
Wed, 9 Dec 2020 03:34:17 +0000 (04:34 +0100)
app/javascript/mastodon/features/list_timeline/index.js
app/lib/feed_manager.rb
app/models/list.rb
spec/lib/feed_manager_spec.rb

index a3be8fbea3afe26fe34ee0ebe499cf5de5e549bf..02b01824735342dfe9f30f300bf41f0b51a1769c 100644 (file)
@@ -20,9 +20,9 @@ import RadioButton from 'mastodon/components/radio_button';
 const messages = defineMessages({
   deleteMessage: { id: 'confirmations.delete_list.message', defaultMessage: 'Are you sure you want to permanently delete this list?' },
   deleteConfirm: { id: 'confirmations.delete_list.confirm', defaultMessage: 'Delete' },
-  all_replies:   { id: 'lists.replies_policy.all_replies', defaultMessage: 'Any followed user' },
-  no_replies:    { id: 'lists.replies_policy.no_replies', defaultMessage: 'No one' },
-  list_replies:  { id: 'lists.replies_policy.list_replies', defaultMessage: 'Members of the list' },
+  followed:   { id: 'lists.replies_policy.followed', defaultMessage: 'Any followed user' },
+  none:    { id: 'lists.replies_policy.none', defaultMessage: 'No one' },
+  list:  { id: 'lists.replies_policy.list', defaultMessage: 'Members of the list' },
 });
 
 const mapStateToProps = (state, props) => ({
@@ -193,7 +193,7 @@ class ListTimeline extends React.PureComponent {
                 <FormattedMessage id='lists.replies_policy.title' defaultMessage='Show replies to:' />
               </span>
               <div className='column-settings__row'>
-                { ['no_replies', 'list_replies', 'all_replies'].map(policy => (
+                { ['none', 'list', 'followed'].map(policy => (
                   <RadioButton name='order' value={policy} label={intl.formatMessage(messages[policy])} checked={replies_policy === policy} onChange={this.handleRepliesPolicyChange} />
                 ))}
               </div>
index 0876d107bd18fc4b384b00f41d2c40b0fd896427..5e01ef67a156288caa9e1dd5a21c48bcbcd6720a 100644 (file)
@@ -345,8 +345,8 @@ class FeedManager
   def filter_from_list?(status, list)
     if status.reply? && status.in_reply_to_account_id != status.account_id
       should_filter = status.in_reply_to_account_id != list.account_id
-      should_filter &&= !list.show_all_replies?
-      should_filter &&= !(list.show_list_replies? && ListAccount.where(list_id: list.id, account_id: status.in_reply_to_account_id).exists?)
+      should_filter &&= !list.show_followed?
+      should_filter &&= !(list.show_list? && ListAccount.where(list_id: list.id, account_id: status.in_reply_to_account_id).exists?)
 
       return !!should_filter
     end
index 8493046e58339f9982b765c054db3bd7b44dd126..655d55ff6fec8c748a7c83f0146e37dd00d75e2e 100644 (file)
@@ -8,7 +8,7 @@
 #  title          :string           default(""), not null
 #  created_at     :datetime         not null
 #  updated_at     :datetime         not null
-#  replies_policy :integer          default("list_replies"), not null
+#  replies_policy :integer          default("list"), not null
 #
 
 class List < ApplicationRecord
@@ -16,7 +16,7 @@ class List < ApplicationRecord
 
   PER_ACCOUNT_LIMIT = 50
 
-  enum replies_policy: [:list_replies, :all_replies, :no_replies], _prefix: :show
+  enum replies_policy: [:list, :followed, :none], _prefix: :show
 
   belongs_to :account, optional: true
 
index 7d775a86d7be742e603ae2a45349bd41b09eb5a9..0df85e5bcbb64968c81037b97037d4cb95b889c6 100644 (file)
@@ -335,7 +335,7 @@ RSpec.describe FeedManager do
 
     context 'when replies policy is set to no replies' do
       before do
-        list.replies_policy = :no_replies
+        list.replies_policy = :none
       end
 
       it 'pushes statuses that are not replies' do
@@ -358,7 +358,7 @@ RSpec.describe FeedManager do
 
     context 'when replies policy is set to list-only replies' do
       before do
-        list.replies_policy = :list_replies
+        list.replies_policy = :list
       end
 
       it 'pushes statuses that are not replies' do
@@ -387,7 +387,7 @@ RSpec.describe FeedManager do
 
     context 'when replies policy is set to any reply' do
       before do
-        list.replies_policy = :all_replies
+        list.replies_policy = :followed
       end
 
       it 'pushes statuses that are not replies' do