chatwoot/lib/tasks
Vinay Keerthi 059506b1db
feat: Add automatic favicon fetching for companies (#13013)
## Summary

This Enterprise-only feature automatically fetches a favicon for
companies created with a domain, and adds a batch task to backfill
missing avatars for existing companies. The flow only targets companies
that do not already have an attached avatar, so existing avatars are
left untouched.


## Demo 



https://github.com/user-attachments/assets/d050334e-769f-4e46-b6e7-f7423727a192



## What changed

- Added `Avatar::AvatarFromFaviconJob` to build a Google favicon URL
from the company domain and fetch it through `Avatar::AvatarFromUrlJob`
- Triggered favicon fetching from `Company` with `after_create_commit`
- Added `Companies::FetchAvatarsJob` to batch existing companies that
are missing avatars
- Added `companies:fetch_missing_avatars` under `enterprise/lib/tasks`
- Kept the company-specific implementation inside the Enterprise
boundary
- Stubbed the new favicon request in unrelated specs that now hit this
callback indirectly
- Updated a couple of CI-sensitive specs that were failing due to
callback side effects / reload-safe exception assertions

## How to verify

1. Create a company in Enterprise with a valid domain and no avatar.
2. Confirm that a favicon-based avatar gets attached shortly after
creation.
3. Create another company with a domain and an avatar already attached.
4. Confirm that the existing avatar is not replaced.
5. Run `companies:fetch_missing_avatars`.
6. Confirm that existing companies without avatars get one, while
companies that already have avatars remain unchanged.

## Notes

- This change does not refresh or overwrite existing company avatars
- Favicon fetching only runs for companies with a present domain
- The branch includes the latest `develop`

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Sojan Jose <sojan@pepalo.com>
2026-03-05 18:51:28 -08:00
..
dev feat: Add development variant toggle rake task (#11696) 2025-06-10 09:47:59 -04:00
ops feat: add cron job to remove orphan conversations (#13335) 2026-01-28 19:25:20 +05:30
.keep Initial Commit 2019-08-14 15:18:44 +05:30
apply_sla.rake fix: Prevent SLA deletion timeouts by moving to async job (#12944) 2025-12-10 12:28:47 +05:30
asset_clean.rake chore: Upgrade Tailwind CSS to 3.3.2 (#7380) 2023-06-26 11:27:16 -07:00
auto_annotate_models.rake feat: Standardize rich editor across all channels (#12600) 2025-12-08 14:43:45 +05:30
build.rake feat: Vite + vue 3 💚 (#10047) 2024-10-02 00:36:30 -07:00
bulk_conversations.rake fix: Prevent SLA deletion timeouts by moving to async job (#12944) 2025-12-10 12:28:47 +05:30
captain_chat.rake feat(ee): Captain custom http tools (#12584) 2025-10-06 07:53:15 -07:00
db_enhancements.rake fix: use supported access method for schema_format in Rails 7 (#11576) 2025-05-27 15:34:59 -06:00
download_report.rake feat: add report download task (#13250) 2026-01-19 18:31:52 +05:30
generate_test_data.rake chore: Generate test data for bulk insertion (#11229) 2025-05-06 11:13:11 +05:30
instance_id.rake feat: Report cwctl events to hub (#8009) 2023-10-10 09:16:03 +05:30
ip_lookup.rake fix: ip-lookup database lazy loading for all environments (#8052) 2024-10-22 23:18:30 -07:00
mfa.rake fix: Session controller to not generate auth tokens before mfa verification (#12487) 2025-09-23 19:13:47 +05:30
search_test_data.rake feat: Advanced Search Backend (#12917) 2026-01-07 15:30:49 +05:30
seed_reports_data.rake feat: label reports overview (#11194) 2025-06-11 14:35:46 +05:30
sidekiq_tasks.rake feat: Add rake task to clear ActionCable jobs (#9307) 2024-04-30 08:03:40 -07:00
swagger.rake feat: Update swagger to openapi 3.0.4, update request payloads with examples (#11533) 2025-05-22 17:57:12 +07:00