feat: manage contacts

- New permission `contacts:manage`
- Views for contact list and single contact view.
- Ability to block contacts that in inturn stops new messages from the contact.
- Make all DB transactions that run dynamically generated SQL query `readonly`
- Rename `/admin/teams/users` to `/admin/users/agents/` for consistency. (ref #50)
- Fix UI glitches for long emails (refs #54)
- Fix empty created_at date for agents admin table (refs #51)
- Migrations for v0.6.0
This commit is contained in:
Abhinav Raut
2025-04-10 04:13:11 +05:30
parent 576c678403
commit b2a53b18d5
32 changed files with 243 additions and 163 deletions

View File

@@ -64,5 +64,16 @@ func V0_6_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
if err != nil {
return err
}
// Add `contacts:manage` permission to Admin role
_, err = db.Exec(`
UPDATE roles
SET permissions = array_append(permissions, 'contacts:manage')
WHERE name = 'Admin' AND NOT ('contacts:manage' = ANY(permissions));
`)
if err != nil {
return err
}
return nil
}