Fix incorrect viewed files counter if reverted change was viewed#36819
Fix incorrect viewed files counter if reverted change was viewed#36819silverwind merged 12 commits intogo-gitea:mainfrom
Conversation
|
Could we have a test for that? |
services/gitdiff/gitdiff.go
Outdated
| } | ||
| // Check whether the file has already been viewed | ||
| if fileViewedState == pull_model.Viewed { | ||
| changedFiles = slices.Delete(changedFiles, changedFileIdx, changedFileIdx+1) |
There was a problem hiding this comment.
changedFiles needs to be a map now
There was a problem hiding this comment.
I've reverted to keep the old logic - I haven't thought about the performance bottleneck here. Done
Test added |
It's better to use |
|
I've added the test repo changes as |
|
Comment authored by Claude on behalf of @silverwind Review of #36819 — Fix incorrect viewed files counter if reverted change was viewed The fix is correct in concept — leftover Two points:
The test is well-structured and validates the scenario. Overall looks good pending the above. |
|
Addressed the ai suggestions |
silverwind
left a comment
There was a problem hiding this comment.
This review was written by Claude.
|
Not sure about backport, likely won't merge cleanly and it's better to focus on the 1.26 release. |
…gitea#36819) If a file is marked as viewed in a PR and all changes to those file are reverted afterwards, the file is still stored as viewed in the db, which causes an incorrect viewed files counter --- <img width="468" height="139" alt="image" src="https://github.com/user-attachments/assets/f13bf161-142d-49a9-8425-3884ee7abb84" />
|
Cancelled the backport PR. |
* giteaofficial/main: Update minimum go version to 1.26.1, golangci-lint to 2.11.2, fix test style (go-gitea#36876) Add render cache for SVG icons (go-gitea#36863) Fix incorrect viewed files counter if reverted change was viewed (go-gitea#36819) [skip ci] Updated translations via Crowdin Clean up `refreshViewedFilesSummary` (go-gitea#36868) Remove `util.URLJoin` and replace all callers with direct path concatenation (go-gitea#36867) Optimize Docker build with dependency layer caching (go-gitea#36864) Fix URLJoin, markup render link reoslving, sign-in/up/linkaccount page common data (go-gitea#36861) Fix CodeQL code scanning alerts (go-gitea#36858) Refactor auth middleware (go-gitea#36848) Update Nix flake (go-gitea#36857) Update JS deps (go-gitea#36850) Load `mentionValues` asynchronously (go-gitea#36739) [skip ci] Updated translations via Crowdin Fix dbfs error handling (go-gitea#36844) Fix OAuth2 authorization code expiry and reuse handling (go-gitea#36797) Fix org permission API visibility checks for hidden members and private orgs (go-gitea#36798)
If a file is marked as viewed in a PR and all changes to those file are reverted afterwards, the file is still stored as viewed in the db, which causes an incorrect viewed files counter