mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 02:57:57 +00:00 
			
		
		
		
	fix: Update account data seeder to avoid invalid information (#7673)
- The message sender was incorrect. Incoming messages were created under the contact's name, and outgoing messages were created under the user's name instead of the reverse. - The seed user's email address was incorrect in the message data. - The Sendmail configuration overrode the Letter Opener config which made it difficult to test the email. - This PR also fixes an ESLint lint issue on develop.
This commit is contained in:
		| @@ -54,7 +54,10 @@ | |||||||
|       > |       > | ||||||
|         {{ campaign.trigger_rules.url }} |         {{ campaign.trigger_rules.url }} | ||||||
|       </div> |       </div> | ||||||
|       <div v-if="campaign.scheduled_at" class="text-xs text-slate-700 dark:text-slate-500 mb-1"> |       <div | ||||||
|  |         v-if="campaign.scheduled_at" | ||||||
|  |         class="text-xs text-slate-700 dark:text-slate-500 mb-1" | ||||||
|  |       > | ||||||
|         {{ messageStamp(new Date(campaign.scheduled_at), 'LLL d, h:mm a') }} |         {{ messageStamp(new Date(campaign.scheduled_at), 'LLL d, h:mm a') }} | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|   | |||||||
| @@ -27,12 +27,13 @@ Rails.application.configure do | |||||||
|  |  | ||||||
|   config.action_mailer.delivery_method = :smtp unless Rails.env.test? |   config.action_mailer.delivery_method = :smtp unless Rails.env.test? | ||||||
|   config.action_mailer.smtp_settings = smtp_settings |   config.action_mailer.smtp_settings = smtp_settings | ||||||
|   # You can use letter opener for your local development by setting the environment variable |  | ||||||
|   config.action_mailer.delivery_method = :letter_opener if Rails.env.development? && ENV['LETTER_OPENER'] |  | ||||||
|  |  | ||||||
|   # Use sendmail if using postfix for email |   # Use sendmail if using postfix for email | ||||||
|   config.action_mailer.delivery_method = :sendmail if ENV['SMTP_ADDRESS'].blank? |   config.action_mailer.delivery_method = :sendmail if ENV['SMTP_ADDRESS'].blank? | ||||||
|  |  | ||||||
|  |   # You can use letter opener for your local development by setting the environment variable | ||||||
|  |   config.action_mailer.delivery_method = :letter_opener if Rails.env.development? && ENV['LETTER_OPENER'] | ||||||
|  |  | ||||||
|   ######################################### |   ######################################### | ||||||
|   # Configuration Related to Action MailBox |   # Configuration Related to Action MailBox | ||||||
|   ######################################### |   ######################################### | ||||||
|   | |||||||
| @@ -96,16 +96,19 @@ class Seeders::AccountSeeder | |||||||
|   def create_messages(conversation:, messages:) |   def create_messages(conversation:, messages:) | ||||||
|     messages.each do |message_data| |     messages.each do |message_data| | ||||||
|       sender = find_message_sender(conversation, message_data) |       sender = find_message_sender(conversation, message_data) | ||||||
|       conversation.messages.create!(message_data.slice('content', 'message_type').merge(account: conversation.inbox.account, sender: sender, |       conversation.messages.create!( | ||||||
|                                                                                         inbox: conversation.inbox)) |         message_data.slice('content', 'message_type').merge( | ||||||
|  |           account: conversation.inbox.account, sender: sender, inbox: conversation.inbox | ||||||
|  |         ) | ||||||
|  |       ) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def find_message_sender(conversation, message_data) |   def find_message_sender(conversation, message_data) | ||||||
|     if message_data['message_type'] == 'incoming' |     if message_data['message_type'] == 'incoming' | ||||||
|       User.find_by(email: message_data['sender']) if message_data['sender'].present? |  | ||||||
|     else |  | ||||||
|       conversation.contact |       conversation.contact | ||||||
|  |     elsif message_data['sender'].present? | ||||||
|  |       User.find_by(email: message_data['sender']) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ company: | |||||||
| users: | users: | ||||||
|   - name: 'Michael Scott' |   - name: 'Michael Scott' | ||||||
|     gender: male |     gender: male | ||||||
|     email: 'michale@paperlayer.test' |     email: 'michael_scott@paperlayer.test' | ||||||
|     team: |     team: | ||||||
|       - 'sales' |       - 'sales' | ||||||
|       - 'management' |       - 'management' | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Pranav Raj S
					Pranav Raj S