diff --git a/Gemfile b/Gemfile index 18979c09..86a1cf99 100644 --- a/Gemfile +++ b/Gemfile @@ -74,6 +74,8 @@ gem 'barnes' # Forum gem 'thredded', git: 'https://github.com/indentlabs/thredded.git', branch: 'feature/report-posts' +# gem 'thredded', git: 'https://github.com/thredded/thredded', branch: 'master' +# gem 'thredded', git: 'https://github.com/sudara/thredded', branch: 'master' gem 'rails-ujs' gem 'language_filter' diff --git a/Gemfile.lock b/Gemfile.lock index d29d4ec1..25c26e3f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1286,7 +1286,7 @@ GEM railties (>= 3.1) database_cleaner (2.0.1) database_cleaner-active_record (~> 2.0.0) - database_cleaner-active_record (2.0.0) + database_cleaner-active_record (2.0.1) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) @@ -1294,7 +1294,7 @@ GEM rails (> 4) db_text_search (0.3.2) activerecord (>= 4.1.15, < 7.0) - debug_inspector (1.0.0) + debug_inspector (1.1.0) devise (4.8.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -1308,7 +1308,7 @@ GEM erubi (1.10.0) eventmachine (1.2.7) execjs (2.8.1) - faraday (0.17.3) + faraday (0.17.4) multipart-post (>= 1.2, < 3) faraday_middleware (0.14.0) faraday (>= 0.7.4, < 1.0) @@ -1370,7 +1370,7 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - json (2.3.0) + json (2.5.1) jwt (2.2.3) kaminari (1.2.1) activesupport (>= 4.1.0) @@ -1409,7 +1409,7 @@ GEM method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2020.0512) + mime-types-data (3.2021.0704) mimemagic (0.3.10) nokogiri (~> 1) rake @@ -1588,7 +1588,7 @@ GEM terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) text-hyphen (1.4.1) - textstat (0.1.6) + textstat (0.1.7) text-hyphen (~> 1.4, >= 1.4.1) thor (1.1.0) tilt (2.0.10) diff --git a/app/models/users/user.rb b/app/models/users/user.rb index 9b761fc8..3c5528d1 100644 --- a/app/models/users/user.rb +++ b/app/models/users/user.rb @@ -293,7 +293,7 @@ class User < ApplicationRecord params.delete(:username) end - result = update_attributes(params, *options) + result = update(params, *options) clean_up_passwords result end diff --git a/app/views/layouts/forum.html.erb b/app/views/layouts/forum.html.erb index 1375a61a..2901e560 100644 --- a/app/views/layouts/forum.html.erb +++ b/app/views/layouts/forum.html.erb @@ -10,7 +10,7 @@ <%= javascript_include_tag 'thredded', async: !Rails.application.config.assets.debug, defer: true %> - <%== Gravatar.prefetch_dns %> + <%== RailsGravatar.prefetch_dns_tag %> <%= render 'layouts/sidenav' if user_signed_in? %> diff --git a/db/migrate/20210729092029_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20210729092029_add_service_name_to_active_storage_blobs.active_storage.rb new file mode 100644 index 00000000..9967a132 --- /dev/null +++ b/db/migrate/20210729092029_add_service_name_to_active_storage_blobs.active_storage.rb @@ -0,0 +1,18 @@ +# This migration comes from active_storage (originally 20190112182829) +class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] + def up + unless column_exists?(:active_storage_blobs, :service_name) + add_column :active_storage_blobs, :service_name, :string + + if configured_service = ActiveStorage::Blob.service.name + ActiveStorage::Blob.unscoped.update_all(service_name: configured_service) + end + + change_column :active_storage_blobs, :service_name, :string, null: false + end + end + + def down + remove_column :active_storage_blobs, :service_name + end +end diff --git a/db/migrate/20210729092030_create_active_storage_variant_records.active_storage.rb b/db/migrate/20210729092030_create_active_storage_variant_records.active_storage.rb new file mode 100644 index 00000000..a2862695 --- /dev/null +++ b/db/migrate/20210729092030_create_active_storage_variant_records.active_storage.rb @@ -0,0 +1,12 @@ +# This migration comes from active_storage (originally 20191206030411) +class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] + def change + create_table :active_storage_variant_records do |t| + t.belongs_to :blob, null: false, index: false + t.string :variation_digest, null: false + + t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end +end diff --git a/db/migrate/20211027065954_add_service_name_migration_again.rb b/db/migrate/20211027065954_add_service_name_migration_again.rb new file mode 100644 index 00000000..e352ceb9 --- /dev/null +++ b/db/migrate/20211027065954_add_service_name_migration_again.rb @@ -0,0 +1,17 @@ +class AddServiceNameMigrationAgain < ActiveRecord::Migration[6.1] + def up + unless column_exists?(:active_storage_blobs, :service_name) + add_column :active_storage_blobs, :service_name, :string + + if configured_service = ActiveStorage::Blob.service.name + ActiveStorage::Blob.unscoped.update_all(service_name: configured_service) + end + + change_column :active_storage_blobs, :service_name, :string, null: false + end + end + + def down + remove_column :active_storage_blobs, :service_name + end +end diff --git a/db/schema.rb b/db/schema.rb index f74e1526..187d87ad 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,15 +2,15 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# This file is the source Rails uses to define your schema when running `rails -# db:schema:load`. When creating a new database, `rails db:schema:load` tends to +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to # be faster and is potentially less error prone than running all of your # migrations from scratch. Old migrations may fail to apply correctly if those # migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_10_07_234707) do +ActiveRecord::Schema.define(version: 2021_10_27_065954) do create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false @@ -27,12 +27,19 @@ ActiveRecord::Schema.define(version: 2021_10_07_234707) do t.string "filename", null: false t.string "content_type" t.text "metadata" - t.bigint "byte_size", null: false + t.integer "byte_size", null: false t.string "checksum", null: false t.datetime "created_at", null: false + t.string "service_name", null: false t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end + create_table "active_storage_variant_records", force: :cascade do |t| + t.bigint "blob_id", null: false + t.string "variation_digest", null: false + t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true + end + create_table "api_keys", force: :cascade do |t| t.integer "user_id" t.string "key" @@ -3650,6 +3657,7 @@ ActiveRecord::Schema.define(version: 2021_10_07_234707) do end add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" + add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" add_foreign_key "api_keys", "users" add_foreign_key "api_requests", "application_integrations" add_foreign_key "api_requests", "integration_authorizations" diff --git a/lib/tasks/backfill.rake b/lib/tasks/backfill.rake index bd36c8ed..d8db6a3e 100644 --- a/lib/tasks/backfill.rake +++ b/lib/tasks/backfill.rake @@ -23,7 +23,7 @@ namespace :backfill do end end - task :most_used_attribute_word_counts: :environment do + task most_used_attribute_word_counts: :environment do word_counts = {} Attribute.where(word_count_cache: nil).group(:value).order('count_id DESC').limit(500).count(:id).each do |value, count| word_count = WordCountAnalyzer::Counter.new(