MCPcopy Create free account
hub / github.com/gogs/gogs / SettingsLeaveRepo

Function SettingsLeaveRepo

internal/route/user/setting.go:543–559  ·  view source on GitHub ↗
(c *context.Context)

Source from the content-addressed store, hash-verified

541}
542
543func SettingsLeaveRepo(c *context.Context) {
544 repo, err := database.GetRepositoryByID(c.QueryInt64("id"))
545 if err != nil {
546 c.NotFoundOrError(err, "get repository by ID")
547 return
548 }
549
550 if err = repo.DeleteCollaboration(c.User.ID); err != nil {
551 c.Errorf(err, "delete collaboration")
552 return
553 }
554
555 c.Flash.Success(c.Tr("settings.repos.leave_success", repo.FullName()))
556 c.JSONSuccess(map[string]any{
557 "redirect": conf.Server.Subpath + "/user/settings/repositories",
558 })
559}
560
561func SettingsOrganizations(c *context.Context) {
562 c.Title("settings.orgs")

Callers

nothing calls this directly

Calls 8

GetRepositoryByIDFunction · 0.92
DeleteCollaborationMethod · 0.80
SuccessMethod · 0.80
TrMethod · 0.80
JSONSuccessMethod · 0.80
FullNameMethod · 0.65
NotFoundOrErrorMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected