Add star in archived repo results in an error #2996

Closed
opened 2025-11-02 04:56:35 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @Aragur on GitHub (Mar 2, 2019).

Description

See my repo on try.gitea.io.
Try to star it. This results in the following error

template: repo/header:31:51: executing "repo/header" at <$.UnitTypeCode>: invalid value; expected models.UnitType
Originally created by @Aragur on GitHub (Mar 2, 2019). - Can you reproduce the bug at https://try.gitea.io: - [X] Yes https://try.gitea.io/AragurDEV/Archived_Repo ## Description See my repo on try.gitea.io. Try to star it. This results in the following error ``` template: repo/header:31:51: executing "repo/header" at <$.UnitTypeCode>: invalid value; expected models.UnitType ```
GiteaMirror added the type/bug label 2025-11-02 04:56:35 -06:00
Author
Owner

@jolheiser commented on GitHub (Mar 5, 2019):

This same thing happens when you click on watch in that repo, which narrows it down to most likely being the code here:
https://github.com/go-gitea/gitea/blob/master/routers/repo/repo.go#L288-L316

Nevermind, I think this is actually a context issue.

@jolheiser commented on GitHub (Mar 5, 2019): ~~This same thing happens when you click on `watch` in that repo, which narrows it down to most likely being the code here: https://github.com/go-gitea/gitea/blob/master/routers/repo/repo.go#L288-L316~~ Nevermind, I think this is actually a context issue.
Author
Owner

@jolheiser commented on GitHub (Mar 5, 2019):

The issue presented is partially caused by #5980
Now that the 404 page is loading a repo header if possible, this was failing because unit types aren't loaded for the action URL and the archived status is returning a 404 on actions.
I will send a PR to fix this, however I think there may be more work to be done after that.


In my opinion, it may be confusing to the end user why they get a 404 that displays the repo header, however they were unable to (un)watch/star the repo.

We could disable the buttons similarly to how the fork button is disabled if the user cannot fork, but...

  1. Shouldn't a user be able to, at the very least, unstar/watch an archived repo?
  2. Should all watchers and/or stargazers be removed when a repo is archived automatically? (I understand having a starred archived repo since you can still clone/download, but watching would be pretty moot)

In addition, should we display an error to the end user explaining that archived repos cannot be (un)watched/starred?

@jolheiser commented on GitHub (Mar 5, 2019): The issue presented is partially caused by #5980 Now that the 404 page is loading a repo header if possible, this was failing because [unit types aren't loaded for the action URL](https://github.com/go-gitea/gitea/blob/44114b38e601c8bf44f575daef1d0e0597f37d1d/routers/routes/routes.go#L566) and the archived status is returning a 404 on actions. I will send a PR to fix this, however I think there may be more work to be done after that. ---- In my opinion, it may be confusing to the end user why they get a 404 that displays the repo header, however they were unable to (un)watch/star the repo. We could disable the buttons similarly to how the fork button is disabled if the user cannot fork, but... 1. Shouldn't a user be able to, at the very least, unstar/watch an archived repo? 2. Should all watchers and/or stargazers be removed when a repo is archived automatically? (I understand having a starred archived repo since you can still clone/download, but watching would be pretty moot) In addition, should we display an error to the end user explaining that archived repos cannot be (un)watched/starred?
Author
Owner

@Aragur commented on GitHub (Mar 5, 2019):

I think it should be possible to (un)star a archived repo. As of watching it's not that useful but I think enabling it would be better considering usibility

@Aragur commented on GitHub (Mar 5, 2019): I think it should be possible to (un)star a archived repo. As of watching it's not that useful but I think enabling it would be better considering usibility
Author
Owner

@jolheiser commented on GitHub (Mar 6, 2019):

For comparison, GitHub allows you to still fully interact with starring/watching an archived repo.

@jolheiser commented on GitHub (Mar 6, 2019): For comparison, GitHub allows you to still fully interact with starring/watching an archived repo.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2996