fix(api): include effective subscribers in issue subscriptions list - #38655
Open
majorissuerep wants to merge 3 commits into
Open
fix(api): include effective subscribers in issue subscriptions list#38655majorissuerep wants to merge 3 commits into
majorissuerep wants to merge 3 commits into
Conversation
GET /repos/{owner}/{repo}/issues/{index}/subscriptions previously only
returned rows from issue_watch with is_watching=true. The web UI and
notification path treat participants (commenters/author) and repo
watchers as subscribed unless explicitly unsubscribed, so the API
list was incomplete and inconsistent with /subscriptions/check.
Return the same effective subscriber set: explicit watchers ∪
participants ∪ issue author ∪ repo watchers (normal/auto), minus
explicit unsubscribers, filtering inactive/prohibited users.
Fixes go-gitea#26750
Assisted-by: hermes:grok-4.5
Assisted-by: hermes:grok-4.5
Contributor
Author
|
Issue #26750 updated with the effective-subscriber contract this PR implements. Current set matches CheckIssueWatch / UI unsubscribe. Can keep explicit-watch-only behind a query flag if that's preferred. Assisted-by: Hermes:glm-5.2 |
Assisted-by: Hermes:grok-4.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /repos/{owner}/{repo}/issues/{index}/subscriptionsonly returned users with an explicitissue_watchrow (is_watching=true).That disagrees with how subscription actually works elsewhere:
CheckIssueWatch(used by/subscriptions/check) treats participants and repo watchers as subscribedSo the list API missed effective subscribers until someone toggled unsubscribe/subscribe to force an
issue_watchrow.Fix
Add
GetIssueSubscribers/CountIssueSubscribersthat return the effective set:issue_watch.is_watching=true)WatchModeNormal/WatchModeAuto)issue_watch.is_watching=false)Wire the API list endpoint to those helpers. Keep
GetIssueWatchersfor callers that need explicit rows only.Fixes #26750
Test plan
gofmton touched filesgo vet ./models/issues/ ./routers/api/v1/repo/go test ./models/issues/ -run 'TestGetIssueWatch|TestGetIssueSubscribers|TestCreateOrUpdateIssueWatch' -count=1go test ./tests/integration/ -run '^TestAPIIssueSubscriptions$' -count=1Coverage notes
AI disclosure
Assisted by Hermes (grok-4.5) for diagnosis, implementation, and tests. Changes reviewed and verified locally.