gitea
gitea copied to clipboard
Pin repos on profile
Fixes #10375
This PR implements the ability for users and organizations to pin repositories to their profiles.
At a given time, each user or organization can have, at most, 6 repositories pinned. A user can pin any repository that it has read permissions to. Organizations can only have pinned to their profiles repositories owned by themselves, only administrators of an organization can pin repositories to the org's profile.
The pins are stored on a table called repo_pin. When a repository is deleted, all its pins are automatically deleted. When a user loses visibility to a repository, the pin is not automatically removed. Instead, invalid pins will automatically be removed the next time someone does a read or write operation to said user's pins.
When a different user is visiting someone's profile, only the repositories that the visiting user can see are shown on the pins, to avoid leaking private information.
Used assets (unpin icon and pined repo cards) from #19831.
Can you reduce the space between these card to half of what it is currently?
@silverwind I managed to reduce the space between the cards to half the size on the latest commit, but I don't know if my changes follow the best practices. Can you comment on that?
This is how it looks now.
Thank you for your contribution. I will do a review after 1.22.0 is released.
Can you also upload a screenshot of organization's home(profile) page?
The design in https://github.com/go-gitea/gitea/issues/10375#issuecomment-1293270162 seems not good enough.
I think the block in the below should be moved to the top of this page, as pined repos should be a part of repositories tab which is similar to individual user's profile page.
Can you also upload a screenshot of organization's home(profile) page? The design in #10375 (comment) seems not good enough. I think the block in the below should be moved to the top of this page, as pined repos should be a part of repositories tab which is similar to individual user's profile page.
Yes, we also thought about that and changed it so the pinned repo cards are inside the repositories tab.
Is there a way to customize the order?
@JakobDev No, we currently cannot change the order. We thought it would be better if there were a basic implementation of the pin feature, which is the focus of this PR. Later, more capabilities, like ordering, could be added to it.
I think ordering is a basic feature that belongs to this PR before merging
We also need to handle user/org deletions.
We also need to handle user/org deletions.
We forgot about that. Now it's done.
@silverwind I managed to reduce the space between the cards to half the size on the latest commit, but I don't know if my changes follow the best practices. Can you comment on that?
I think such cards are prime candiate for display: grid and spacing via gap, so I will try to refactor it to that.
@carlosfelgueiras could you fix the merge conflict? Then I will do the refactor.
@carlosfelgueiras could you fix the merge conflict? Then I will do the refactor.
Done. Thanks in advance.
@carlosfelgueiras could you fix the merge conflict? Then I will do the refactor.
Done. Thanks in advance.
probably need to recheck if there are conflicts since the main branch has moved on
