mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 02:57:57 +00:00 
			
		
		
		
	chore: Remove message_signature_enabled from users (#3982)
This commit is contained in:
		| @@ -39,7 +39,6 @@ class Api::V1::ProfilesController < Api::BaseController | |||||||
|       :display_name, |       :display_name, | ||||||
|       :avatar, |       :avatar, | ||||||
|       :message_signature, |       :message_signature, | ||||||
|       :message_signature_enabled, |  | ||||||
|       ui_settings: {} |       ui_settings: {} | ||||||
|     ) |     ) | ||||||
|   end |   end | ||||||
|   | |||||||
| @@ -138,6 +138,7 @@ export default { | |||||||
|     password, |     password, | ||||||
|     password_confirmation, |     password_confirmation, | ||||||
|     displayName, |     displayName, | ||||||
|  |     avatar, | ||||||
|     ...profileAttributes |     ...profileAttributes | ||||||
|   }) { |   }) { | ||||||
|     const formData = new FormData(); |     const formData = new FormData(); | ||||||
| @@ -152,6 +153,9 @@ export default { | |||||||
|       formData.append('profile[password]', password); |       formData.append('profile[password]', password); | ||||||
|       formData.append('profile[password_confirmation]', password_confirmation); |       formData.append('profile[password_confirmation]', password_confirmation); | ||||||
|     } |     } | ||||||
|  |     if (avatar) { | ||||||
|  |       formData.append('profile[avatar]', avatar); | ||||||
|  |     } | ||||||
|     return axios.put(endPoints('profileUpdate').url, formData); |     return axios.put(endPoints('profileUpdate').url, formData); | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -89,7 +89,6 @@ export default { | |||||||
|       try { |       try { | ||||||
|         await this.$store.dispatch('updateProfile', { |         await this.$store.dispatch('updateProfile', { | ||||||
|           message_signature: this.messageSignature, |           message_signature: this.messageSignature, | ||||||
|           message_signature_enabled: true, |  | ||||||
|         }); |         }); | ||||||
|         this.errorMessage = this.$t( |         this.errorMessage = this.$t( | ||||||
|           'PROFILE_SETTINGS.FORM.MESSAGE_SIGNATURE_SECTION.API_SUCCESS' |           'PROFILE_SETTINGS.FORM.MESSAGE_SIGNATURE_SECTION.API_SUCCESS' | ||||||
|   | |||||||
| @@ -16,7 +16,6 @@ | |||||||
| #  last_sign_in_at        :datetime | #  last_sign_in_at        :datetime | ||||||
| #  last_sign_in_ip        :string | #  last_sign_in_ip        :string | ||||||
| #  message_signature      :text | #  message_signature      :text | ||||||
| #  message_signature_enabled :boolean          default(FALSE), not null |  | ||||||
| #  name                   :string           not null | #  name                   :string           not null | ||||||
| #  provider               :string           default("email"), not null | #  provider               :string           default("email"), not null | ||||||
| #  pubsub_token           :string | #  pubsub_token           :string | ||||||
|   | |||||||
| @@ -16,7 +16,6 @@ | |||||||
| #  last_sign_in_at        :datetime | #  last_sign_in_at        :datetime | ||||||
| #  last_sign_in_ip        :string | #  last_sign_in_ip        :string | ||||||
| #  message_signature      :text | #  message_signature      :text | ||||||
| #  message_signature_enabled :boolean          default(FALSE), not null |  | ||||||
| #  name                   :string           not null | #  name                   :string           not null | ||||||
| #  provider               :string           default("email"), not null | #  provider               :string           default("email"), not null | ||||||
| #  pubsub_token           :string | #  pubsub_token           :string | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ json.available_name resource.available_name | |||||||
| json.avatar_url resource.avatar_url | json.avatar_url resource.avatar_url | ||||||
| json.confirmed resource.confirmed? | json.confirmed resource.confirmed? | ||||||
| json.display_name resource.display_name | json.display_name resource.display_name | ||||||
| json.message_signature_enabled resource.message_signature_enabled |  | ||||||
| json.message_signature resource.message_signature | json.message_signature resource.message_signature | ||||||
| json.email resource.email | json.email resource.email | ||||||
| json.hmac_identifier resource.hmac_identifier if GlobalConfig.get('CHATWOOT_INBOX_HMAC_KEY')['CHATWOOT_INBOX_HMAC_KEY'].present? | json.hmac_identifier resource.hmac_identifier if GlobalConfig.get('CHATWOOT_INBOX_HMAC_KEY')['CHATWOOT_INBOX_HMAC_KEY'].present? | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ json.available_name resource.available_name | |||||||
| json.avatar_url resource.avatar_url | json.avatar_url resource.avatar_url | ||||||
| json.confirmed resource.confirmed? | json.confirmed resource.confirmed? | ||||||
| json.display_name resource.display_name | json.display_name resource.display_name | ||||||
| json.message_signature_enabled resource.message_signature_enabled |  | ||||||
| json.message_signature resource.message_signature | json.message_signature resource.message_signature | ||||||
| json.email resource.email | json.email resource.email | ||||||
| json.id resource.id | json.id resource.id | ||||||
|   | |||||||
| @@ -0,0 +1,5 @@ | |||||||
|  | class RemoveMessageSignatureEnabled < ActiveRecord::Migration[6.1] | ||||||
|  |   def change | ||||||
|  |     remove_column :users, :message_signature_enabled, :boolean | ||||||
|  |   end | ||||||
|  | end | ||||||
							
								
								
									
										17
									
								
								db/schema.rb
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								db/schema.rb
									
									
									
									
									
								
							| @@ -10,7 +10,7 @@ | |||||||
| # | # | ||||||
| # It's strongly recommended that you check this file into your version control system. | # 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 |   # These are extensions that must be enabled in order to support this database | ||||||
|   enable_extension "pg_stat_statements" |   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 |     t.datetime "updated_at", precision: 6, null: false | ||||||
|   end |   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| |   create_table "taggings", id: :serial, force: :cascade do |t| | ||||||
|     t.integer "tag_id" |     t.integer "tag_id" | ||||||
|     t.string "taggable_type" |     t.string "taggable_type" | ||||||
| @@ -759,7 +745,6 @@ ActiveRecord::Schema.define(version: 2022_01_31_081750) do | |||||||
|     t.jsonb "ui_settings", default: {} |     t.jsonb "ui_settings", default: {} | ||||||
|     t.jsonb "custom_attributes", default: {} |     t.jsonb "custom_attributes", default: {} | ||||||
|     t.string "type" |     t.string "type" | ||||||
|     t.boolean "message_signature_enabled", default: false, null: false |  | ||||||
|     t.text "message_signature" |     t.text "message_signature" | ||||||
|     t.index ["email"], name: "index_users_on_email" |     t.index ["email"], name: "index_users_on_email" | ||||||
|     t.index ["pubsub_token"], name: "index_users_on_pubsub_token", unique: true |     t.index ["pubsub_token"], name: "index_users_on_pubsub_token", unique: true | ||||||
|   | |||||||
| @@ -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['access_token']).to eq(agent.access_token.token) | ||||||
|         expect(json_response['custom_attributes']['test']).to eq('test') |         expect(json_response['custom_attributes']['test']).to eq('test') | ||||||
|         expect(json_response['message_signature']).to be_nil |         expect(json_response['message_signature']).to be_nil | ||||||
|         expect(json_response['message_signature_enabled']).to be_falsey |  | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| @@ -60,7 +59,7 @@ RSpec.describe 'Profile API', type: :request do | |||||||
|  |  | ||||||
|       it 'updates the message_signature' do |       it 'updates the message_signature' do | ||||||
|         put '/api/v1/profile', |         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, |             headers: agent.create_new_auth_token, | ||||||
|             as: :json |             as: :json | ||||||
|  |  | ||||||
| @@ -71,7 +70,6 @@ RSpec.describe 'Profile API', type: :request do | |||||||
|         expect(json_response['name']).to eq(agent.name) |         expect(json_response['name']).to eq(agent.name) | ||||||
|         expect(agent.name).to eq('test') |         expect(agent.name).to eq('test') | ||||||
|         expect(json_response['message_signature']).to eq('Thanks\nMy Signature') |         expect(json_response['message_signature']).to eq('Thanks\nMy Signature') | ||||||
|         expect(json_response['message_signature_enabled']).to be_truthy |  | ||||||
|       end |       end | ||||||
|  |  | ||||||
|       it 'updates the password when current password is provided' do |       it 'updates the password when current password is provided' do | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Pranav Raj S
					Pranav Raj S