summaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/branch.go4
-rw-r--r--routers/repo/commit.go14
-rw-r--r--routers/repo/download.go8
-rw-r--r--routers/repo/http.go8
-rw-r--r--routers/repo/issue.go70
-rw-r--r--routers/repo/pull.go30
-rw-r--r--routers/repo/release.go16
-rw-r--r--routers/repo/repo.go20
-rw-r--r--routers/repo/setting.go28
-rw-r--r--routers/repo/view.go12
-rw-r--r--routers/repo/webhook.go26
-rw-r--r--routers/repo/wiki.go20
12 files changed, 128 insertions, 128 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go
index c340b2bf6b..00f30b0f13 100644
--- a/routers/repo/branch.go
+++ b/routers/repo/branch.go
@@ -6,14 +6,14 @@ package repo
import (
"github.com/gogits/gogs/modules/base"
- "github.com/gogits/gogs/modules/middleware"
+ "github.com/gogits/gogs/modules/context"
)
const (
BRANCH base.TplName = "repo/branch"
)
-func Branches(ctx *middleware.Context) {
+func Branches(ctx *context.Context) {
ctx.Data["Title"] = "Branches"
ctx.Data["IsRepoToolbarBranches"] = true
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 781c3da946..97584c4d1a 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -14,7 +14,7 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/base"
- "github.com/gogits/gogs/modules/middleware"
+ "github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/setting"
)
@@ -23,7 +23,7 @@ const (
DIFF base.TplName = "repo/diff"
)
-func RefCommits(ctx *middleware.Context) {
+func RefCommits(ctx *context.Context) {
switch {
case len(ctx.Repo.TreeName) == 0:
Commits(ctx)
@@ -43,7 +43,7 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List {
return newCommits
}
-func Commits(ctx *middleware.Context) {
+func Commits(ctx *context.Context) {
ctx.Data["PageIsCommits"] = true
commitsCount, err := ctx.Repo.Commit.CommitsCount()
@@ -75,7 +75,7 @@ func Commits(ctx *middleware.Context) {
ctx.HTML(200, COMMITS)
}
-func SearchCommits(ctx *middleware.Context) {
+func SearchCommits(ctx *context.Context) {
ctx.Data["PageIsCommits"] = true
keyword := ctx.Query("q")
@@ -101,7 +101,7 @@ func SearchCommits(ctx *middleware.Context) {
ctx.HTML(200, COMMITS)
}
-func FileHistory(ctx *middleware.Context) {
+func FileHistory(ctx *context.Context) {
ctx.Data["IsRepoToolbarCommits"] = true
fileName := ctx.Repo.TreeName
@@ -143,7 +143,7 @@ func FileHistory(ctx *middleware.Context) {
ctx.HTML(200, COMMITS)
}
-func Diff(ctx *middleware.Context) {
+func Diff(ctx *context.Context) {
ctx.Data["PageIsDiff"] = true
userName := ctx.Repo.Owner.Name
@@ -187,7 +187,7 @@ func Diff(ctx *middleware.Context) {
ctx.HTML(200, DIFF)
}
-func CompareDiff(ctx *middleware.Context) {
+func CompareDiff(ctx *context.Context) {
ctx.Data["IsRepoToolbarCommits"] = true
ctx.Data["IsDiffCompare"] = true
userName := ctx.Repo.Owner.Name
diff --git a/routers/repo/download.go b/routers/repo/download.go
index a10792b87f..3329073e0c 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -11,10 +11,10 @@ import (
"github.com/gogits/git-module"
"github.com/gogits/gogs/modules/base"
- "github.com/gogits/gogs/modules/middleware"
+ "github.com/gogits/gogs/modules/context"
)
-func ServeData(ctx *middleware.Context, name string, reader io.Reader) error {
+func ServeData(ctx *context.Context, name string, reader io.Reader) error {
buf := make([]byte, 1024)
n, _ := reader.Read(buf)
if n > 0 {
@@ -36,7 +36,7 @@ func ServeData(ctx *middleware.Context, name string, reader io.Reader) error {
return err
}
-func ServeBlob(ctx *middleware.Context, blob *git.Blob) error {
+func ServeBlob(ctx *context.Context, blob *git.Blob) error {
dataRc, err := blob.Data()
if err != nil {
return err
@@ -45,7 +45,7 @@ func ServeBlob(ctx *middleware.Context, blob *git.Blob) error {
return ServeData(ctx, ctx.Repo.TreeName, dataRc)
}
-func SingleDownload(ctx *middleware.Context) {
+func SingleDownload(ctx *context.Context) {
blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreeName)
if err != nil {
if git.IsErrNotExist(err) {
diff --git a/routers/repo/http.go b/routers/repo/http.go
index f9600c94de..b273b2334e 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -23,18 +23,18 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/base"
+ "github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/log"
- "github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/modules/setting"
)
-func authRequired(ctx *middleware.Context) {
+func authRequired(ctx *context.Context) {
ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=\".\"")
ctx.Data["ErrorMsg"] = "no basic auth and digit auth"
ctx.Error(401)
}
-func HTTP(ctx *middleware.Context) {
+func HTTP(ctx *context.Context) {
username := ctx.Params(":username")
reponame := strings.TrimSuffix(ctx.Params(":reponame"), ".git")
@@ -293,7 +293,7 @@ func getGitDir(config *Config, fPath string) (string, error) {
}
// Request handling function
-func HTTPBackend(ctx *middleware.Context, config *Config) http.HandlerFunc {
+func HTTPBackend(ctx *context.Context, config *Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
for _, route := range routes {
r.URL.Path = strings.ToLower(r.URL.Path) // blue: In case some repo name has upper case name
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 3a1049e65d..d66123f912 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -20,10 +20,10 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
+ "github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/mailer"
"github.com/gogits/gogs/modules/markdown"
- "github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/modules/setting"
)
@@ -52,14 +52,14 @@ var (
}
)
-func MustEnableIssues(ctx *middleware.Context) {
+func MustEnableIssues(ctx *context.Context) {
if !ctx.Repo.Repository.EnableIssues {
ctx.Handle(404, "MustEnableIssues", nil)
return
}
}
-func MustAllowPulls(ctx *middleware.Context) {
+func MustAllowPulls(ctx *context.Context) {
if !ctx.Repo.Repository.AllowsPulls() {
ctx.Handle(404, "MustAllowPulls", nil)
return
@@ -72,7 +72,7 @@ func MustAllowPulls(ctx *middleware.Context) {
}
}
-func RetrieveLabels(ctx *middleware.Context) {
+func RetrieveLabels(ctx *context.Context) {
labels, err := models.GetLabelsByRepoID(ctx.Repo.Repository.ID)
if err != nil {
ctx.Handle(500, "RetrieveLabels.GetLabels: %v", err)
@@ -85,7 +85,7 @@ func RetrieveLabels(ctx *middleware.Context) {
ctx.Data["NumLabels"] = len(labels)
}
-func Issues(ctx *middleware.Context) {
+func Issues(ctx *context.Context) {
isPullList := ctx.Params(":type") == "pulls"
if isPullList {
MustAllowPulls(ctx)
@@ -250,7 +250,7 @@ func Issues(ctx *middleware.Context) {
ctx.HTML(200, ISSUES)
}
-func renderAttachmentSettings(ctx *middleware.Context) {
+func renderAttachmentSettings(ctx *context.Context) {
ctx.Data["RequireDropzone"] = true
ctx.Data["IsAttachmentEnabled"] = setting.AttachmentEnabled
ctx.Data["AttachmentAllowedTypes"] = setting.AttachmentAllowedTypes
@@ -258,7 +258,7 @@ func renderAttachmentSettings(ctx *middleware.Context) {
ctx.Data["AttachmentMaxFiles"] = setting.AttachmentMaxFiles
}
-func RetrieveRepoMilestonesAndAssignees(ctx *middleware.Context, repo *models.Repository) {
+func RetrieveRepoMilestonesAndAssignees(ctx *context.Context, repo *models.Repository) {
var err error
ctx.Data["OpenMilestones"], err = models.GetMilestones(repo.ID, -1, false)
if err != nil {
@@ -278,7 +278,7 @@ func RetrieveRepoMilestonesAndAssignees(ctx *middleware.Context, repo *models.Re
}
}
-func RetrieveRepoMetas(ctx *middleware.Context, repo *models.Repository) []*models.Label {
+func RetrieveRepoMetas(ctx *context.Context, repo *models.Repository) []*models.Label {
if !ctx.Repo.IsWriter() {
return nil
}
@@ -298,7 +298,7 @@ func RetrieveRepoMetas(ctx *middleware.Context, repo *models.Repository) []*mode
return labels
}
-func getFileContentFromDefaultBranch(ctx *middleware.Context, filename string) (string, bool) {
+func getFileContentFromDefaultBranch(ctx *context.Context, filename string) (string, bool) {
var r io.Reader
var bytes []byte
@@ -325,7 +325,7 @@ func getFileContentFromDefaultBranch(ctx *middleware.Context, filename string) (
return string(bytes), true
}
-func setTemplateIfExists(ctx *middleware.Context, ctxDataKey string, possibleFiles []string) {
+func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleFiles []string) {
for _, filename := range possibleFiles {
content, found := getFileContentFromDefaultBranch(ctx, filename)
if found {
@@ -335,7 +335,7 @@ func setTemplateIfExists(ctx *middleware.Context, ctxDataKey string, possibleFil
}
}
-func NewIssue(ctx *middleware.Context) {
+func NewIssue(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.issues.new")
ctx.Data["PageIsIssueList"] = true
setTemplateIfExists(ctx, ISSUE_TEMPLATE_KEY, IssueTemplateCandidates)
@@ -351,7 +351,7 @@ func NewIssue(ctx *middleware.Context) {
ctx.HTML(200, ISSUE_NEW)
}
-func ValidateRepoMetas(ctx *middleware.Context, form auth.CreateIssueForm) ([]int64, int64, int64) {
+func ValidateRepoMetas(ctx *context.Context, form auth.CreateIssueForm) ([]int64, int64, int64) {
var (
repo = ctx.Repo.Repository
err error
@@ -405,7 +405,7 @@ func ValidateRepoMetas(ctx *middleware.Context, form auth.CreateIssueForm) ([]in
return labelIDs, milestoneID, assigneeID
}
-func notifyWatchersAndMentions(ctx *middleware.Context, issue *models.Issue) {
+func notifyWatchersAndMentions(ctx *context.Context, issue *models.Issue) {
// Update mentions
mentions := markdown.MentionPattern.FindAllString(issue.Content, -1)
if len(mentions) > 0 {
@@ -446,7 +446,7 @@ func notifyWatchersAndMentions(ctx *middleware.Context, issue *models.Issue) {
}
}
-func NewIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) {
+func NewIssuePost(ctx *context.Context, form auth.CreateIssueForm) {
ctx.Data["Title"] = ctx.Tr("repo.issues.new")
ctx.Data["PageIsIssueList"] = true
renderAttachmentSettings(ctx)
@@ -494,7 +494,7 @@ func NewIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/issues/" + com.ToStr(issue.Index))
}
-func UploadIssueAttachment(ctx *middleware.Context) {
+func UploadIssueAttachment(ctx *context.Context) {
if !setting.AttachmentEnabled {
ctx.Error(404, "attachment is not enabled")
return
@@ -541,7 +541,7 @@ func UploadIssueAttachment(ctx *middleware.Context) {
})
}
-func ViewIssue(ctx *middleware.Context) {
+func ViewIssue(ctx *context.Context) {
ctx.Data["RequireDropzone"] = true
renderAttachmentSettings(ctx)
@@ -706,7 +706,7 @@ func ViewIssue(ctx *middleware.Context) {
ctx.HTML(200, ISSUE_VIEW)
}
-func getActionIssue(ctx *middleware.Context) *models.Issue {
+func getActionIssue(ctx *context.Context) *models.Issue {
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
if models.IsErrIssueNotExist(err) {
@@ -719,7 +719,7 @@ func getActionIssue(ctx *middleware.Context) *models.Issue {
return issue
}
-func UpdateIssueTitle(ctx *middleware.Context) {
+func UpdateIssueTitle(ctx *context.Context) {
issue := getActionIssue(ctx)
if ctx.Written() {
return
@@ -746,7 +746,7 @@ func UpdateIssueTitle(ctx *middleware.Context) {
})
}
-func UpdateIssueContent(ctx *middleware.Context) {
+func UpdateIssueContent(ctx *context.Context) {
issue := getActionIssue(ctx)
if ctx.Written() {
return
@@ -768,7 +768,7 @@ func UpdateIssueContent(ctx *middleware.Context) {
})
}
-func UpdateIssueLabel(ctx *middleware.Context) {
+func UpdateIssueLabel(ctx *context.Context) {
issue := getActionIssue(ctx)
if ctx.Written() {
return
@@ -809,7 +809,7 @@ func UpdateIssueLabel(ctx *middleware.Context) {
})
}
-func UpdateIssueMilestone(ctx *middleware.Context) {
+func UpdateIssueMilestone(ctx *context.Context) {
issue := getActionIssue(ctx)
if ctx.Written() {
return
@@ -836,7 +836,7 @@ func UpdateIssueMilestone(ctx *middleware.Context) {
})
}
-func UpdateIssueAssignee(ctx *middleware.Context) {
+func UpdateIssueAssignee(ctx *context.Context) {
issue := getActionIssue(ctx)
if ctx.Written() {
return
@@ -862,7 +862,7 @@ func UpdateIssueAssignee(ctx *middleware.Context) {
})
}
-func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) {
+func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
if models.IsErrIssueNotExist(err) {
@@ -968,7 +968,7 @@ func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) {
log.Trace("Comment created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, comment.ID)
}
-func UpdateCommentContent(ctx *middleware.Context) {
+func UpdateCommentContent(ctx *context.Context) {
comment, err := models.GetCommentByID(ctx.ParamsInt64(":id"))
if err != nil {
if models.IsErrCommentNotExist(err) {
@@ -1004,7 +1004,7 @@ func UpdateCommentContent(ctx *middleware.Context) {
})
}
-func Labels(ctx *middleware.Context) {
+func Labels(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.labels")
ctx.Data["PageIsIssueList"] = true
ctx.Data["PageIsLabels"] = true
@@ -1012,7 +1012,7 @@ func Labels(ctx *middleware.Context) {
ctx.HTML(200, LABELS)
}
-func NewLabel(ctx *middleware.Context, form auth.CreateLabelForm) {
+func NewLabel(ctx *context.Context, form auth.CreateLabelForm) {
ctx.Data["Title"] = ctx.Tr("repo.labels")
ctx.Data["PageIsLabels"] = true
@@ -1034,7 +1034,7 @@ func NewLabel(ctx *middleware.Context, form auth.CreateLabelForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/labels")
}
-func UpdateLabel(ctx *middleware.Context, form auth.CreateLabelForm) {
+func UpdateLabel(ctx *context.Context, form auth.CreateLabelForm) {
l, err := models.GetLabelByID(form.ID)
if err != nil {
switch {
@@ -1056,7 +1056,7 @@ func UpdateLabel(ctx *middleware.Context, form auth.CreateLabelForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/labels")
}
-func DeleteLabel(ctx *middleware.Context) {
+func DeleteLabel(ctx *context.Context) {
if err := models.DeleteLabel(ctx.Repo.Repository.ID, ctx.QueryInt64("id")); err != nil {
ctx.Flash.Error("DeleteLabel: " + err.Error())
} else {
@@ -1069,7 +1069,7 @@ func DeleteLabel(ctx *middleware.Context) {
return
}
-func Milestones(ctx *middleware.Context) {
+func Milestones(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.milestones")
ctx.Data["PageIsIssueList"] = true
ctx.Data["PageIsMilestones"] = true
@@ -1113,7 +1113,7 @@ func Milestones(ctx *middleware.Context) {
ctx.HTML(200, MILESTONE)
}
-func NewMilestone(ctx *middleware.Context) {
+func NewMilestone(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.milestones.new")
ctx.Data["PageIsIssueList"] = true
ctx.Data["PageIsMilestones"] = true
@@ -1122,7 +1122,7 @@ func NewMilestone(ctx *middleware.Context) {
ctx.HTML(200, MILESTONE_NEW)
}
-func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) {
+func NewMilestonePost(ctx *context.Context, form auth.CreateMilestoneForm) {
ctx.Data["Title"] = ctx.Tr("repo.milestones.new")
ctx.Data["PageIsIssueList"] = true
ctx.Data["PageIsMilestones"] = true
@@ -1158,7 +1158,7 @@ func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/milestones")
}
-func EditMilestone(ctx *middleware.Context) {
+func EditMilestone(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.milestones.edit")
ctx.Data["PageIsMilestones"] = true
ctx.Data["PageIsEditMilestone"] = true
@@ -1182,7 +1182,7 @@ func EditMilestone(ctx *middleware.Context) {
ctx.HTML(200, MILESTONE_NEW)
}
-func EditMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) {
+func EditMilestonePost(ctx *context.Context, form auth.CreateMilestoneForm) {
ctx.Data["Title"] = ctx.Tr("repo.milestones.edit")
ctx.Data["PageIsMilestones"] = true
ctx.Data["PageIsEditMilestone"] = true
@@ -1225,7 +1225,7 @@ func EditMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/milestones")
}
-func ChangeMilestonStatus(ctx *middleware.Context) {
+func ChangeMilestonStatus(ctx *context.Context) {
m, err := models.GetMilestoneByID(ctx.ParamsInt64(":id"))
if err != nil {
if models.IsErrMilestoneNotExist(err) {
@@ -1259,7 +1259,7 @@ func ChangeMilestonStatus(ctx *middleware.Context) {
}
}
-func DeleteMilestone(ctx *middleware.Context) {
+func DeleteMilestone(ctx *context.Context) {
if err := models.DeleteMilestoneByID(ctx.QueryInt64("id")); err != nil {
ctx.Flash.Error("DeleteMilestoneByID: " + err.Error())
} else {
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index fd4f6f69c5..c2147bbaf5 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -16,8 +16,8 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
+ "github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/log"
- "github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/modules/setting"
)
@@ -38,7 +38,7 @@ var (
}
)
-func getForkRepository(ctx *middleware.Context) *models.Repository {
+func getForkRepository(ctx *context.Context) *models.Repository {
forkRepo, err := models.GetRepositoryByID(ctx.ParamsInt64(":repoid"))
if err != nil {
if models.IsErrRepoNotExist(err) {
@@ -73,7 +73,7 @@ func getForkRepository(ctx *middleware.Context) *models.Repository {
return forkRepo
}
-func Fork(ctx *middleware.Context) {
+func Fork(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("new_fork")
getForkRepository(ctx)
@@ -85,7 +85,7 @@ func Fork(ctx *middleware.Context) {
ctx.HTML(200, FORK)
}
-func ForkPost(ctx *middleware.Context, form auth.CreateRepoForm) {
+func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
ctx.Data["Title"] = ctx.Tr("new_fork")
forkRepo := getForkRepository(ctx)
@@ -138,7 +138,7 @@ func ForkPost(ctx *middleware.Context, form auth.CreateRepoForm) {
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
}
-func checkPullInfo(ctx *middleware.Context) *models.Issue {
+func checkPullInfo(ctx *context.Context) *models.Issue {
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
if models.IsErrIssueNotExist(err) {
@@ -178,7 +178,7 @@ func checkPullInfo(ctx *middleware.Context) *models.Issue {
return issue
}
-func PrepareMergedViewPullInfo(ctx *middleware.Context, pull *models.Issue) {
+func PrepareMergedViewPullInfo(ctx *context.Context, pull *models.Issue) {
ctx.Data["HasMerged"] = true
var err error
@@ -203,7 +203,7 @@ func PrepareMergedViewPullInfo(ctx *middleware.Context, pull *models.Issue) {
}
}
-func PrepareViewPullInfo(ctx *middleware.Context, pull *models.Issue) *git.PullRequestInfo {
+func PrepareViewPullInfo(ctx *context.Context, pull *models.Issue) *git.PullRequestInfo {
repo := ctx.Repo.Repository
ctx.Data["HeadTarget"] = pull.HeadUserName + "/" + pull.HeadBranch
@@ -246,7 +246,7 @@ func PrepareViewPullInfo(ctx *middleware.Context, pull *models.Issue) *git.PullR
return prInfo
}
-func ViewPullCommits(ctx *middleware.Context) {
+func ViewPullCommits(ctx *context.Context) {
ctx.Data["PageIsPullCommits"] = true
pull := checkPullInfo(ctx)
@@ -296,7 +296,7 @@ func ViewPullCommits(ctx *middleware.Context) {
ctx.HTML(200, PULL_COMMITS)
}
-func ViewPullFiles(ctx *middleware.Context) {
+func ViewPullFiles(ctx *context.Context) {
ctx.Data["PageIsPullFiles"] = true
pull := checkPullInfo(ctx)
@@ -377,7 +377,7 @@ func ViewPullFiles(ctx *middleware.Context) {
ctx.HTML(200, PULL_FILES)
}
-func MergePullRequest(ctx *middleware.Context) {
+func MergePullRequest(ctx *context.Context) {
issue := checkPullInfo(ctx)
if ctx.Written() {
return
@@ -413,7 +413,7 @@ func MergePullRequest(ctx *middleware.Context) {
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pr.Index))
}
-func ParseCompareInfo(ctx *middleware.Context) (*models.User, *models.Repository, *git.Repository, *git.PullRequestInfo, string, string) {
+func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *git.Repository, *git.PullRequestInfo, string, string) {
baseRepo := ctx.Repo.Repository
// Get compared branches information
@@ -520,7 +520,7 @@ func ParseCompareInfo(ctx *middleware.Context) (*models.User, *models.Repository
}
func PrepareCompareDiff(
- ctx *middleware.Context,
+ ctx *context.Context,
headUser *models.User,
headRepo *models.Repository,
headGitRepo *git.Repository,
@@ -576,7 +576,7 @@ func PrepareCompareDiff(
return false
}
-func CompareAndPullRequest(ctx *middleware.Context) {
+func CompareAndPullRequest(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.pulls.compare_changes")
ctx.Data["PageIsComparePull"] = true
ctx.Data["IsDiffCompare"] = true
@@ -618,7 +618,7 @@ func CompareAndPullRequest(ctx *middleware.Context) {
ctx.HTML(200, COMPARE_PULL)
}
-func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueForm) {
+func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm) {
ctx.Data["Title"] = ctx.Tr("repo.pulls.compare_changes")
ctx.Data["PageIsComparePull"] = true
ctx.Data["IsDiffCompare"] = true
@@ -693,7 +693,7 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pullIssue.Index))
}
-func TriggerTask(ctx *middleware.Context) {
+func TriggerTask(ctx *context.Context) {
branch := ctx.Query("branch")
secret := ctx.Query("secret")
if len(branch) == 0 || len(secret) == 0 {
diff --git a/routers/repo/release.go b/routers/repo/release.go
index 4073fde82e..8985cdb8f5 100644
--- a/routers/repo/release.go
+++ b/routers/repo/release.go
@@ -10,9 +10,9 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
+ "github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/markdown"
- "github.com/gogits/gogs/modules/middleware"
)
const (
@@ -21,7 +21,7 @@ const (
)
// calReleaseNumCommitsBehind calculates given release has how many commits behind default branch.
-func calReleaseNumCommitsBehind(repoCtx *middleware.RepoContext, release *models.Release, countCache map[string]int64) error {
+func calReleaseNumCommitsBehind(repoCtx *context.Repository, release *models.Release, countCache map[string]int64) error {
// Fast return if release target is same as default branch.
if repoCtx.BranchName == release.Target {
release.NumCommitsBehind = repoCtx.CommitsCount - release.NumCommits
@@ -43,7 +43,7 @@ func calReleaseNumCommitsBehind(repoCtx *middleware.RepoContext, release *models
return nil
}
-func Releases(ctx *middleware.Context) {
+func Releases(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.release.releases")
ctx.Data["PageIsReleaseList"] = true
@@ -141,14 +141,14 @@ func Releases(ctx *middleware.Context) {
ctx.HTML(200, RELEASES)
}
-func NewRelease(ctx *middleware.Context) {
+func NewRelease(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
ctx.Data["PageIsReleaseList"] = true
ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch
ctx.HTML(200, RELEASE_NEW)
}
-func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
+func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) {
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
ctx.Data["PageIsReleaseList"] = true
@@ -201,7 +201,7 @@ func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/releases")
}
-func EditRelease(ctx *middleware.Context) {
+func EditRelease(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
ctx.Data["PageIsReleaseList"] = true
ctx.Data["PageIsEditRelease"] = true
@@ -226,7 +226,7 @@ func EditRelease(ctx *middleware.Context) {
ctx.HTML(200, RELEASE_NEW)
}
-func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) {
+func EditReleasePost(ctx *context.Context, form auth.EditReleaseForm) {
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
ctx.Data["PageIsReleaseList"] = true
ctx.Data["PageIsEditRelease"] = true
@@ -263,7 +263,7 @@ func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/releases")
}
-func DeleteRelease(ctx *middleware.Context) {
+func DeleteRelease(ctx *context.Context) {
if err := models.DeleteReleaseByID(ctx.QueryInt64("id")); err != nil {
ctx.Flash.Error("DeleteReleaseByID: " + err.Error())
} else {
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index eb944acebc..f9835bd2f9 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -17,8 +17,8 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
+ "github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/log"
- "github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/modules/setting"
)
@@ -27,13 +27,13 @@ const (
MIGRATE base.TplName = "repo/migrate"
)
-func MustBeNotBare(ctx *middleware.Context) {
+func MustBeNotBare(ctx *context.Context) {
if ctx.Repo.Repository.IsBare {
ctx.Handle(404, "MustBeNotBare", nil)
}
}
-func checkContextUser(ctx *middleware.Context, uid int64) *models.User {
+func checkContextUser(ctx *context.Context, uid int64) *models.User {
orgs, err := models.GetOwnedOrgsByUserIDDesc(ctx.User.Id, "updated_unix")
if err != nil {
ctx.Handle(500, "GetOwnedOrgsByUserIDDesc", err)
@@ -64,7 +64,7 @@ func checkContextUser(ctx *middleware.Context, uid int64) *models.User {
return org
}
-func Create(ctx *middleware.Context) {
+func Create(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("new_repo")
// Give default value for template to render.
@@ -84,7 +84,7 @@ func Create(ctx *middleware.Context) {
ctx.HTML(200, CREATE)
}
-func handleCreateError(ctx *middleware.Context, owner *models.User, err error, name string, tpl base.TplName, form interface{}) {
+func handleCreateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form interface{}) {
switch {
case models.IsErrReachLimitOfRepo(err):
ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.RepoCreationNum()), tpl, form)
@@ -102,7 +102,7 @@ func handleCreateError(ctx *middleware.Context, owner *models.User, err error, n
}
}
-func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
+func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
ctx.Data["Title"] = ctx.Tr("new_repo")
ctx.Data["Gitignores"] = models.Gitignores
@@ -144,7 +144,7 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
handleCreateError(ctx, ctxUser, err, "CreatePost", CREATE, &form)
}
-func Migrate(ctx *middleware.Context) {
+func Migrate(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("new_migrate")
ctx.Data["private"] = ctx.User.LastRepoVisibility
ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate
@@ -159,7 +159,7 @@ func Migrate(ctx *middleware.Context) {
ctx.HTML(200, MIGRATE)
}
-func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
+func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
ctx.Data["Title"] = ctx.Tr("new_migrate")
ctxUser := checkContextUser(ctx, form.Uid)
@@ -227,7 +227,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
handleCreateError(ctx, ctxUser, err, "MigratePost", MIGRATE, &form)
}
-func Action(ctx *middleware.Context) {
+func Action(ctx *context.Context) {
var err error
switch ctx.Params(":action") {
case "watch":
@@ -261,7 +261,7 @@ func Action(ctx *middleware.Context) {
ctx.Redirect(redirectTo)
}
-func Download(ctx *middleware.Context) {
+func Download(ctx *context.Context) {
var (
uri = ctx.Params("*")
refName string
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index cf6f6a11c7..6785722422 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -13,9 +13,9 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
+ "github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/mailer"
- "github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/modules/setting"
)
@@ -27,13 +27,13 @@ const (
DEPLOY_KEYS base.TplName = "repo/settings/deploy_keys"
)
-func Settings(ctx *middleware.Context) {
+func Settings(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings")
ctx.Data["PageIsSettingsOptions"] = true
ctx.HTML(200, SETTINGS_OPTIONS)
}
-func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
+func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
ctx.Data["Title"] = ctx.Tr("repo.settings")
ctx.Data["PageIsSettingsOptions"] = true
@@ -271,7 +271,7 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
}
}
-func Collaboration(ctx *middleware.Context) {
+func Collaboration(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings")
ctx.Data["PageIsSettingsCollaboration"] = true
@@ -285,7 +285,7 @@ func Collaboration(ctx *middleware.Context) {
ctx.HTML(200, COLLABORATION)
}
-func CollaborationPost(ctx *middleware.Context) {
+func CollaborationPost(ctx *context.Context) {
name := strings.ToLower(ctx.Query("collaborator"))
if len(name) == 0 || ctx.Repo.Owner.LowerName == name {
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
@@ -333,7 +333,7 @@ func CollaborationPost(ctx *middleware.Context) {
ctx.Redirect(setting.AppSubUrl + ctx.Req.URL.Path)
}
-func ChangeCollaborationAccessMode(ctx *middleware.Context) {
+func ChangeCollaborationAccessMode(ctx *context.Context) {
if err := ctx.Repo.Repository.ChangeCollaborationAccessMode(
ctx.QueryInt64("uid"),
models.AccessMode(ctx.QueryInt("mode"))); err != nil {
@@ -341,7 +341,7 @@ func ChangeCollaborationAccessMode(ctx *middleware.Context) {
}
}
-func DeleteCollaboration(ctx *middleware.Context) {
+func DeleteCollaboration(ctx *context.Context) {
if err := ctx.Repo.Repository.DeleteCollaboration(ctx.QueryInt64("id")); err != nil {
ctx.Flash.Error("DeleteCollaboration: " + err.Error())
} else {
@@ -353,7 +353,7 @@ func DeleteCollaboration(ctx *middleware.Context) {
})
}
-func parseOwnerAndRepo(ctx *middleware.Context) (*models.User, *models.Repository) {
+func parseOwnerAndRepo(ctx *context.Context) (*models.User, *models.Repository) {
owner, err := models.GetUserByName(ctx.Params(":username"))
if err != nil {
if models.IsErrUserNotExist(err) {
@@ -377,7 +377,7 @@ func parseOwnerAndRepo(ctx *middleware.Context) (*models.User, *models.Repositor
return owner, repo
}
-func GitHooks(ctx *middleware.Context) {
+func GitHooks(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.githooks")
ctx.Data["PageIsSettingsGitHooks"] = true
@@ -391,7 +391,7 @@ func GitHooks(ctx *middleware.Context) {
ctx.HTML(200, GITHOOKS)
}
-func GitHooksEdit(ctx *middleware.Context) {
+func GitHooksEdit(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.githooks")
ctx.Data["PageIsSettingsGitHooks"] = true
@@ -409,7 +409,7 @@ func GitHooksEdit(ctx *middleware.Context) {
ctx.HTML(200, GITHOOK_EDIT)
}
-func GitHooksEditPost(ctx *middleware.Context) {
+func GitHooksEditPost(ctx *context.Context) {
name := ctx.Params(":name")
hook, err := ctx.Repo.GitRepo.GetHook(name)
if err != nil {
@@ -428,7 +428,7 @@ func GitHooksEditPost(ctx *middleware.Context) {
ctx.Redirect(ctx.Repo.RepoLink + "/settings/hooks/git")
}
-func DeployKeys(ctx *middleware.Context) {
+func DeployKeys(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.deploy_keys")
ctx.Data["PageIsSettingsKeys"] = true
@@ -442,7 +442,7 @@ func DeployKeys(ctx *middleware.Context) {
ctx.HTML(200, DEPLOY_KEYS)
}
-func DeployKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
+func DeployKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
ctx.Data["Title"] = ctx.Tr("repo.settings.deploy_keys")
ctx.Data["PageIsSettingsKeys"] = true
@@ -492,7 +492,7 @@ func DeployKeysPost(ctx *middleware.Context, form auth.AddSSHKeyForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/settings/keys")
}
-func DeleteDeployKey(ctx *middleware.Context) {
+func DeleteDeployKey(ctx *context.Context) {
if err := models.DeleteDeployKey(ctx.User, ctx.QueryInt64("id")); err != nil {
ctx.Flash.Error("DeleteDeployKey: " + err.Error())
} else {
diff --git a/routers/repo/view.go b/routers/repo/view.go
index efff31a9a0..f4242cd52d 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -16,9 +16,9 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/base"
+ "github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/markdown"
- "github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/modules/template"
"github.com/gogits/gogs/modules/template/highlight"
)
@@ -29,7 +29,7 @@ const (
FORKS base.TplName = "repo/forks"
)
-func Home(ctx *middleware.Context) {
+func Home(ctx *context.Context) {
ctx.Data["Title"] = ctx.Repo.Repository.Name
ctx.Data["PageIsViewCode"] = true
ctx.Data["RequireHighlightJS"] = true
@@ -219,7 +219,7 @@ func Home(ctx *middleware.Context) {
ctx.HTML(200, HOME)
}
-func RenderUserCards(ctx *middleware.Context, total int, getter func(page int) ([]*models.User, error), tpl base.TplName) {
+func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]*models.User, error), tpl base.TplName) {
page := ctx.QueryInt("page")
if page <= 0 {
page = 1
@@ -237,21 +237,21 @@ func RenderUserCards(ctx *middleware.Context, total int, getter func(page int) (
ctx.HTML(200, tpl)
}
-func Watchers(ctx *middleware.Context) {
+func Watchers(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.watchers")
ctx.Data["CardsTitle"] = ctx.Tr("repo.watchers")
ctx.Data["PageIsWatchers"] = true
RenderUserCards(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers, WATCHERS)
}
-func Stars(ctx *middleware.Context) {
+func Stars(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.stargazers")
ctx.Data["CardsTitle"] = ctx.Tr("repo.stargazers")
ctx.Data["PageIsStargazers"] = true
RenderUserCards(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers, WATCHERS)
}
-func Forks(ctx *middleware.Context) {
+func Forks(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repos.forks")
forks, err := ctx.Repo.Repository.GetForks()
diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go
index 6d271a4fe0..16aa3821a8 100644
--- a/routers/repo/webhook.go
+++ b/routers/repo/webhook.go
@@ -18,7 +18,7 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
- "github.com/gogits/gogs/modules/middleware"
+ "github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/setting"
)
@@ -28,7 +28,7 @@ const (
ORG_HOOK_NEW base.TplName = "org/settings/hook_new"
)
-func Webhooks(ctx *middleware.Context) {
+func Webhooks(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.hooks")
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["BaseLink"] = ctx.Repo.RepoLink
@@ -52,7 +52,7 @@ type OrgRepoCtx struct {
}
// getOrgRepoCtx determines whether this is a repo context or organization context.
-func getOrgRepoCtx(ctx *middleware.Context) (*OrgRepoCtx, error) {
+func getOrgRepoCtx(ctx *context.Context) (*OrgRepoCtx, error) {
if len(ctx.Repo.RepoLink) > 0 {
return &OrgRepoCtx{
RepoID: ctx.Repo.Repository.ID,
@@ -72,7 +72,7 @@ func getOrgRepoCtx(ctx *middleware.Context) (*OrgRepoCtx, error) {
return nil, errors.New("Unable to set OrgRepo context")
}
-func checkHookType(ctx *middleware.Context) string {
+func checkHookType(ctx *context.Context) string {
hookType := strings.ToLower(ctx.Params(":type"))
if !com.IsSliceContainsStr(setting.Webhook.Types, hookType) {
ctx.Handle(404, "checkHookType", nil)
@@ -81,7 +81,7 @@ func checkHookType(ctx *middleware.Context) string {
return hookType
}
-func WebhooksNew(ctx *middleware.Context) {
+func WebhooksNew(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksNew"] = true
@@ -114,7 +114,7 @@ func ParseHookEvent(form auth.WebhookForm) *models.HookEvent {
}
}
-func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) {
+func WebHooksNewPost(ctx *context.Context, form auth.NewWebhookForm) {
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksNew"] = true
@@ -160,7 +160,7 @@ func WebHooksNewPost(ctx *middleware.Context, form auth.NewWebhookForm) {
ctx.Redirect(orCtx.Link + "/settings/hooks")
}
-func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
+func SlackHooksNewPost(ctx *context.Context, form auth.NewSlackHookForm) {
ctx.Data["Title"] = ctx.Tr("repo.settings")
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksNew"] = true
@@ -210,7 +210,7 @@ func SlackHooksNewPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
ctx.Redirect(orCtx.Link + "/settings/hooks")
}
-func checkWebhook(ctx *middleware.Context) (*OrgRepoCtx, *models.Webhook) {
+func checkWebhook(ctx *context.Context) (*OrgRepoCtx, *models.Webhook) {
ctx.Data["RequireHighlightJS"] = true
orCtx, err := getOrgRepoCtx(ctx)
@@ -245,7 +245,7 @@ func checkWebhook(ctx *middleware.Context) (*OrgRepoCtx, *models.Webhook) {
return orCtx, w
}
-func WebHooksEdit(ctx *middleware.Context) {
+func WebHooksEdit(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksEdit"] = true
@@ -259,7 +259,7 @@ func WebHooksEdit(ctx *middleware.Context) {
ctx.HTML(200, orCtx.NewTemplate)
}
-func WebHooksEditPost(ctx *middleware.Context, form auth.NewWebhookForm) {
+func WebHooksEditPost(ctx *context.Context, form auth.NewWebhookForm) {
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksEdit"] = true
@@ -297,7 +297,7 @@ func WebHooksEditPost(ctx *middleware.Context, form auth.NewWebhookForm) {
ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID))
}
-func SlackHooksEditPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
+func SlackHooksEditPost(ctx *context.Context, form auth.NewSlackHookForm) {
ctx.Data["Title"] = ctx.Tr("repo.settings")
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksEdit"] = true
@@ -340,7 +340,7 @@ func SlackHooksEditPost(ctx *middleware.Context, form auth.NewSlackHookForm) {
ctx.Redirect(fmt.Sprintf("%s/settings/hooks/%d", orCtx.Link, w.ID))
}
-func TestWebhook(ctx *middleware.Context) {
+func TestWebhook(ctx *context.Context) {
p := &api.PushPayload{
Ref: git.BRANCH_PREFIX + ctx.Repo.Repository.DefaultBranch,
Before: ctx.Repo.CommitID,
@@ -378,7 +378,7 @@ func TestWebhook(ctx *middleware.Context) {
}
}
-func DeleteWebhook(ctx *middleware.Context) {
+func DeleteWebhook(ctx *context.Context) {
if err := models.DeleteWebhook(ctx.QueryInt64("id")); err != nil {
ctx.Flash.Error("DeleteWebhook: " + err.Error())
} else {
diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go
index 4975080d20..e0b3e692c1 100644
--- a/routers/repo/wiki.go
+++ b/routers/repo/wiki.go
@@ -14,8 +14,8 @@ import (
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
+ "github.com/gogits/gogs/modules/context"
"github.com/gogits/gogs/modules/markdown"
- "github.com/gogits/gogs/modules/middleware"
)
const (
@@ -25,7 +25,7 @@ const (
WIKI_PAGES base.TplName = "repo/wiki/pages"
)
-func MustEnableWiki(ctx *middleware.Context) {
+func MustEnableWiki(ctx *context.Context) {
if !ctx.Repo.Repository.EnableWiki {
ctx.Handle(404, "MustEnableWiki", nil)
return
@@ -43,7 +43,7 @@ type PageMeta struct {
Updated time.Time
}
-func renderWikiPage(ctx *middleware.Context, isViewPage bool) (*git.Repository, string) {
+func renderWikiPage(ctx *context.Context, isViewPage bool) (*git.Repository, string) {
wikiRepo, err := git.OpenRepository(ctx.Repo.Repository.WikiPath())
if err != nil {
ctx.Handle(500, "OpenRepository", err)
@@ -115,7 +115,7 @@ func renderWikiPage(ctx *middleware.Context, isViewPage bool) (*git.Repository,
return wikiRepo, pageName
}
-func Wiki(ctx *middleware.Context) {
+func Wiki(ctx *context.Context) {
ctx.Data["PageIsWiki"] = true
if !ctx.Repo.Repository.HasWiki() {
@@ -140,7 +140,7 @@ func Wiki(ctx *middleware.Context) {
ctx.HTML(200, WIKI_VIEW)
}
-func WikiPages(ctx *middleware.Context) {
+func WikiPages(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.wiki.pages")
ctx.Data["PageIsWiki"] = true
@@ -186,7 +186,7 @@ func WikiPages(ctx *middleware.Context) {
ctx.HTML(200, WIKI_PAGES)
}
-func NewWiki(ctx *middleware.Context) {
+func NewWiki(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page")
ctx.Data["PageIsWiki"] = true
ctx.Data["RequireSimpleMDE"] = true
@@ -198,7 +198,7 @@ func NewWiki(ctx *middleware.Context) {
ctx.HTML(200, WIKI_NEW)
}
-func NewWikiPost(ctx *middleware.Context, form auth.NewWikiForm) {
+func NewWikiPost(ctx *context.Context, form auth.NewWikiForm) {
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page")
ctx.Data["PageIsWiki"] = true
ctx.Data["RequireSimpleMDE"] = true
@@ -221,7 +221,7 @@ func NewWikiPost(ctx *middleware.Context, form auth.NewWikiForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(form.Title))
}
-func EditWiki(ctx *middleware.Context) {
+func EditWiki(ctx *context.Context) {
ctx.Data["PageIsWiki"] = true
ctx.Data["PageIsWikiEdit"] = true
ctx.Data["RequireSimpleMDE"] = true
@@ -239,7 +239,7 @@ func EditWiki(ctx *middleware.Context) {
ctx.HTML(200, WIKI_NEW)
}
-func EditWikiPost(ctx *middleware.Context, form auth.NewWikiForm) {
+func EditWikiPost(ctx *context.Context, form auth.NewWikiForm) {
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page")
ctx.Data["PageIsWiki"] = true
ctx.Data["RequireSimpleMDE"] = true
@@ -257,7 +257,7 @@ func EditWikiPost(ctx *middleware.Context, form auth.NewWikiForm) {
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + models.ToWikiPageURL(form.Title))
}
-func DeleteWikiPagePost(ctx *middleware.Context) {
+func DeleteWikiPagePost(ctx *context.Context) {
pageURL := ctx.Params(":page")
if len(pageURL) == 0 {
pageURL = "Home"