-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add pinning for prs and branches #433
base: staging
Are you sure you want to change the base?
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a review together and come up with couple things, but other than that looks good, thanks 🍾
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete on cascade should be added, so that whenever a branch is removed, its preference is removed from preference table as well 👍🏻
Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement [ERROR: update or delete on table "branch" violates foreign key constraint "fkgyxf2ri6f3j4pourba7shdsma" on table "user_preference_favourite_branches"
Detail: Key (repository_id, name)=(890885508, feat/ege-test3) is still referenced from table "user_preference_favourite_branches".] [delete from branch where name=? and repository_id=?]
|
||
public List<BranchInfoDto> getAllBranches() { | ||
final Optional<UserPreference> userPreference = | ||
userPreferenceRepository.findByUser(authService.getUserFromGithubId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
authService.getUserFromGithubId()
returns User and i think we are using this in method in endpoints where its covered with at least @EnforceAtLeastWrite annotation so that we are sure that user exist
but in here, since branches and pull requests should be accessible without loggin in, whenever i open the pr or branch list view i got the below error

|
||
public List<PullRequestBaseInfoDto> getAllPullRequests() { | ||
final Optional<UserPreference> userPreference = | ||
userPreferenceRepository.findByUser(authService.getUserFromGithubId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the same thing with getAllBranches
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already talked about this branch table's tree structure and visibility of pinned branches inside the tree.
Possible solution is having another separate group called Pinned and we show all the branches in the tree view (nothing will be changed there) but also inside the Pinned group we will show all the pinned branches there again
This Pull request adds the possibility to pin prs/branches at the top of the table. This user preference is also persisted in the db.
Screencast.from.23.02.2025.17.11.04.webm