[bug]: Comment external_id is deduplicated per project instead of per work item
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Read apps/api/plane/api/views/issue.py around lines 1565 and 1735, where comment creation and update check for duplicate external IDs. Trace how the endpoint identifies the current work item and compare that with the project scoped filter described in the issue. Done means the same external source and ID can be used on different work items in one project, while a repeat on the same work item still returns 409; verify both cases through the comments API.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
Creating a work item comment with external_source and external_id returns 409 when any work item in the same project already has a comment with that pair. The check belongs to one work item's comment endpoint, but it filters by project only:
apps/api/plane/api/views/issue.py:1565 (create) and :1735 (update), branch preview:
IssueComment.objects.filter(
project_id=project_id,
workspace__slug=slug,
external_source=...,
external_id=...,
).exists()
So one external event that touches several work items in a project, written with one key per event, can record a comment on the first work item only. The rest get 409, and the id in the response points to a comment on a different work item.
Steps to reproduce
- Take two work items A and B in one project.
- Create a comment on A:
curl -X POST "$HOST/api/v1/workspaces/$SLUG/projects/$PROJECT/work-items/$A/comments/" \
-H "X-API-Key: $KEY" -H 'Content-Type: application/json' \
-d '{"comment_html":"<p>probe</p>","external_source":"probe","external_id":"scope-1"}'
Result: 201.
- Send the same request for B.
Result: 409 with {"error":"Work item comment with the same external id and external source already exists","id":"<id of the comment on A>"}.
Expected: 201 on B. The 409 should apply only to a repeat on the same work item, by adding issue_id to the filter. If project-wide uniqueness is intended, it would help to say so in the API docs.
Environment
Production
Browser
Other
Edition
Commercial
Version
v3.3.0
- Dominant language
- TypeScript
- Stars
- 61.9k
- Forks
- 6.3k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 75
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from makeplane/plane
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Missing optional chaining on actor_details and reaction_items in apps/space reactions and votesPossibly taken @ghazy2001 claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
makeplane/plane#10111 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
makeplane/plane#10082 · 1 comment ·
Maintainers usually reply within 1 day
-
[bug]: Email notifications show a broken avatar for users without a profile photoPossibly taken @gurnoorpannu claimed this 21 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
makeplane/plane#10009 · 1 comment ·
Maintainers usually reply within 1 day
-
🐛 Bug: Calendar work items cannot be opened on mobilePossibly taken @pennnnnnnnnn claimed this 23 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Open-Earth-Foundation/CityCatalyst#3399 ·
Maintainers usually reply within 2 days
-
userReport
Difficulty 1/5 Under an hour Newbie friendliness 72/100
nkprasad12/morcus-net#631 ·
Maintainers usually reply within 1 day
-
fix(app): fail closed if GetGeneralSetting fails during initializationPossibly taken @kalavt claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
nekko-labs/nekko-agent#1756 ·
Maintainers usually reply within 1 day
-
needs-area-label
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 2 days