gitea icon indicating copy to clipboard operation
gitea copied to clipboard

Pin repos on profile

Open carlosfelgueiras opened this issue 1 year ago • 15 comments

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.


Profile of a given user seen from its perspective, showing its pinned repos. Profile of a given user seen from another user perspective, showing its pinned repos. Header of the main page of a repository, showing the option to pin the repo. Header of the main page of a repository owned by an organization which the current user is admin, showing the options for pinning to the user or org profile. Header of the main page of a repository showing the disabled pin button, since the user has reached the max limit of pinned repos.

carlosfelgueiras avatar May 13 '24 10:05 carlosfelgueiras

Can you reduce the space between these card to half of what it is currently?

image

silverwind avatar May 13 '24 18:05 silverwind

@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?

carlosfelgueiras avatar May 15 '24 14:05 carlosfelgueiras

This is how it looks now.

image

carlosfelgueiras avatar May 15 '24 15:05 carlosfelgueiras

Thank you for your contribution. I will do a review after 1.22.0 is released.

lunny avatar May 21 '24 14:05 lunny

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. image

yp05327 avatar May 22 '24 00:05 yp05327

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. image

Yes, we also thought about that and changed it so the pinned repo cards are inside the repositories tab. image

carlosfelgueiras avatar May 26 '24 14:05 carlosfelgueiras

Is there a way to customize the order?

JakobDev avatar May 27 '24 09:05 JakobDev

@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.

DanielMatiasCarvalho avatar May 27 '24 13:05 DanielMatiasCarvalho

I think ordering is a basic feature that belongs to this PR before merging

JakobDev avatar May 27 '24 13:05 JakobDev

We also need to handle user/org deletions.

lunny avatar May 27 '24 13:05 lunny

We also need to handle user/org deletions.

We forgot about that. Now it's done.

carlosfelgueiras avatar May 28 '24 10:05 carlosfelgueiras

@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.

silverwind avatar May 30 '24 16:05 silverwind

@carlosfelgueiras could you fix the merge conflict? Then I will do the refactor.

silverwind avatar May 30 '24 16:05 silverwind

@carlosfelgueiras could you fix the merge conflict? Then I will do the refactor.

Done. Thanks in advance.

carlosfelgueiras avatar Jun 11 '24 15:06 carlosfelgueiras

@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

eeyrjmr avatar Sep 29 '24 11:09 eeyrjmr