-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
344 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2025 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
//go:build windows | ||
|
||
package main | ||
|
||
// Golang has the ability to load OS's timezone data from most UNIX systems (https://github.com/golang/go/blob/master/src/time/zoneinfo_unix.go) | ||
// Even if the timezone data is missing, users could install the related packages to get it. | ||
// But on Windows, although `zoneinfo_windows.go` tries to load the timezone data from Windows registry, | ||
// some users still suffer from the issue that the timezone data is missing: https://github.com/go-gitea/gitea/issues/33235 | ||
// So we import the tzdata package to make sure the timezone data is included in the binary. | ||
// | ||
// For non-Windows package builders, they could still use the "TAGS=timetzdata" to include the tzdata package in the binary. | ||
// If we decided to add the tzdata for other platforms, modify the "go:build" directive above. | ||
import _ "time/tzdata" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2025 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package repo | ||
|
||
import ( | ||
"net/http" | ||
|
||
repo_model "code.gitea.io/gitea/models/repo" | ||
"code.gitea.io/gitea/modules/templates" | ||
"code.gitea.io/gitea/services/context" | ||
) | ||
|
||
const tplStarUnstar templates.TplName = "repo/star_unstar" | ||
|
||
func ActionStar(ctx *context.Context) { | ||
err := repo_model.StarRepo(ctx, ctx.Doer, ctx.Repo.Repository, ctx.PathParam("action") == "star") | ||
if err != nil { | ||
handleActionError(ctx, err) | ||
return | ||
} | ||
|
||
ctx.Data["IsStaringRepo"] = repo_model.IsStaring(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID) | ||
ctx.Data["Repository"], err = repo_model.GetRepositoryByName(ctx, ctx.Repo.Repository.OwnerID, ctx.Repo.Repository.Name) | ||
if err != nil { | ||
ctx.ServerError("GetRepositoryByName", err) | ||
return | ||
} | ||
ctx.RespHeader().Add("hx-trigger", "refreshUserCards") // see the `hx-trigger="refreshUserCards ..."` comments in tmpl | ||
ctx.HTML(http.StatusOK, tplStarUnstar) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2025 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package repo | ||
|
||
import ( | ||
"code.gitea.io/gitea/services/context" | ||
repo_service "code.gitea.io/gitea/services/repository" | ||
) | ||
|
||
func acceptTransfer(ctx *context.Context) { | ||
err := repo_service.AcceptTransferOwnership(ctx, ctx.Repo.Repository, ctx.Doer) | ||
if err == nil { | ||
ctx.Flash.Success(ctx.Tr("repo.settings.transfer.success")) | ||
ctx.Redirect(ctx.Repo.Repository.Link()) | ||
return | ||
} | ||
handleActionError(ctx, err) | ||
} | ||
|
||
func rejectTransfer(ctx *context.Context) { | ||
err := repo_service.RejectRepositoryTransfer(ctx, ctx.Repo.Repository, ctx.Doer) | ||
if err == nil { | ||
ctx.Flash.Success(ctx.Tr("repo.settings.transfer.rejected")) | ||
ctx.Redirect(ctx.Repo.Repository.Link()) | ||
return | ||
} | ||
handleActionError(ctx, err) | ||
} | ||
|
||
func ActionTransfer(ctx *context.Context) { | ||
switch ctx.PathParam("action") { | ||
case "accept_transfer": | ||
acceptTransfer(ctx) | ||
case "reject_transfer": | ||
rejectTransfer(ctx) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2025 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package repo | ||
|
||
import ( | ||
"net/http" | ||
|
||
repo_model "code.gitea.io/gitea/models/repo" | ||
"code.gitea.io/gitea/modules/templates" | ||
"code.gitea.io/gitea/services/context" | ||
) | ||
|
||
const tplWatchUnwatch templates.TplName = "repo/watch_unwatch" | ||
|
||
func ActionWatch(ctx *context.Context) { | ||
err := repo_model.WatchRepo(ctx, ctx.Doer, ctx.Repo.Repository, ctx.PathParam("action") == "watch") | ||
if err != nil { | ||
handleActionError(ctx, err) | ||
return | ||
} | ||
|
||
ctx.Data["IsWatchingRepo"] = repo_model.IsWatching(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID) | ||
ctx.Data["Repository"], err = repo_model.GetRepositoryByName(ctx, ctx.Repo.Repository.OwnerID, ctx.Repo.Repository.Name) | ||
if err != nil { | ||
ctx.ServerError("GetRepositoryByName", err) | ||
return | ||
} | ||
ctx.RespHeader().Add("hx-trigger", "refreshUserCards") // see the `hx-trigger="refreshUserCards ..."` comments in tmpl | ||
ctx.HTML(http.StatusOK, tplWatchUnwatch) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.