diff --git a/Gemfile b/Gemfile index f39b2081d..e3f7a4db3 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ gem 'aws-sdk-s3' gem 'filesize' # Image processing -gem 'paperclip' # TODO: we want to migrate off this game to ActiveStorage +gem 'kt-paperclip' # TODO: we want to migrate off this game to ActiveStorage gem 'rmagick' gem 'image_processing' gem 'active_storage_validations' diff --git a/Gemfile.lock b/Gemfile.lock index 800ff1ebe..2ca8bf85c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1427,6 +1427,12 @@ GEM rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) + kt-paperclip (7.2.1) + activemodel (>= 4.2.0) + activesupport (>= 4.2.0) + marcel (~> 1.0.1) + mime-types + terrapin (~> 0.6.0) language_filter (0.3.01) libv8-node (16.10.0.0) libv8-node (16.10.0.0-x86_64-linux) @@ -1454,9 +1460,6 @@ GEM mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2021.0704) - mimemagic (0.3.10) - nokogiri (~> 1) - rake mini_magick (4.11.0) mini_mime (1.1.2) mini_portile2 (2.8.1) @@ -1487,12 +1490,6 @@ GEM opus-ruby (1.0.1) ffi orm_adapter (0.5.0) - paperclip (6.1.0) - activemodel (>= 4.2.0) - activesupport (>= 4.2.0) - mime-types - mimemagic (~> 0.3.0) - terrapin (~> 0.6.0) paranoia (2.6.1) activerecord (>= 5.1, < 7.1) paypal-checkout-sdk (1.0.4) @@ -1718,6 +1715,7 @@ DEPENDENCIES htmlentities ibm_watson image_processing + kt-paperclip language_filter listen material_icons @@ -1727,7 +1725,6 @@ DEPENDENCIES mini_racer (~> 0.6.3) newrelic_rpm onebox! - paperclip paranoia paypal-checkout-sdk paypal_client diff --git a/app/models/page_types/location.rb b/app/models/page_types/location.rb index b01ab1865..00410e5d8 100644 --- a/app/models/page_types/location.rb +++ b/app/models/page_types/location.rb @@ -9,10 +9,6 @@ class Location < ApplicationRecord acts_as_paranoid - # todo: clear these -- not used anymore - has_attached_file :map, styles: { original: '1920x1080>', thumb: '200x200>' } - validates_attachment_content_type :map, content_type: %r{\Aimage\/.*\Z} - validates :name, presence: true belongs_to :user diff --git a/db/migrate/20140713043535_create_models.rb b/db/migrate/20140713043535_create_models.rb index 4df7df1da..50a404a25 100644 --- a/db/migrate/20140713043535_create_models.rb +++ b/db/migrate/20140713043535_create_models.rb @@ -97,9 +97,6 @@ def change t.string :type_of t.text :description - # Map - t.attachment :map - # Culture t.string :population t.string :language diff --git a/db/migrate/20180110200009_upgrade_thredded_v0_14_to_v0_15.rb b/db/migrate/20180110200009_upgrade_thredded_v0_14_to_v0_15.rb index f6fbb554b..b0278e464 100644 --- a/db/migrate/20180110200009_upgrade_thredded_v0_14_to_v0_15.rb +++ b/db/migrate/20180110200009_upgrade_thredded_v0_14_to_v0_15.rb @@ -84,8 +84,8 @@ def change # rubocop:disable Metrics/MethodLength private def remove_string_limit(table, column, type: :text, indices: []) - indices.each { |(_, options)| remove_index table, name: options[:name] } + indices.each { |(index_args, options)| remove_index table, name: options[:name] } change_column table, column, type, limit: nil - indices.each { |args| add_index table, *args } + indices.each { |(index_args, options)| add_index table, index_args, **options } end end diff --git a/db/migrate/20180930063614_upgrade_thredded_v0_15_to_v0_16.rb b/db/migrate/20180930063614_upgrade_thredded_v0_15_to_v0_16.rb index 7d9255e80..7a3971682 100644 --- a/db/migrate/20180930063614_upgrade_thredded_v0_15_to_v0_16.rb +++ b/db/migrate/20180930063614_upgrade_thredded_v0_15_to_v0_16.rb @@ -4,6 +4,23 @@ class UpgradeThreddedV015ToV016 < Thredded::BaseMigration def up + # Add the deleted_at column and index if they don't already exist + unless column_exists?(:thredded_topics, :deleted_at) + add_column :thredded_topics, :deleted_at, :datetime + add_index :thredded_topics, :deleted_at + + add_index :thredded_topics, [:deleted_at, :messageboard_id] + add_index :thredded_topics, [:deleted_at, :user_id] + end + + unless column_exists?(:thredded_posts, :deleted_at) + add_column :thredded_posts, :deleted_at, :datetime + add_index :thredded_posts, :deleted_at + add_index :thredded_posts, [:deleted_at, :messageboard_id] + add_index :thredded_posts, [:deleted_at, :postable_id] + add_index :thredded_posts, [:deleted_at, :user_id] + end + %i[thredded_user_topic_read_states thredded_user_private_topic_read_states].each do |table_name| add_column table_name, :unread_posts_count, :integer, default: 0, null: false add_column table_name, :read_posts_count, :integer, default: 0, null: false diff --git a/db/migrate/20210308072329_add_deleted_at_date_times_to_thredded_tables.rb b/db/migrate/20210308072329_add_deleted_at_date_times_to_thredded_tables.rb deleted file mode 100644 index b6a900979..000000000 --- a/db/migrate/20210308072329_add_deleted_at_date_times_to_thredded_tables.rb +++ /dev/null @@ -1,14 +0,0 @@ -class AddDeletedAtDateTimesToThreddedTables < ActiveRecord::Migration[6.0] - def change - add_column :thredded_topics, :deleted_at, :datetime - add_index :thredded_topics, :deleted_at - add_index :thredded_topics, [:deleted_at, :messageboard_id] - add_index :thredded_topics, [:deleted_at, :user_id] - - add_column :thredded_posts, :deleted_at, :datetime - add_index :thredded_posts, :deleted_at - add_index :thredded_posts, [:deleted_at, :messageboard_id] - add_index :thredded_posts, [:deleted_at, :postable_id] - add_index :thredded_posts, [:deleted_at, :user_id] - end -end diff --git a/db/schema.rb b/db/schema.rb index 504221717..f20bb0a83 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -215,7 +215,7 @@ create_table "basil_feedbacks", force: :cascade do |t| t.integer "basil_commission_id", null: false t.integer "user_id", null: false - t.integer "score_adjustment" + t.integer "score_adjustment", default: 0 t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false t.index ["basil_commission_id"], name: "index_basil_feedbacks_on_basil_commission_id" @@ -1941,10 +1941,6 @@ t.string "name", null: false t.string "type_of" t.text "description" - t.string "map_file_name" - t.string "map_content_type" - t.integer "map_file_size" - t.datetime "map_updated_at" t.string "population" t.string "language" t.string "currency"