chore: Ability to Disable Gravatars (#5027)

fixes: #3853

- Introduced DISABLE_GRAVATAR Global Config, which will stop chatwoot from making API requests to gravatar
- Cleaned up avatar-related logic and centralized it into the avatarable concern
- Added specs for the missing cases
- Added migration for existing installations to move the avatar to attachment, rather than making the API that results in 404.
This commit is contained in:
Sojan Jose
2022-07-21 19:27:12 +02:00
committed by GitHub
parent 6105567238
commit 6a6a37a67b
25 changed files with 225 additions and 83 deletions

View File

@@ -2,6 +2,8 @@
require 'rails_helper'
require Rails.root.join 'spec/models/concerns/avatarable_shared.rb'
RSpec.describe Contact do
context 'validations' do
it { is_expected.to validate_presence_of(:account_id) }
@@ -12,6 +14,10 @@ RSpec.describe Contact do
it { is_expected.to have_many(:conversations).dependent(:destroy_async) }
end
describe 'concerns' do
it_behaves_like 'avatarable'
end
context 'prepare contact attributes before validation' do
it 'sets email to lowercase' do
contact = create(:contact, email: 'Test@test.com')