-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Pin Repositories on user page (Fixes #10375) #19831
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
Conversation
models/repo/pin.go
Outdated
"code.gitea.io/gitea/modules/log" | ||
) | ||
|
||
//Pin Repo or unpin repo |
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.
//Pin Repo or unpin repo | |
// PinRepo or unpin repo |
models/repo/repo.go
Outdated
err = json.Unmarshal([]byte(pinstring), &pinitems) | ||
|
||
if err != nil { | ||
log.Warn("Couldn't deserialise pinned repos: %v", pinstring) |
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.
log.Warn("Couldn't deserialise pinned repos: %v", pinstring) | |
log.Warn("Cannot deserialize pinned repos: %v", err) |
@delvh All the bits of logging here are debugging hangovers, they won't be present in the finished PR :) Thank you for the notes! I'll go through it all today. |
Co-authored-by: delvh <[email protected]>
Co-authored-by: delvh <[email protected]>
Co-authored-by: delvh <[email protected]>
Could you give some screenshots about the UI design? I think we need some discuss there. |
I tried cards above the search bar, but couldn't get it to look coherent. Part of it is that the repository names can be very long, right? So I found it hard to think of a better presentation than in a list with the rest. However I take @delvh 's point that these are a user thing and should appear separately to the searched repositories. So I will try again with some cards. |
Co-authored-by: delvh <[email protected]>
… feature/Pinning
Co-authored-by: delvh <[email protected]>
Co-authored-by: delvh <[email protected]>
Co-authored-by: delvh <[email protected]>
Co-authored-by: delvh <[email protected]>
Co-authored-by: delvh <[email protected]>
I'm curious since none of the test screenshots are anything close to a phone in portrait mode, but what happens with the pinned repos with a small page width? It would be cool if they then became vertically stacked or something else smart that doesn't involve just a giant horizontal scrollbar (and doesn't involve the pin cards becoming so tiny they can't be read anymore). In overall this is really cool. Especially on instances with a lot of developers, this can help a lot with finding out what cool stuff the others made. |
I believe stacking vertically is exactly what they do. They use the Fomantic |
@@ -217,6 +217,20 @@ func (repo *Repository) IsBroken() bool { | |||
return repo.Status == RepositoryBroken | |||
} | |||
|
|||
// IsPinned indicates that repository is pinned | |||
func (repo *Repository) IsPinned() bool { |
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.
I think the function should be IsPinned(userID int64)
. One could pin another public repository?
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.
A repo is either pinned to its owner's profile, or not at all.
This is maybe the same confusion I had with @delvh ? This is not an implementation for pinning any repo you have access to to your profile - it's an implementation for pinning a repo to its owner's profile.
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.
Hm, the most interesting thing I happen to work on is in an org I own, not in my user namespace. So I couldn't pin that then? I'd assume that's a common use case, but maybe that's just me.
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.
It sounds like that's everyone's else's view too. This may need reimplementing with that in mind.
Moved to v1.19 because one should pin his organization repositories |
I may not have the time to implement this new version any time soon. If someone else is interested I'm happy to hand it over. So to be clear the spec here is:
It is not super clear to me what the UI for this will be. For example if I'm on a repository owned by an org for which I'm the administrator, I need the option to pin it to my profile or the org's profile. I don't know how best to do that. |
For what it's worth, I think GitHub restricts it to having either some sort of repo ownership or past contributions. I'm really just a random user (who happens to like pins), but I personally think no restriction may actually be cooler. It changes pins from only "look at my work" to "hey, look at this cool thing", and that feels more social and dynamic to me. But I wonder what others think? |
Both have their advantages and disadvantages. I'm also fine with both approaches, as long as we can agree on one and keep it at that. |
I think free pinning gives users the opportunity to use the feature how they wish, which maybe feels more expressive? Plus it's simpler to implement! |
While that is true think about an organisation that wants to bring focus to a key repository. Users pinning for their convenience is important but an organisation pinning for visibility is equally important |
I don't understand why users being able to free pin would impact orgs? Orgs will be able to pin their own repos to their profiles for sure. |
I am equally confused. |
Hold on a mo. It seems like you're suggesting that orgs should also be able to pin any repository to their profiles - not just ones tha they own? I thought we were suggesting users could pin anything, but orgs could only pin their own repos. |
Would that be important to limit though? Maybe it should also be unrestricted. |
Yeah that's a fair question. I suppose I'm worried about the UI explosion. If the dropdown is just:
Then that's pretty digestable. If it's...
It's a lot more irritating, especially given that 99% of the time you're going to want to pin the repo just to its owning org. |
Please move the discussion to #10375, I think that's more appropriate as we have a lot to discuss as it seems. |
Now that #24406 is in, I assume at least the HTML templates and CSS from it could be re-used here. |
Are you still doing this PR? |
Closing as stale and the author having said that this feature needs a completely new implementation (#10375 (comment)) |
#10375
This PR adds the ability for repository administrators to pin up to 3 repositories to the home page of the repository owner.
This applies to both users and orgs.
Pinned repositories are stored in the user setting
pinned_repos
.Not included in this PR: