Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(contact-tagging): Add support tagable contacts with bulk action #63

Merged
merged 56 commits into from
Nov 15, 2024

Conversation

JumpLink
Copy link
Collaborator

@JumpLink JumpLink commented Oct 29, 2024

Contact Tagging System Implementation

Description

This PR implements a comprehensive contact tagging system by aligning it with the existing Callout Responses tag functionality. The changes include:

  • Removal of legacy tag implementation from ContactProfile
  • New tag system aligned with Callout Responses tags
  • New ContactTagController for managing contact tags
  • Batch update capabilities for contacts
  • Enhanced filtering with pagination support
  • Database migrations for tag storage

Key Changes

  • Added ContactTagController with CRUD operations for global tags
  • Implemented batch update functionality for multiple contacts
  • Created new DTOs and transformers for tag management
  • Updated filtering system to support tag-based queries
  • Added database migrations for tag storage
  • Aligned tag management UI components

Testing Checklist

Tag Management

  • Create, edit and delete tags
  • Assign tags to individual contacts
  • Batch assign tags to multiple contacts
  • Remove tags from contacts
  • Test tag search functionality

Filtering & Pagination

  • Test tag-based filtering with pagination
  • Verify combined filters (tags + other filters)
  • Test filter persistence across pages
  • Verify performance with large datasets

Integration Tests

  • Verify Callout Response tag filtering still works
  • Test tag migration from old system
  • Verify API responses for tag operations
  • Test error handling for invalid operations

UI Components

  • Test TagEditorForm functionality
  • Verify ToggleTagButton behavior
  • Test tag selection in filters
  • Verify tag display in contact lists

Related Components

  • ContactTagController
  • TagTransformer
  • Contact filtering system
  • Tag migration scripts
  • Tag management UI

Translations Checklist

  • Updated translations in Google Sheet
  • Merge new translations in Google Sheet to main sheet

@JumpLink
Copy link
Collaborator Author

@wpf500 I initially based my implementation on CalloutTag , but then deviated from it. In the ContactTag model, I now only store the tags and no reference to the contact (CalloutTag stores the calloutId). Instead, I have created a contact_tag_assignments table using @ManyToMany("ContactTag", "contact") and @JoinTable({...}), which is used for the assignments. For callout responses, tags are managed per callout; for contacts, they are managed globally. Maybe you would like to take a look at my unfinished implementation? Feel free to give me suggestions on what else could be combined.

Copy link
Member

@wpf500 wpf500 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small comments but in general this is really great 🎉. Well on it's way to being one of those magical PRs that adds a feature with a negative line count 😄

apps/backend/src/api/controllers/ContactController.ts Outdated Show resolved Hide resolved
apps/backend/src/api/transformers/ContactTransformer.ts Outdated Show resolved Hide resolved
packages/core/src/models/Contact.ts Outdated Show resolved Hide resolved
@JumpLink
Copy link
Collaborator Author

This is looking amazing so far. Thanks for adding so much documentation, cleaning up the code, giving it a better structure... on top of implementing the tagging in such a way that we could easily add more taggable entities in the future.

I was very happy to do so, I found it difficult to understand (and I still haven't fully understood it) but the tidying up and documenting helped me to do so, so it wasn't entirely self-serving ;)

@JumpLink JumpLink marked this pull request as ready for review November 12, 2024 14:44
@JumpLink JumpLink requested a review from wpf500 November 12, 2024 14:54
Copy link
Member

@wpf500 wpf500 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments, but generally looks really great 🎉

apps/backend/src/api/transformers/ContactExporter.ts Outdated Show resolved Hide resolved
apps/backend/src/tools/database/anonymisers/models.ts Outdated Show resolved Hide resolved
apps/backend/src/tools/database/anonymisers/models.ts Outdated Show resolved Hide resolved
@wpf500
Copy link
Member

wpf500 commented Nov 13, 2024

One other question: have you tested the migration against an instance that had old style tags to migrate? Did it work on dev for example?

@JumpLink
Copy link
Collaborator Author

One other question: have you tested the migration against an instance that had old style tags to migrate? Did it work on dev for example?

Yes you can look at this on dev, the old tags have been successfully preserved

@JumpLink
Copy link
Collaborator Author

With my lastest changes I have implemented:

  • Ordered tags
  • Wrap/break tags for items with many tags
  • Improved delete tag translation
  • Better error message on duplicate tag names
  • Readd callout filter group for contacts
  • Do not disable the toggle button if no item is selected to be able to reach the tag manager without a selection
  • Keep the selection to be able to toggle multiple tags for the same selected items
  • Fixed Tag Manager route from detail pages
  • Make tags clickable

@JumpLink JumpLink merged commit 6aad62f into main Nov 15, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants