diff --git a/app/javascript/mastodon/actions/lists.js b/app/javascript/mastodon/actions/lists.js index 5ab9224363f..3c12af72c8d 100644 --- a/app/javascript/mastodon/actions/lists.js +++ b/app/javascript/mastodon/actions/lists.js @@ -150,10 +150,10 @@ export const createListFail = error => ({ error, }); -export const updateList = (id, title, shouldReset, replies_policy) => (dispatch, getState) => { +export const updateList = (id, title, shouldReset, replies_policy, show_reblogs_policy) => (dispatch, getState) => { dispatch(updateListRequest(id)); - api(getState).put(`/api/v1/lists/${id}`, { title, replies_policy }).then(({ data }) => { + api(getState).put(`/api/v1/lists/${id}`, { title, replies_policy, show_reblogs_policy }).then(({ data }) => { dispatch(updateListSuccess(data)); if (shouldReset) { diff --git a/app/javascript/mastodon/features/list_timeline/index.js b/app/javascript/mastodon/features/list_timeline/index.js index 8010274f880..4cc34fbc15f 100644 --- a/app/javascript/mastodon/features/list_timeline/index.js +++ b/app/javascript/mastodon/features/list_timeline/index.js @@ -16,6 +16,7 @@ import MissingIndicator from '../../components/missing_indicator'; import LoadingIndicator from '../../components/loading_indicator'; import Icon from 'mastodon/components/icon'; import RadioButton from 'mastodon/components/radio_button'; +import Toggle from 'react-toggle'; const messages = defineMessages({ deleteMessage: { id: 'confirmations.delete_list.message', defaultMessage: 'Are you sure you want to permanently delete this list?' }, @@ -141,11 +142,12 @@ class ListTimeline extends React.PureComponent { } render () { - const { hasUnread, columnId, multiColumn, list, intl } = this.props; + const { hasUnread, columnId, multiColumn, list, intl, onChange } = this.props; const { id } = this.props.params; const pinned = !!columnId; const title = list ? list.get('title') : id; const replies_policy = list ? list.get('replies_policy') : undefined; + const show_reblogs_policy = list ? list.get('show_reblogs') : undefined; if (typeof list === 'undefined') { return ( @@ -186,6 +188,12 @@ class ListTimeline extends React.PureComponent { + + +
+ +
+ { replies_policy !== undefined && (
diff --git a/app/models/list.rb b/app/models/list.rb index cdc6ebdb37a..395e8cab06e 100644 --- a/app/models/list.rb +++ b/app/models/list.rb @@ -9,6 +9,7 @@ # created_at :datetime not null # updated_at :datetime not null # replies_policy :integer default("list"), not null +# show_reblogs :boolean default(TRUE) # class List < ApplicationRecord diff --git a/db/migrate/20230103141619_add_show_reblogs_to_lists.rb b/db/migrate/20230103141619_add_show_reblogs_to_lists.rb new file mode 100644 index 00000000000..3eebc3aa701 --- /dev/null +++ b/db/migrate/20230103141619_add_show_reblogs_to_lists.rb @@ -0,0 +1,10 @@ +class AddShowReblogsToLists < ActiveRecord::Migration[6.1] + def up + add_column :lists, :show_reblogs, :boolean + change_column_default :lists, :show_reblogs, true + end + + def down + remove_column :lists, :show_reblogs + end +end diff --git a/db/migrate/20230103143222_backfill_add_show_reblogs_to_lists.rb b/db/migrate/20230103143222_backfill_add_show_reblogs_to_lists.rb new file mode 100644 index 00000000000..9317fd22bf6 --- /dev/null +++ b/db/migrate/20230103143222_backfill_add_show_reblogs_to_lists.rb @@ -0,0 +1,10 @@ +class BackfillAddShowReblogsToLists < ActiveRecord::Migration[6.1] + disable_ddl_transaction! + + def up + List.unscoped.in_batches do |relation| + relation.update_all show_reblogs: true + sleep(0.01) + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 563fb82733f..ee4ded4ec42 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_01_16_082923) do +ActiveRecord::Schema.define(version: 2023_01_03_143222) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -191,8 +191,8 @@ t.integer "avatar_storage_schema_version" t.integer "header_storage_schema_version" t.string "devices_url" - t.datetime "sensitized_at" t.integer "suspension_origin" + t.datetime "sensitized_at" t.integer "sponsor", default: 0 t.float "donation_amount", default: 0.0 t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin @@ -468,7 +468,7 @@ t.index ["account_id", "target_account_id"], name: "index_follows_on_account_id_and_target_account_id", unique: true t.index ["target_account_id"], name: "index_follows_on_target_account_id" end - + create_table "identities", force: :cascade do |t| t.string "provider", default: "", null: false t.string "uid", default: "", null: false @@ -506,12 +506,12 @@ end create_table "ip_blocks", force: :cascade do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.datetime "expires_at" t.inet "ip", default: "0.0.0.0", null: false t.integer "severity", default: 0, null: false - t.datetime "expires_at" t.text "comment", default: "", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false end create_table "list_accounts", force: :cascade do |t| @@ -529,6 +529,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "replies_policy", default: 0, null: false + t.boolean "show_reblogs", default: true t.index ["account_id"], name: "index_lists_on_account_id" end @@ -860,8 +861,8 @@ create_table "status_pins", force: :cascade do |t| t.bigint "account_id", null: false t.bigint "status_id", null: false - t.datetime "created_at", default: -> { "CURRENT_TIMESTAMP" }, null: false - t.datetime "updated_at", default: -> { "CURRENT_TIMESTAMP" }, null: false + t.datetime "created_at", default: -> { "now()" }, null: false + t.datetime "updated_at", default: -> { "now()" }, null: false t.index ["account_id", "status_id"], name: "index_status_pins_on_account_id_and_status_id", unique: true end