15 Commits

Author SHA1 Message Date
Shivam Mishra
c88447c11f feat: invalidate cache after inbox members or team members update (#10869)
At the moment, when updating the inbox members, or team members the
account cache used for IndexedDB is not invalidated. This can cause
inconsistencies in the UI. This PR fixes this by adding explicit
invalidation after performing the member changes

### Summary of changes

1. Added a new method `add_members` and `remove_members` to both `team`
and `inbox` models. The change was necessary for two reasons
- Since the individual `add_member` and `remove_member` is called in a
loop, it's wasteful to run the cache invalidation in the method.
- Moving the account cache invalidation call in the controller pollutes
the controller business logic
2. Updated tests across the board

### More improvements

We can make a concern called `Memberable` with usage like
`memberable_with :inbox_members`, that can encapsulate the functionality

---

Related: https://github.com/chatwoot/chatwoot/issues/10578
2025-02-20 21:28:38 -08:00
Vishnu Narayanan
9ff5978d6e feat: Add audit trail events for team (#7285) 2023-06-09 17:30:36 -07:00
Shivam Mishra
00ee0478eb feat: IndexedDB based caching for labels, inboxes and teams [CW-50] (#6710)
* feat: allow caching of labels in the account scope

* feat: send cache keys in account json response

* feat: kickstart web worker

* feat: setup basic architecture for workers

* feat: install idb

* feat: add datamanger

* fix: typos

* refactor: rename method

* feat: make init db a manual step

* refactor: separate accountIdFromRoute

* feat: cache enabled API client

* feat: enable caching for inboxes and labels

* feat: enable cache for team

* feat: manage exceptions for team

* feat: add team to data manager

* feat: add a generic listener

* refactor: send only cache keys

* refactor: separate validate method

* feat: add listeners

* feat: add event for revalidate

* feat: add cache keys endpoint

* refactor: fetch cache keys instead of full account data

* fix: key pattern

* feat: don't fetch account for cache_keys

* fix: cache key base class

* refactor: cache keys helper

* feat: add helper

* fix: cache-key update logic

* feat: delete indexeddb on logout

* feat: remove worker.js

* refactor: move data-manager

* refactor: name of file

* feat: add test for DataManager

* refactor: add fake idb to jest setup

* test: cache keys helper

* test: cache keys helper

* test: cache_keys in accounts controller

* refactor: remove cache_keys context

* feat: add policy for cache-keys
2023-03-27 12:16:25 +05:30
Tejaswini Chile
2397326324 fix: Auto populate team after assigned via API (#5250) 2022-08-12 13:40:28 +05:30
Sojan Jose
74fdfffe08 fix: Notification page breakages (#5236)
- Remove the cascading foreign key indexes
- Add migration to clean up existing objects

fixes: #4285
2022-08-10 13:46:46 +02:00
Sojan Jose
4187428729 chore: Update dependencies to the latest versions (#5033) 2022-07-15 09:51:59 +07:00
Jordan Brough
c2647a1f27 chore: Use "destroy!" instead of "destroy" when not checking the return value (#4259) 2022-03-24 13:28:25 +05:30
Sojan Jose
4260441f8c Chore: clean up Reporting Events (#4044)
Tech debt clean up

Fixes #4057

Co-authored-by: Aswin Dev P S <aswin@chatwoot.com>
2022-02-28 18:16:12 +05:30
Sojan Jose
8d65608666 chore: Clean up migrations (#3613)
Fixes: #3530
2021-12-19 09:47:07 +05:30
Akhil G Krishnan
b81a9f2010 Chore: Replaced dependent destroy with dependent destroy_async in all models (#3249) 2021-11-18 10:32:29 +05:30
Aswin Dev P.S
15aaa8883c feat: API to Filter reports by teams (#3066)
Add API to Filter reports by teams

Fixes: #2916
2021-09-27 21:12:08 +05:30
Sojan Jose
c95ad8dd4f chore: Remove validation on team name (#2014) 2021-03-30 16:02:41 +05:30
Nithin David Thomas
1484849cc7 chore: Update method for team members (#1734)
Co-authored-by: Sojan Jose <sojan@pepalo.com>
2021-02-09 19:21:31 +05:30
Sojan Jose
f9c3b7f2f1 feat: Bulk add team members in Team APIs (#1695) 2021-01-29 12:34:52 +05:30
Sojan Jose
a0c33254e7 feat: Team APIs (#1654)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2021-01-17 23:56:56 +05:30