Rename `author_email` field to `author_identifier`
This commit is contained in:
parent
37732ff926
commit
1a68c1b46f
|
@ -1,5 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "digest"
|
||||
require "errors"
|
||||
|
||||
class Ajax::QuestionController < AjaxController
|
||||
|
@ -36,6 +37,7 @@ class Ajax::QuestionController < AjaxController
|
|||
begin
|
||||
question = Question.create!(content: params[:question],
|
||||
author_is_anonymous: is_never_anonymous ? false : params[:anonymousQuestion],
|
||||
author_identifier: Digest::SHA2.new(512).hexdigest(Rails.application.secret_key_base + request.ip),
|
||||
user: current_user,
|
||||
direct: params[:rcpt] != 'followers')
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class RenameAuthorEmailToAuthorIdentifier < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
rename_column :questions, :author_email, :author_identifier
|
||||
end
|
||||
end
|
16
db/schema.rb
16
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_04_15_193829) do
|
||||
ActiveRecord::Schema.define(version: 2022_06_13_221551) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -39,6 +39,18 @@ ActiveRecord::Schema.define(version: 2022_04_15_193829) do
|
|||
t.index ["user_id", "created_at"], name: "index_answers_on_user_id_and_created_at"
|
||||
end
|
||||
|
||||
create_table "appendables", force: :cascade do |t|
|
||||
t.string "type", null: false
|
||||
t.bigint "user_id", null: false
|
||||
t.bigint "parent_id", null: false
|
||||
t.string "parent_type", null: false
|
||||
t.text "content"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["parent_id", "parent_type"], name: "index_appendables_on_parent_id_and_parent_type"
|
||||
t.index ["user_id", "created_at"], name: "index_appendables_on_user_id_and_created_at"
|
||||
end
|
||||
|
||||
create_table "comment_smiles", id: :bigint, default: -> { "gen_timestamp_id('comment_smiles'::text)" }, force: :cascade do |t|
|
||||
t.bigint "user_id"
|
||||
t.bigint "comment_id"
|
||||
|
@ -143,7 +155,7 @@ ActiveRecord::Schema.define(version: 2022_04_15_193829) do
|
|||
t.string "content"
|
||||
t.boolean "author_is_anonymous"
|
||||
t.string "author_name"
|
||||
t.string "author_email"
|
||||
t.string "author_identifier"
|
||||
t.bigint "user_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
|
|
Loading…
Reference in New Issue