Skip to content

Track user as target extra when sharing - #1603

Open
Fingel wants to merge 5 commits into
devfrom
custom-target-share-track-user
Open

Track user as target extra when sharing#1603
Fingel wants to merge 5 commits into
devfrom
custom-target-share-track-user

Conversation

@Fingel

@Fingel Fingel commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

adds a "shared_by" target extra when sharing a target. This is part of item 2 in #1597

@Fingel
Fingel requested a review from jchate6 July 8, 2026 22:40
@jchate6 jchate6 moved this to Needs Review in TOM Toolkit Jul 8, 2026
@jchate6 jchate6 linked an issue Jul 8, 2026 that may be closed by this pull request
@Fingel

Fingel commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Change this to use model fields directly instead of target_extras

@Fingel

Fingel commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

shared_by and shared_from are now added directly to the base target model

Base automatically changed from 1586-custom-target-sharing to version-3-0-alpha July 17, 2026 21:55
Base automatically changed from version-3-0-alpha to dev July 17, 2026 22:20

@jchate6 jchate6 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good, but would benefit from a test or 2.

Also, I ran into an issue with a
sqlite3.IntegrityError: UNIQUE constraint failed: tom_targets_targetextra.id
When trying to share from TOM1 to TOM2 with a target that had been deleted in TOM2.

Hilariously, the entire stack trace was piped into the error message in TOM1

Image

I don't think this is related to this code, but was hoping you could take a look just in case and either apply a quick fix, or make an issue if you can reproduce it?

@jchate6
jchate6 self-requested a review July 30, 2026 21:30
@Fingel

Fingel commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

I can't reproduce this issue.
I have 2 TOMs:

From TOM A, I share target a1.
From TOM B, I reload and see target a1.
From TOM B, I delete target a1.
From TOM A I share target a1 again.
From TOM B, target a1 is available again, but with a new ID.

This is what is expected. Are there concrete steps I can take to cause this exception to occur? The error itself is strange because IDs should be assigned automatically, this is some query specifying an ID to save a TargetExtra as, but I can't find any code that would do that.

@jchate6

jchate6 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Those are the steps I used to get that error. It's possible something else is going on? Are you using a postgres or sqlite DB?

I'm leaning towards just merging this. If it comes up again we can make an issue.

@Fingel

Fingel commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Those are the steps I used to get that error. It's possible something else is going on? Are you using a postgres or sqlite DB?

Using sqlite for both TOMs

I'm leaning towards just merging this. If it comes up again we can make an issue.

It's pretty hard to see how this PR specifically would cause the issue. Not saying there wasn't something introduced in the larger sharing work that has been done, but this is really piping 2 values over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

Track Target Provenance

2 participants