chatwoot/spec
Sojan Jose 1d2f3e86dd
feat(companies): track company last activity (#14435)
Tracks company recency from linked contact activity so the Companies
list and detail page can show/sort by real customer engagement instead
of generic record updates.

## Closes

None.

## Why

Company recency should reflect activity from people associated with the
company. This keeps the signal tied to persisted contact activity,
without treating passive online presence or widget heartbeat pings as
company activity.

## What Changed

- Adds a company helper to record `last_activity_at` from linked contact
activity.
- Rolls up `Contact#last_activity_at` changes to the associated company.
- Initializes company activity when an already-active contact is
associated with a company, including the business-email auto-association
path.
- Throttles company activity rollups to once every 5 minutes per company
to avoid unnecessary writes during active conversations.
- Treats company activity as monotonic: unlinking, moving, or deleting
contacts does not move a company's activity timestamp backwards.
- Leaves historical backfill, online presence tracking, widget visit
tracking, and richer activity attribution out of scope.

## How to Test

1. Open an account with Companies enabled and visit the Companies list.
2. Trigger activity for a contact that belongs to a company, for example
by receiving or sending a message in that contact's conversation.
3. Confirm the linked company shows a recent activity timestamp in the
Companies list/detail page after the contact activity updates.
4. Associate an already-active contact with a company and confirm the
company receives that contact's existing activity timestamp.
5. Confirm repeated contact activity within a short window does not
continuously rewrite the company timestamp.

---------

Co-authored-by: Sony Mathew <2040199+sony-mathew@users.noreply.github.com>
2026-05-18 15:01:05 +05:30
..
actions fix: Skip redundant contact saves in ContactIdentifyAction (#13778) 2026-03-11 21:40:38 -07:00
assets fix: standardize contact company field on company_name (#14099) 2026-04-27 18:43:26 +05:30
builders feat: enable quoted reply for everyone (#14469) 2026-05-15 10:59:48 -07:00
channels fix: Move contact events to account stream rather than individual user stream (#11082) 2025-03-13 17:46:48 -07:00
config feat: add GuideJar embed support in HC (#13944) 2026-03-30 14:19:02 +05:30
configs chore: Enable the new Rubocop rules (#7122) 2023-05-19 14:37:10 +05:30
controllers fix: validate OpenAI hook credentials (#14068) 2026-05-18 14:08:57 +05:30
dispatchers Non blocking event dispatch (#652) 2020-03-29 19:18:30 +05:30
drops feat: Add the support for custom attributes in message variables (#8511) 2023-12-08 14:13:35 -08:00
enterprise feat(companies): track company last activity (#14435) 2026-05-18 15:01:05 +05:30
factories feat: Ability to specify the authentication type for imap server (#12306) 2026-05-08 16:40:15 +05:30
finders feat(rollup): report builder abstraction [2/3] (#13798) 2026-04-20 11:15:48 +05:30
fixtures fix(mailbox): render inline images without Content-Disposition (#11949) 2026-05-06 18:56:31 +05:30
helpers chore: Refactor UTM params to stay compliant with standards (#12312) 2025-08-29 11:46:52 -07:00
integration Fix url in emails, add frontendURL helper (#19) 2019-08-25 19:59:28 +05:30
jobs fix: validate OpenAI hook credentials (#14068) 2026-05-18 14:08:57 +05:30
lib fix: validate OpenAI hook credentials (#14068) 2026-05-18 14:08:57 +05:30
listeners feat(linear): Auto link Linear issues from private notes (#14405) 2026-05-12 13:03:40 +04:00
mailboxes fix(mailbox): render inline images without Content-Disposition (#11949) 2026-05-06 18:56:31 +05:30
mailers fix: validate OpenAI hook credentials (#14068) 2026-05-18 14:08:57 +05:30
models fix: validate OpenAI hook credentials (#14068) 2026-05-18 14:08:57 +05:30
policies chore: Enforce custom role permissions on conversation access (#12583) 2025-10-22 20:23:37 -07:00
presenters fix: index email subject from conversation for outbound messages (#14122) 2026-04-22 20:36:35 +05:30
requests/api/v1 feat: allow disabling 2FA with a backup code (#14102) 2026-04-28 10:09:41 +07:00
services fix: prevent bot metrics double-counting when handoff and resolution coexist [CW-6210] (#14032) 2026-05-13 18:43:23 +05:30
support feat: Advanced Search Backend (#12917) 2026-01-07 15:30:49 +05:30
swagger feat: validate OpenAPI spec using Skooma (#13623) 2026-03-10 18:33:55 -07:00
coverage_helper.rb ci(circleci): switch coverage reporting to Qlty orb (#12337) 2025-08-31 00:39:34 +05:30
rails_helper.rb feat: validate OpenAPI spec using Skooma (#13623) 2026-03-10 18:33:55 -07:00
spec_helper.rb ci(circleci): switch coverage reporting to Qlty orb (#12337) 2025-08-31 00:39:34 +05:30
test_helper.rb ci(circleci): switch coverage reporting to Qlty orb (#12337) 2025-08-31 00:39:34 +05:30