spatie / mailcoach-support

Questions and support for Mailcoach
https://mailcoach.app
31 stars 2 forks source link

Option to preserve existing tags when importing subscribers #186

Closed Propaganistas closed 4 years ago

Propaganistas commented 4 years ago

Hi team Spatie

When using the "Import subscribers" feature, if a subscriber already exists within the list all of its current tags will be wiped in favor of just the one(s) available in the csv.

I think it'd be great if there's an option during import to determine how to deal with imports:

My use case: we're hosting multiple events. I set up a mailing list "Event participants" to which I want to add all participants after each event. The csv contains participants along with a tag identifying the event. When I import someone who's already present in the list, I expect the existing tags to be preserved in this case. Otherwise I'd have to do some serious export/import/cross-checking magic just to retain the old tags.

riasvdv commented 4 years ago

This is something you can customize yourself by replacing the mailcoach.actions.import_subscribers action with a class of your own that extends our \Spatie\Mailcoach\Actions\Subscribers\ImportSubscribersAction::class and overwriting the importSubscribers() method (you can basically copy-paste the method and change where we use $subscriber->syncTags($row->tags()); with $subscriber->addTags($row->tags());)

Implementing this now would require a breaking change in the package as the signature of the class would change. Hope you can solve it this way.