diff --git a/app/controllers/api/v1/profiles_controller.rb b/app/controllers/api/v1/profiles_controller.rb index c810500f9..fb9c3b62c 100644 --- a/app/controllers/api/v1/profiles_controller.rb +++ b/app/controllers/api/v1/profiles_controller.rb @@ -39,7 +39,6 @@ class Api::V1::ProfilesController < Api::BaseController :display_name, :avatar, :message_signature, - :message_signature_enabled, ui_settings: {} ) end diff --git a/app/javascript/dashboard/api/auth.js b/app/javascript/dashboard/api/auth.js index 189d1c198..7079614c1 100644 --- a/app/javascript/dashboard/api/auth.js +++ b/app/javascript/dashboard/api/auth.js @@ -138,6 +138,7 @@ export default { password, password_confirmation, displayName, + avatar, ...profileAttributes }) { const formData = new FormData(); @@ -152,6 +153,9 @@ export default { formData.append('profile[password]', password); formData.append('profile[password_confirmation]', password_confirmation); } + if (avatar) { + formData.append('profile[avatar]', avatar); + } return axios.put(endPoints('profileUpdate').url, formData); }, diff --git a/app/javascript/dashboard/routes/dashboard/settings/profile/MessageSignature.vue b/app/javascript/dashboard/routes/dashboard/settings/profile/MessageSignature.vue index 4343b772d..e08e4fdee 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/profile/MessageSignature.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/profile/MessageSignature.vue @@ -89,7 +89,6 @@ export default { try { await this.$store.dispatch('updateProfile', { message_signature: this.messageSignature, - message_signature_enabled: true, }); this.errorMessage = this.$t( 'PROFILE_SETTINGS.FORM.MESSAGE_SIGNATURE_SECTION.API_SUCCESS' diff --git a/app/models/super_admin.rb b/app/models/super_admin.rb index 2ce658000..f41610ee4 100644 --- a/app/models/super_admin.rb +++ b/app/models/super_admin.rb @@ -2,35 +2,34 @@ # # Table name: users # -# id :integer not null, primary key -# availability :integer default("online") -# confirmation_sent_at :datetime -# confirmation_token :string -# confirmed_at :datetime -# current_sign_in_at :datetime -# current_sign_in_ip :string -# custom_attributes :jsonb -# display_name :string -# email :string -# encrypted_password :string default(""), not null -# last_sign_in_at :datetime -# last_sign_in_ip :string -# message_signature :text -# message_signature_enabled :boolean default(FALSE), not null -# name :string not null -# provider :string default("email"), not null -# pubsub_token :string -# remember_created_at :datetime -# reset_password_sent_at :datetime -# reset_password_token :string -# sign_in_count :integer default(0), not null -# tokens :json -# type :string -# ui_settings :jsonb -# uid :string default(""), not null -# unconfirmed_email :string -# created_at :datetime not null -# updated_at :datetime not null +# id :integer not null, primary key +# availability :integer default("online") +# confirmation_sent_at :datetime +# confirmation_token :string +# confirmed_at :datetime +# current_sign_in_at :datetime +# current_sign_in_ip :string +# custom_attributes :jsonb +# display_name :string +# email :string +# encrypted_password :string default(""), not null +# last_sign_in_at :datetime +# last_sign_in_ip :string +# message_signature :text +# name :string not null +# provider :string default("email"), not null +# pubsub_token :string +# remember_created_at :datetime +# reset_password_sent_at :datetime +# reset_password_token :string +# sign_in_count :integer default(0), not null +# tokens :json +# type :string +# ui_settings :jsonb +# uid :string default(""), not null +# unconfirmed_email :string +# created_at :datetime not null +# updated_at :datetime not null # # Indexes # diff --git a/app/models/user.rb b/app/models/user.rb index d28c40d6a..cbb06b39a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,35 +2,34 @@ # # Table name: users # -# id :integer not null, primary key -# availability :integer default("online") -# confirmation_sent_at :datetime -# confirmation_token :string -# confirmed_at :datetime -# current_sign_in_at :datetime -# current_sign_in_ip :string -# custom_attributes :jsonb -# display_name :string -# email :string -# encrypted_password :string default(""), not null -# last_sign_in_at :datetime -# last_sign_in_ip :string -# message_signature :text -# message_signature_enabled :boolean default(FALSE), not null -# name :string not null -# provider :string default("email"), not null -# pubsub_token :string -# remember_created_at :datetime -# reset_password_sent_at :datetime -# reset_password_token :string -# sign_in_count :integer default(0), not null -# tokens :json -# type :string -# ui_settings :jsonb -# uid :string default(""), not null -# unconfirmed_email :string -# created_at :datetime not null -# updated_at :datetime not null +# id :integer not null, primary key +# availability :integer default("online") +# confirmation_sent_at :datetime +# confirmation_token :string +# confirmed_at :datetime +# current_sign_in_at :datetime +# current_sign_in_ip :string +# custom_attributes :jsonb +# display_name :string +# email :string +# encrypted_password :string default(""), not null +# last_sign_in_at :datetime +# last_sign_in_ip :string +# message_signature :text +# name :string not null +# provider :string default("email"), not null +# pubsub_token :string +# remember_created_at :datetime +# reset_password_sent_at :datetime +# reset_password_token :string +# sign_in_count :integer default(0), not null +# tokens :json +# type :string +# ui_settings :jsonb +# uid :string default(""), not null +# unconfirmed_email :string +# created_at :datetime not null +# updated_at :datetime not null # # Indexes # diff --git a/app/views/api/v1/models/_user.json.jbuilder b/app/views/api/v1/models/_user.json.jbuilder index a2f80e1f4..4fc857ae7 100644 --- a/app/views/api/v1/models/_user.json.jbuilder +++ b/app/views/api/v1/models/_user.json.jbuilder @@ -4,7 +4,6 @@ json.available_name resource.available_name json.avatar_url resource.avatar_url json.confirmed resource.confirmed? json.display_name resource.display_name -json.message_signature_enabled resource.message_signature_enabled json.message_signature resource.message_signature json.email resource.email json.hmac_identifier resource.hmac_identifier if GlobalConfig.get('CHATWOOT_INBOX_HMAC_KEY')['CHATWOOT_INBOX_HMAC_KEY'].present? diff --git a/app/views/platform/api/v1/models/_user.json.jbuilder b/app/views/platform/api/v1/models/_user.json.jbuilder index fcc151e02..7cf39416a 100644 --- a/app/views/platform/api/v1/models/_user.json.jbuilder +++ b/app/views/platform/api/v1/models/_user.json.jbuilder @@ -4,7 +4,6 @@ json.available_name resource.available_name json.avatar_url resource.avatar_url json.confirmed resource.confirmed? json.display_name resource.display_name -json.message_signature_enabled resource.message_signature_enabled json.message_signature resource.message_signature json.email resource.email json.id resource.id diff --git a/db/migrate/20220215060751_remove_message_signature_enabled.rb b/db/migrate/20220215060751_remove_message_signature_enabled.rb new file mode 100644 index 000000000..e627ba34f --- /dev/null +++ b/db/migrate/20220215060751_remove_message_signature_enabled.rb @@ -0,0 +1,5 @@ +class RemoveMessageSignatureEnabled < ActiveRecord::Migration[6.1] + def change + remove_column :users, :message_signature_enabled, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 5c16d1e87..b1f6775b3 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_31_081750) do +ActiveRecord::Schema.define(version: 2022_02_15_060751) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" @@ -664,20 +664,6 @@ ActiveRecord::Schema.define(version: 2022_01_31_081750) do t.datetime "updated_at", precision: 6, null: false end - create_table "super_admins", force: :cascade do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.inet "current_sign_in_ip" - t.inet "last_sign_in_ip" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.index ["email"], name: "index_super_admins_on_email", unique: true - end - create_table "taggings", id: :serial, force: :cascade do |t| t.integer "tag_id" t.string "taggable_type" @@ -759,7 +745,6 @@ ActiveRecord::Schema.define(version: 2022_01_31_081750) do t.jsonb "ui_settings", default: {} t.jsonb "custom_attributes", default: {} t.string "type" - t.boolean "message_signature_enabled", default: false, null: false t.text "message_signature" t.index ["email"], name: "index_users_on_email" t.index ["pubsub_token"], name: "index_users_on_pubsub_token", unique: true diff --git a/spec/controllers/api/v1/profiles_controller_spec.rb b/spec/controllers/api/v1/profiles_controller_spec.rb index 77cd77bfe..4f6cfaeb0 100644 --- a/spec/controllers/api/v1/profiles_controller_spec.rb +++ b/spec/controllers/api/v1/profiles_controller_spec.rb @@ -27,7 +27,6 @@ RSpec.describe 'Profile API', type: :request do expect(json_response['access_token']).to eq(agent.access_token.token) expect(json_response['custom_attributes']['test']).to eq('test') expect(json_response['message_signature']).to be_nil - expect(json_response['message_signature_enabled']).to be_falsey end end end @@ -60,7 +59,7 @@ RSpec.describe 'Profile API', type: :request do it 'updates the message_signature' do put '/api/v1/profile', - params: { profile: { name: 'test', message_signature: 'Thanks\nMy Signature', message_signature_enabled: true } }, + params: { profile: { name: 'test', message_signature: 'Thanks\nMy Signature' } }, headers: agent.create_new_auth_token, as: :json @@ -71,7 +70,6 @@ RSpec.describe 'Profile API', type: :request do expect(json_response['name']).to eq(agent.name) expect(agent.name).to eq('test') expect(json_response['message_signature']).to eq('Thanks\nMy Signature') - expect(json_response['message_signature_enabled']).to be_truthy end it 'updates the password when current password is provided' do