Skip to content
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

Open
wants to merge 9 commits into
base: staging
Choose a base branch
from
Open

feat: Add pinning for prs and branches #433

wants to merge 9 commits into from

Conversation

thielpa
Copy link
Contributor

@thielpa thielpa commented Feb 23, 2025

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

@thielpa thielpa changed the title feat: add pinning for prs and branches feat: Add pinning for prs and branches Feb 23, 2025
Copy link

codacy-production bot commented Feb 23, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for a96fb701 4.14%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (a96fb70) Report Missing Report Missing Report Missing
Head commit (8a82c3d) 5508 334 6.06%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#433) 169 7 4.14%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@thielpa thielpa marked this pull request as ready for review February 23, 2025 16:26
@thielpa thielpa requested a review from a team as a code owner February 23, 2025 16:26
@thielpa thielpa linked an issue Feb 23, 2025 that may be closed by this pull request
Copy link
Member

@egekocabas egekocabas left a 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 🍾

Copy link
Member

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());
Copy link
Member

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

Screenshot 2025-02-25 at 17 28 44


public List<PullRequestBaseInfoDto> getAllPullRequests() {
final Optional<UserPreference> userPreference =
userPreferenceRepository.findByUser(authService.getUserFromGithubId());
Copy link
Member

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

Copy link
Member

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

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

Successfully merging this pull request may close these issues.

[Feature]: Pin PR/Branches
2 participants