aboutsummaryrefslogtreecommitdiffstats
path: root/l10n/templates
diff options
context:
space:
mode:
Diffstat (limited to 'l10n/templates')
-rw-r--r--l10n/templates/core.pot2
-rw-r--r--l10n/templates/files.pot2
-rw-r--r--l10n/templates/files_encryption.pot2
-rw-r--r--l10n/templates/files_external.pot2
-rw-r--r--l10n/templates/files_sharing.pot2
-rw-r--r--l10n/templates/files_trashbin.pot2
-rw-r--r--l10n/templates/files_versions.pot2
-rw-r--r--l10n/templates/lib.pot2
-rw-r--r--l10n/templates/private.pot2
-rw-r--r--l10n/templates/settings.pot26
-rw-r--r--l10n/templates/user_ldap.pot2
-rw-r--r--l10n/templates/user_webdavauth.pot2
12 files changed, 24 insertions, 24 deletions
diff --git a/l10n/templates/core.pot b/l10n/templates/core.pot
index db83a13d3ef..19da0eb1bc2 100644
--- a/l10n/templates/core.pot
+++ b/l10n/templates/core.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:54-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files.pot b/l10n/templates/files.pot
index fae34af9b91..5c3ce3328c9 100644
--- a/l10n/templates/files.pot
+++ b/l10n/templates/files.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:54-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_encryption.pot b/l10n/templates/files_encryption.pot
index 7f9ff02a5e2..c2190c33129 100644
--- a/l10n/templates/files_encryption.pot
+++ b/l10n/templates/files_encryption.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:54-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_external.pot b/l10n/templates/files_external.pot
index 2c745157a39..0e58511397c 100644
--- a/l10n/templates/files_external.pot
+++ b/l10n/templates/files_external.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:54-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_sharing.pot b/l10n/templates/files_sharing.pot
index 8b413120455..c6cd18c7da6 100644
--- a/l10n/templates/files_sharing.pot
+++ b/l10n/templates/files_sharing.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:54-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_trashbin.pot b/l10n/templates/files_trashbin.pot
index 499fc47b987..0cbf30da9be 100644
--- a/l10n/templates/files_trashbin.pot
+++ b/l10n/templates/files_trashbin.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:54-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/files_versions.pot b/l10n/templates/files_versions.pot
index d1ad5c42f3c..c7bd658b6ab 100644
--- a/l10n/templates/files_versions.pot
+++ b/l10n/templates/files_versions.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:54-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/lib.pot b/l10n/templates/lib.pot
index dd7839e7b0c..21a4b38ba7d 100644
--- a/l10n/templates/lib.pot
+++ b/l10n/templates/lib.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:55-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/private.pot b/l10n/templates/private.pot
index d5836a75d3f..d91728a8629 100644
--- a/l10n/templates/private.pot
+++ b/l10n/templates/private.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:55-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/settings.pot b/l10n/templates/settings.pot
index a176064439c..0e40aa992ef 100644
--- a/l10n/templates/settings.pot
+++ b/l10n/templates/settings.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:55-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,18 +17,6 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ajax/apps/categories.php:14
-msgid "Enabled"
-msgstr ""
-
-#: ajax/apps/categories.php:15
-msgid "Not enabled"
-msgstr ""
-
-#: ajax/apps/categories.php:19
-msgid "Recommended"
-msgstr ""
-
#: ajax/changedisplayname.php:25 ajax/removeuser.php:15 ajax/setquota.php:17
#: ajax/togglegroups.php:20 changepassword/controller.php:49
msgid "Authentication error"
@@ -158,6 +146,18 @@ msgstr ""
msgid "Unable to change password"
msgstr ""
+#: controller/appsettingscontroller.php:51
+msgid "Enabled"
+msgstr ""
+
+#: controller/appsettingscontroller.php:52
+msgid "Not enabled"
+msgstr ""
+
+#: controller/appsettingscontroller.php:56
+msgid "Recommended"
+msgstr ""
+
#: controller/mailsettingscontroller.php:103
#: controller/mailsettingscontroller.php:121
msgid "Saved"
diff --git a/l10n/templates/user_ldap.pot b/l10n/templates/user_ldap.pot
index edc4143ba34..46767a0ecb9 100644
--- a/l10n/templates/user_ldap.pot
+++ b/l10n/templates/user_ldap.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:54-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/l10n/templates/user_webdavauth.pot b/l10n/templates/user_webdavauth.pot
index eb6a314a5a6..544f02631db 100644
--- a/l10n/templates/user_webdavauth.pot
+++ b/l10n/templates/user_webdavauth.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ownCloud Core 6.0.0\n"
"Report-Msgid-Bugs-To: translations@owncloud.org\n"
-"POT-Creation-Date: 2014-10-28 01:54-0400\n"
+"POT-Creation-Date: 2014-10-29 01:54-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
="mi">0 { assigneeIDs, err = base.StringsToInt64s(strings.Split(form.AssigneeIDs, ",")) if err != nil { return nil, nil, 0 } // Check if the passed assignees actually exists and is assignable for _, aID := range assigneeIDs { assignee, err := models.GetUserByID(aID) if err != nil { ctx.ServerError("GetUserByID", err) return nil, nil, 0 } valid, err := models.CanBeAssigned(assignee, repo, isPull) if err != nil { ctx.ServerError("canBeAssigned", err) return nil, nil, 0 } if !valid { ctx.ServerError("canBeAssigned", models.ErrUserDoesNotHaveAccessToRepo{UserID: aID, RepoName: repo.Name}) return nil, nil, 0 } } } // Keep the old assignee id thingy for compatibility reasons if form.AssigneeID > 0 { assigneeIDs = append(assigneeIDs, form.AssigneeID) } return labelIDs, assigneeIDs, milestoneID } // NewIssuePost response for creating new issue func NewIssuePost(ctx *context.Context, form auth.CreateIssueForm) { ctx.Data["Title"] = ctx.Tr("repo.issues.new") ctx.Data["PageIsIssueList"] = true ctx.Data["RequireHighlightJS"] = true ctx.Data["RequireSimpleMDE"] = true ctx.Data["ReadOnly"] = false ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes renderAttachmentSettings(ctx) var ( repo = ctx.Repo.Repository attachments []string ) labelIDs, assigneeIDs, milestoneID := ValidateRepoMetas(ctx, form, false) if ctx.Written() { return } if setting.AttachmentEnabled { attachments = form.Files } if ctx.HasError() { ctx.HTML(200, tplIssueNew) return } if util.IsEmptyString(form.Title) { ctx.RenderWithErr(ctx.Tr("repo.issues.new.title_empty"), tplIssueNew, form) return } issue := &models.Issue{ RepoID: repo.ID, Title: form.Title, PosterID: ctx.User.ID, Poster: ctx.User, MilestoneID: milestoneID, Content: form.Content, Ref: form.Ref, } if err := issue_service.NewIssue(repo, issue, labelIDs, attachments, assigneeIDs); err != nil { if models.IsErrUserDoesNotHaveAccessToRepo(err) { ctx.Error(400, "UserDoesNotHaveAccessToRepo", err.Error()) return } ctx.ServerError("NewIssue", err) return } log.Trace("Issue created: %d/%d", repo.ID, issue.ID) ctx.Redirect(ctx.Repo.RepoLink + "/issues/" + com.ToStr(issue.Index)) } // commentTag returns the CommentTag for a comment in/with the given repo, poster and issue func commentTag(repo *models.Repository, poster *models.User, issue *models.Issue) (models.CommentTag, error) { perm, err := models.GetUserRepoPermission(repo, poster) if err != nil { return models.CommentTagNone, err } if perm.IsOwner() { return models.CommentTagOwner, nil } else if poster.ID == issue.PosterID { return models.CommentTagPoster, nil } else if perm.CanWrite(models.UnitTypeCode) { return models.CommentTagWriter, nil } return models.CommentTagNone, nil } // ViewIssue render issue view page func ViewIssue(ctx *context.Context) { if ctx.Params(":type") == "issues" { // If issue was requested we check if repo has external tracker and redirect extIssueUnit, err := ctx.Repo.Repository.GetUnit(models.UnitTypeExternalTracker) if err == nil && extIssueUnit != nil { if extIssueUnit.ExternalTrackerConfig().ExternalTrackerStyle == markup.IssueNameStyleNumeric || extIssueUnit.ExternalTrackerConfig().ExternalTrackerStyle == "" { metas := ctx.Repo.Repository.ComposeMetas() metas["index"] = ctx.Params(":index") ctx.Redirect(com.Expand(extIssueUnit.ExternalTrackerConfig().ExternalTrackerFormat, metas)) return } } else if err != nil && !models.IsErrUnitTypeNotExist(err) { ctx.ServerError("GetUnit", err) return } } issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { if models.IsErrIssueNotExist(err) { ctx.NotFound("GetIssueByIndex", err) } else { ctx.ServerError("GetIssueByIndex", err) } return } // Make sure type and URL matches. if ctx.Params(":type") == "issues" && issue.IsPull { ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(issue.Index)) return } else if ctx.Params(":type") == "pulls" && !issue.IsPull { ctx.Redirect(ctx.Repo.RepoLink + "/issues/" + com.ToStr(issue.Index)) return } if issue.IsPull { MustAllowPulls(ctx) if ctx.Written() { return } ctx.Data["PageIsPullList"] = true ctx.Data["PageIsPullConversation"] = true } else { MustEnableIssues(ctx) if ctx.Written() { return } ctx.Data["PageIsIssueList"] = true } ctx.Data["RequireHighlightJS"] = true ctx.Data["RequireDropzone"] = true ctx.Data["RequireTribute"] = true renderAttachmentSettings(ctx) if err = issue.LoadAttributes(); err != nil { ctx.ServerError("LoadAttributes", err) return } if err = filterXRefComments(ctx, issue); err != nil { ctx.ServerError("filterXRefComments", err) return } ctx.Data["Title"] = fmt.Sprintf("#%d - %s", issue.Index, issue.Title) var iw *models.IssueWatch var exists bool if ctx.User != nil { iw, exists, err = models.GetIssueWatch(ctx.User.ID, issue.ID) if err != nil { ctx.ServerError("GetIssueWatch", err) return } if !exists { iw = &models.IssueWatch{ UserID: ctx.User.ID, IssueID: issue.ID, IsWatching: models.IsWatching(ctx.User.ID, ctx.Repo.Repository.ID), } } } ctx.Data["IssueWatch"] = iw ctx.Data["AllowedReactions"] = setting.UI.Reactions issue.RenderedContent = string(markdown.Render([]byte(issue.Content), ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas())) repo := ctx.Repo.Repository // Get more information if it's a pull request. if issue.IsPull { if issue.PullRequest.HasMerged { ctx.Data["DisableStatusChange"] = issue.PullRequest.HasMerged PrepareMergedViewPullInfo(ctx, issue) } else { PrepareViewPullInfo(ctx, issue) ctx.Data["DisableStatusChange"] = ctx.Data["IsPullRequestBroken"] == true && issue.IsClosed } if ctx.Written() { return } } // Metas. // Check labels. labelIDMark := make(map[int64]bool) for i := range issue.Labels { labelIDMark[issue.Labels[i].ID] = true } labels, err := models.GetLabelsByRepoID(repo.ID, "") if err != nil { ctx.ServerError("GetLabelsByRepoID", err) return } hasSelected := false for i := range labels { if labelIDMark[labels[i].ID] { labels[i].IsChecked = true hasSelected = true } } ctx.Data["HasSelectedLabel"] = hasSelected ctx.Data["Labels"] = labels // Check milestone and assignee. if ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) { RetrieveRepoMilestonesAndAssignees(ctx, repo) if ctx.Written() { return } } if ctx.IsSigned { // Update issue-user. if err = issue.ReadBy(ctx.User.ID); err != nil { ctx.ServerError("ReadBy", err) return } } var ( tag models.CommentTag ok bool marked = make(map[int64]models.CommentTag) comment *models.Comment participants = make([]*models.User, 1, 10) ) if ctx.Repo.Repository.IsTimetrackerEnabled() { if ctx.IsSigned { // Deal with the stopwatch ctx.Data["IsStopwatchRunning"] = models.StopwatchExists(ctx.User.ID, issue.ID) if !ctx.Data["IsStopwatchRunning"].(bool) { var exists bool var sw *models.Stopwatch if exists, sw, err = models.HasUserStopwatch(ctx.User.ID); err != nil { ctx.ServerError("HasUserStopwatch", err) return } ctx.Data["HasUserStopwatch"] = exists if exists { // Add warning if the user has already a stopwatch var otherIssue *models.Issue if otherIssue, err = models.GetIssueByID(sw.IssueID); err != nil { ctx.ServerError("GetIssueByID", err) return } if err = otherIssue.LoadRepo(); err != nil { ctx.ServerError("LoadRepo", err) return } // Add link to the issue of the already running stopwatch ctx.Data["OtherStopwatchURL"] = otherIssue.HTMLURL() } } ctx.Data["CanUseTimetracker"] = ctx.Repo.CanUseTimetracker(issue, ctx.User) } else { ctx.Data["CanUseTimetracker"] = false } if ctx.Data["WorkingUsers"], err = models.TotalTimes(models.FindTrackedTimesOptions{IssueID: issue.ID}); err != nil { ctx.ServerError("TotalTimes", err) return } } // Check if the user can use the dependencies ctx.Data["CanCreateIssueDependencies"] = ctx.Repo.CanCreateIssueDependencies(ctx.User) // check if dependencies can be created across repositories ctx.Data["AllowCrossRepositoryDependencies"] = setting.Service.AllowCrossRepositoryDependencies // Render comments and and fetch participants. participants[0] = issue.Poster for _, comment = range issue.Comments { comment.Issue = issue if err := comment.LoadPoster(); err != nil { ctx.ServerError("LoadPoster", err) return } if comment.Type == models.CommentTypeComment { if err := comment.LoadAttachments(); err != nil { ctx.ServerError("LoadAttachments", err) return } comment.RenderedContent = string(markdown.Render([]byte(comment.Content), ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas())) // Check tag. tag, ok = marked[comment.PosterID] if ok { comment.ShowTag = tag continue } comment.ShowTag, err = commentTag(repo, comment.Poster, issue) if err != nil { ctx.ServerError("commentTag", err) return } marked[comment.PosterID] = comment.ShowTag participants = addParticipant(comment.Poster, participants) } else if comment.Type == models.CommentTypeLabel { if err = comment.LoadLabel(); err != nil { ctx.ServerError("LoadLabel", err) return } } else if comment.Type == models.CommentTypeMilestone { if err = comment.LoadMilestone(); err != nil { ctx.ServerError("LoadMilestone", err) return } ghostMilestone := &models.Milestone{ ID: -1, Name: ctx.Tr("repo.issues.deleted_milestone"), } if comment.OldMilestoneID > 0 && comment.OldMilestone == nil { comment.OldMilestone = ghostMilestone } if comment.MilestoneID > 0 && comment.Milestone == nil { comment.Milestone = ghostMilestone } } else if comment.Type == models.CommentTypeAssignees { if err = comment.LoadAssigneeUser(); err != nil { ctx.ServerError("LoadAssigneeUser", err) return } } else if comment.Type == models.CommentTypeRemoveDependency || comment.Type == models.CommentTypeAddDependency { if err = comment.LoadDepIssueDetails(); err != nil { ctx.ServerError("LoadDepIssueDetails", err) return } } else if comment.Type == models.CommentTypeCode || comment.Type == models.CommentTypeReview { if err = comment.LoadReview(); err != nil && !models.IsErrReviewNotExist(err) { ctx.ServerError("LoadReview", err) return } participants = addParticipant(comment.Poster, participants) if comment.Review == nil { continue } if err = comment.Review.LoadAttributes(); err != nil { if !models.IsErrUserNotExist(err) { ctx.ServerError("Review.LoadAttributes", err) return } comment.Review.Reviewer = models.NewGhostUser() } if err = comment.Review.LoadCodeComments(); err != nil { ctx.ServerError("Review.LoadCodeComments", err) return } } } if issue.IsPull { pull := issue.PullRequest pull.Issue = issue canDelete := false if ctx.IsSigned { if err := pull.GetHeadRepo(); err != nil { log.Error("GetHeadRepo: %v", err) } else if pull.HeadRepo != nil && pull.HeadBranch != pull.HeadRepo.DefaultBranch { perm, err := models.GetUserRepoPermission(pull.HeadRepo, ctx.User) if err != nil { ctx.ServerError("GetUserRepoPermission", err) return } if perm.CanWrite(models.UnitTypeCode) { // Check if branch is not protected if protected, err := pull.HeadRepo.IsProtectedBranch(pull.HeadBranch, ctx.User); err != nil { log.Error("IsProtectedBranch: %v", err) } else if !protected { canDelete = true ctx.Data["DeleteBranchLink"] = ctx.Repo.RepoLink + "/pulls/" + com.ToStr(issue.Index) + "/cleanup" } } } } prUnit, err := repo.GetUnit(models.UnitTypePullRequests) if err != nil { ctx.ServerError("GetUnit", err) return } prConfig := prUnit.PullRequestsConfig() ctx.Data["AllowMerge"] = ctx.Repo.CanWrite(models.UnitTypeCode) if err := pull.CheckUserAllowedToMerge(ctx.User); err != nil { if !models.IsErrNotAllowedToMerge(err) { ctx.ServerError("CheckUserAllowedToMerge", err) return } ctx.Data["AllowMerge"] = false } // Check correct values and select default if ms, ok := ctx.Data["MergeStyle"].(models.MergeStyle); !ok || !prConfig.IsMergeStyleAllowed(ms) { if prConfig.AllowMerge { ctx.Data["MergeStyle"] = models.MergeStyleMerge } else if prConfig.AllowRebase { ctx.Data["MergeStyle"] = models.MergeStyleRebase } else if prConfig.AllowRebaseMerge { ctx.Data["MergeStyle"] = models.MergeStyleRebaseMerge } else if prConfig.AllowSquash { ctx.Data["MergeStyle"] = models.MergeStyleSquash } else { ctx.Data["MergeStyle"] = "" } } if err = pull.LoadProtectedBranch(); err != nil { ctx.ServerError("LoadProtectedBranch", err) return } if pull.ProtectedBranch != nil { cnt := pull.ProtectedBranch.GetGrantedApprovalsCount(pull) ctx.Data["IsBlockedByApprovals"] = pull.ProtectedBranch.RequiredApprovals > 0 && cnt < pull.ProtectedBranch.RequiredApprovals ctx.Data["GrantedApprovals"] = cnt } ctx.Data["IsPullBranchDeletable"] = canDelete && pull.HeadRepo != nil && git.IsBranchExist(pull.HeadRepo.RepoPath(), pull.HeadBranch) ctx.Data["PullReviewers"], err = models.GetReviewersByIssueID(issue.ID) if err != nil { ctx.ServerError("GetReviewersByIssueID", err) return } } // Get Dependencies ctx.Data["BlockedByDependencies"], err = issue.BlockedByDependencies() if err != nil { ctx.ServerError("BlockedByDependencies", err) return } ctx.Data["BlockingDependencies"], err = issue.BlockingDependencies() if err != nil { ctx.ServerError("BlockingDependencies", err) return } ctx.Data["Participants"] = participants ctx.Data["NumParticipants"] = len(participants) ctx.Data["Issue"] = issue ctx.Data["ReadOnly"] = true ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login?redirect_to=" + ctx.Data["Link"].(string) ctx.Data["IsIssuePoster"] = ctx.IsSigned && issue.IsPoster(ctx.User.ID) ctx.Data["IsIssueWriter"] = ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) ctx.Data["IsRepoAdmin"] = ctx.IsSigned && (ctx.Repo.IsAdmin() || ctx.User.IsAdmin) ctx.Data["IsRepoIssuesWriter"] = ctx.IsSigned && (ctx.Repo.CanWrite(models.UnitTypeIssues) || ctx.User.IsAdmin) ctx.Data["LockReasons"] = setting.Repository.Issue.LockReasons ctx.HTML(200, tplIssueView) } // GetActionIssue will return the issue which is used in the context. func GetActionIssue(ctx *context.Context) *models.Issue { issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { ctx.NotFoundOrServerError("GetIssueByIndex", models.IsErrIssueNotExist, err) return nil } issue.Repo = ctx.Repo.Repository checkIssueRights(ctx, issue) if ctx.Written() { return nil } if err = issue.LoadAttributes(); err != nil { ctx.ServerError("LoadAttributes", nil) return nil } return issue } func checkIssueRights(ctx *context.Context, issue *models.Issue) { if issue.IsPull && !ctx.Repo.CanRead(models.UnitTypePullRequests) || !issue.IsPull && !ctx.Repo.CanRead(models.UnitTypeIssues) { ctx.NotFound("IssueOrPullRequestUnitNotAllowed", nil) } } func getActionIssues(ctx *context.Context) []*models.Issue { commaSeparatedIssueIDs := ctx.Query("issue_ids") if len(commaSeparatedIssueIDs) == 0 { return nil } issueIDs := make([]int64, 0, 10) for _, stringIssueID := range strings.Split(commaSeparatedIssueIDs, ",") { issueID, err := strconv.ParseInt(stringIssueID, 10, 64) if err != nil { ctx.ServerError("ParseInt", err) return nil } issueIDs = append(issueIDs, issueID) } issues, err := models.GetIssuesByIDs(issueIDs) if err != nil { ctx.ServerError("GetIssuesByIDs", err) return nil } // Check access rights for all issues issueUnitEnabled := ctx.Repo.CanRead(models.UnitTypeIssues) prUnitEnabled := ctx.Repo.CanRead(models.UnitTypePullRequests) for _, issue := range issues { if issue.IsPull && !prUnitEnabled || !issue.IsPull && !issueUnitEnabled { ctx.NotFound("IssueOrPullRequestUnitNotAllowed", nil) return nil } if err = issue.LoadAttributes(); err != nil { ctx.ServerError("LoadAttributes", err) return nil } } return issues } // UpdateIssueTitle change issue's title func UpdateIssueTitle(ctx *context.Context) { issue := GetActionIssue(ctx) if ctx.Written() { return } if !ctx.IsSigned || (!issue.IsPoster(ctx.User.ID) && !ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull)) { ctx.Error(403) return } title := ctx.QueryTrim("title") if len(title) == 0 { ctx.Error(204) return } if err := issue_service.ChangeTitle(issue, ctx.User, title); err != nil { ctx.ServerError("ChangeTitle", err) return } ctx.JSON(200, map[string]interface{}{ "title": issue.Title, }) } // UpdateIssueContent change issue's content func UpdateIssueContent(ctx *context.Context) { issue := GetActionIssue(ctx) if ctx.Written() { return } if !ctx.IsSigned || (ctx.User.ID != issue.PosterID && !ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull)) { ctx.Error(403) return } content := ctx.Query("content") if err := issue_service.ChangeContent(issue, ctx.User, content); err != nil { ctx.ServerError("ChangeContent", err) return } files := ctx.QueryStrings("files[]") if err := updateAttachments(issue, files); err != nil { ctx.ServerError("UpdateAttachments", err) } ctx.JSON(200, map[string]interface{}{ "content": string(markdown.Render([]byte(issue.Content), ctx.Query("context"), ctx.Repo.Repository.ComposeMetas())), "attachments": attachmentsHTML(ctx, issue.Attachments), }) } // UpdateIssueMilestone change issue's milestone func UpdateIssueMilestone(ctx *context.Context) { issues := getActionIssues(ctx) if ctx.Written() { return } milestoneID := ctx.QueryInt64("id") for _, issue := range issues { oldMilestoneID := issue.MilestoneID if oldMilestoneID == milestoneID { continue } issue.MilestoneID = milestoneID if err := issue_service.ChangeMilestoneAssign(issue, ctx.User, oldMilestoneID); err != nil { ctx.ServerError("ChangeMilestoneAssign", err) return } } ctx.JSON(200, map[string]interface{}{ "ok": true, }) } // UpdateIssueAssignee change issue's or pull's assignee func UpdateIssueAssignee(ctx *context.Context) { issues := getActionIssues(ctx) if ctx.Written() { return } assigneeID := ctx.QueryInt64("id") action := ctx.Query("action") for _, issue := range issues { switch action { case "clear": if err := issue_service.DeleteNotPassedAssignee(issue, ctx.User, []*models.User{}); err != nil { ctx.ServerError("ClearAssignees", err) return } default: assignee, err := models.GetUserByID(assigneeID) if err != nil { ctx.ServerError("GetUserByID", err) return } valid, err := models.CanBeAssigned(assignee, issue.Repo, issue.IsPull) if err != nil { ctx.ServerError("canBeAssigned", err) return } if !valid { ctx.ServerError("canBeAssigned", models.ErrUserDoesNotHaveAccessToRepo{UserID: assigneeID, RepoName: issue.Repo.Name}) return } removed, comment, err := issue_service.ToggleAssignee(issue, ctx.User, assigneeID) if err != nil { ctx.ServerError("ToggleAssignee", err) return } notification.NotifyIssueChangeAssignee(ctx.User, issue, assignee, removed, comment) } } ctx.JSON(200, map[string]interface{}{ "ok": true, }) } // UpdateIssueStatus change issue's status func UpdateIssueStatus(ctx *context.Context) { issues := getActionIssues(ctx) if ctx.Written() { return } var isClosed bool switch action := ctx.Query("action"); action { case "open": isClosed = false case "close": isClosed = true default: log.Warn("Unrecognized action: %s", action) } if _, err := models.IssueList(issues).LoadRepositories(); err != nil { ctx.ServerError("LoadRepositories", err) return } for _, issue := range issues { if issue.IsClosed != isClosed { if err := issue_service.ChangeStatus(issue, ctx.User, isClosed); err != nil { if models.IsErrDependenciesLeft(err) { ctx.JSON(http.StatusPreconditionFailed, map[string]interface{}{ "error": "cannot close this issue because it still has open dependencies", }) return } ctx.ServerError("ChangeStatus", err) return } } } ctx.JSON(200, map[string]interface{}{ "ok": true, }) } // NewComment create a comment for issue func NewComment(ctx *context.Context, form auth.CreateCommentForm) { issue := GetActionIssue(ctx) if ctx.Written() { return } if !ctx.IsSigned || (ctx.User.ID != issue.PosterID && !ctx.Repo.CanReadIssuesOrPulls(issue.IsPull)) { if log.IsTrace() { if ctx.IsSigned { issueType := "issues" if issue.IsPull { issueType = "pulls" } log.Trace("Permission Denied: User %-v not the Poster (ID: %d) and cannot read %s in Repo %-v.\n"+ "User in Repo has Permissions: %-+v", ctx.User, log.NewColoredIDValue(issue.PosterID), issueType, ctx.Repo.Repository, ctx.Repo.Permission) } else { log.Trace("Permission Denied: Not logged in") } } ctx.Error(403) } if issue.IsLocked && !ctx.Repo.CanWrite(models.UnitTypeIssues) && !ctx.User.IsAdmin { ctx.Flash.Error(ctx.Tr("repo.issues.comment_on_locked")) ctx.Redirect(issue.HTMLURL(), http.StatusSeeOther) return } var attachments []string if setting.AttachmentEnabled { attachments = form.Files } if ctx.HasError() { ctx.Flash.Error(ctx.Data["ErrorMsg"].(string)) ctx.Redirect(issue.HTMLURL()) return } var comment *models.Comment defer func() { // Check if issue admin/poster changes the status of issue. if (ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull) || (ctx.IsSigned && issue.IsPoster(ctx.User.ID))) && (form.Status == "reopen" || form.Status == "close") && !(issue.IsPull && issue.PullRequest.HasMerged) { // Duplication and conflict check should apply to reopen pull request. var pr *models.PullRequest if form.Status == "reopen" && issue.IsPull { pull := issue.PullRequest var err error pr, err = models.GetUnmergedPullRequest(pull.HeadRepoID, pull.BaseRepoID, pull.HeadBranch, pull.BaseBranch) if err != nil { if !models.IsErrPullRequestNotExist(err) { ctx.ServerError("GetUnmergedPullRequest", err) return } } // Regenerate patch and test conflict. if pr == nil { pull_service.AddToTaskQueue(issue.PullRequest) } } if pr != nil { ctx.Flash.Info(ctx.Tr("repo.pulls.open_unmerged_pull_exists", pr.Index)) } else { isClosed := form.Status == "close" if err := issue_service.ChangeStatus(issue, ctx.User, isClosed); err != nil { log.Error("ChangeStatus: %v", err) if models.IsErrDependenciesLeft(err) { if issue.IsPull { ctx.Flash.Error(ctx.Tr("repo.issues.dependency.pr_close_blocked")) ctx.Redirect(fmt.Sprintf("%s/pulls/%d", ctx.Repo.RepoLink, issue.Index), http.StatusSeeOther) } else { ctx.Flash.Error(ctx.Tr("repo.issues.dependency.issue_close_blocked")) ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, issue.Index), http.StatusSeeOther) } return } } else { if err := stopTimerIfAvailable(ctx.User, issue); err != nil { ctx.ServerError("CreateOrStopIssueStopwatch", err) return } log.Trace("Issue [%d] status changed to closed: %v", issue.ID, issue.IsClosed) } } } // Redirect to comment hashtag if there is any actual content. typeName := "issues" if issue.IsPull { typeName = "pulls" } if comment != nil { ctx.Redirect(fmt.Sprintf("%s/%s/%d#%s", ctx.Repo.RepoLink, typeName, issue.Index, comment.HashTag())) } else { ctx.Redirect(fmt.Sprintf("%s/%s/%d", ctx.Repo.RepoLink, typeName, issue.Index)) } }() // Fix #321: Allow empty comments, as long as we have attachments. if len(form.Content) == 0 && len(attachments) == 0 { return } comment, err := comment_service.CreateIssueComment(ctx.User, ctx.Repo.Repository, issue, form.Content, attachments) if err != nil { ctx.ServerError("CreateIssueComment", err) return } log.Trace("Comment created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, comment.ID) } // UpdateCommentContent change comment of issue's content func UpdateCommentContent(ctx *context.Context) { comment, err := models.GetCommentByID(ctx.ParamsInt64(":id")) if err != nil { ctx.NotFoundOrServerError("GetCommentByID", models.IsErrCommentNotExist, err) return } if err := comment.LoadIssue(); err != nil { ctx.NotFoundOrServerError("LoadIssue", models.IsErrIssueNotExist, err) return } if comment.Type == models.CommentTypeComment { if err := comment.LoadAttachments(); err != nil { ctx.ServerError("LoadAttachments", err) return } } if !ctx.IsSigned || (ctx.User.ID != comment.PosterID && !ctx.Repo.CanWriteIssuesOrPulls(comment.Issue.IsPull)) { ctx.Error(403) return } else if comment.Type != models.CommentTypeComment && comment.Type != models.CommentTypeCode { ctx.Error(204) return } oldContent := comment.Content comment.Content = ctx.Query("content") if len(comment.Content) == 0 { ctx.JSON(200, map[string]interface{}{ "content": "", }) return } if err = comment_service.UpdateComment(comment, ctx.User, oldContent); err != nil { ctx.ServerError("UpdateComment", err) return } files := ctx.QueryStrings("files[]") if err := updateAttachments(comment, files); err != nil { ctx.ServerError("UpdateAttachments", err) } ctx.JSON(200, map[string]interface{}{ "content": string(markdown.Render([]byte(comment.Content), ctx.Query("context"), ctx.Repo.Repository.ComposeMetas())), "attachments": attachmentsHTML(ctx, comment.Attachments), }) } // DeleteComment delete comment of issue func DeleteComment(ctx *context.Context) { comment, err := models.GetCommentByID(ctx.ParamsInt64(":id")) if err != nil { ctx.NotFoundOrServerError("GetCommentByID", models.IsErrCommentNotExist, err) return } if err := comment.LoadIssue(); err != nil { ctx.NotFoundOrServerError("LoadIssue", models.IsErrIssueNotExist, err) return } if !ctx.IsSigned || (ctx.User.ID != comment.PosterID && !ctx.Repo.CanWriteIssuesOrPulls(comment.Issue.IsPull)) { ctx.Error(403) return } else if comment.Type != models.CommentTypeComment && comment.Type != models.CommentTypeCode { ctx.Error(204) return } if err = comment_service.DeleteComment(comment, ctx.User); err != nil { ctx.ServerError("DeleteCommentByID", err) return } ctx.Status(200) } // ChangeIssueReaction create a reaction for issue func ChangeIssueReaction(ctx *context.Context, form auth.ReactionForm) { issue := GetActionIssue(ctx) if ctx.Written() { return } if !ctx.IsSigned || (ctx.User.ID != issue.PosterID && !ctx.Repo.CanReadIssuesOrPulls(issue.IsPull)) { if log.IsTrace() { if ctx.IsSigned { issueType := "issues" if issue.IsPull { issueType = "pulls" } log.Trace("Permission Denied: User %-v not the Poster (ID: %d) and cannot read %s in Repo %-v.\n"+ "User in Repo has Permissions: %-+v", ctx.User, log.NewColoredIDValue(issue.PosterID), issueType, ctx.Repo.Repository, ctx.Repo.Permission) } else { log.Trace("Permission Denied: Not logged in") } } ctx.Error(403) return } if ctx.HasError() { ctx.ServerError("ChangeIssueReaction", errors.New(ctx.GetErrMsg())) return } switch ctx.Params(":action") { case "react": reaction, err := models.CreateIssueReaction(ctx.User, issue, form.Content) if err != nil { if models.IsErrForbiddenIssueReaction(err) { ctx.ServerError("ChangeIssueReaction", err) return } log.Info("CreateIssueReaction: %s", err) break } // Reload new reactions issue.Reactions = nil if err = issue.LoadAttributes(); err != nil { log.Info("issue.LoadAttributes: %s", err) break } log.Trace("Reaction for issue created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, reaction.ID) case "unreact": if err := models.DeleteIssueReaction(ctx.User, issue, form.Content); err != nil { ctx.ServerError("DeleteIssueReaction", err) return } // Reload new reactions issue.Reactions = nil if err := issue.LoadAttributes(); err != nil { log.Info("issue.LoadAttributes: %s", err) break } log.Trace("Reaction for issue removed: %d/%d", ctx.Repo.Repository.ID, issue.ID) default: ctx.NotFound(fmt.Sprintf("Unknown action %s", ctx.Params(":action")), nil) return } if len(issue.Reactions) == 0 { ctx.JSON(200, map[string]interface{}{ "empty": true, "html": "", }) return } html, err := ctx.HTMLString(string(tplReactions), map[string]interface{}{ "ctx": ctx.Data, "ActionURL": fmt.Sprintf("%s/issues/%d/reactions", ctx.Repo.RepoLink, issue.Index), "Reactions": issue.Reactions.GroupByType(), }) if err != nil { ctx.ServerError("ChangeIssueReaction.HTMLString", err) return } ctx.JSON(200, map[string]interface{}{ "html": html, }) } // ChangeCommentReaction create a reaction for comment func ChangeCommentReaction(ctx *context.Context, form auth.ReactionForm) { comment, err := models.GetCommentByID(ctx.ParamsInt64(":id")) if err != nil { ctx.NotFoundOrServerError("GetCommentByID", models.IsErrCommentNotExist, err) return } if err := comment.LoadIssue(); err != nil { ctx.NotFoundOrServerError("LoadIssue", models.IsErrIssueNotExist, err) return } if !ctx.IsSigned || (ctx.User.ID != comment.PosterID && !ctx.Repo.CanReadIssuesOrPulls(comment.Issue.IsPull)) { if log.IsTrace() { if ctx.IsSigned { issueType := "issues" if comment.Issue.IsPull { issueType = "pulls" } log.Trace("Permission Denied: User %-v not the Poster (ID: %d) and cannot read %s in Repo %-v.\n"+ "User in Repo has Permissions: %-+v", ctx.User, log.NewColoredIDValue(comment.Issue.PosterID), issueType, ctx.Repo.Repository, ctx.Repo.Permission) } else { log.Trace("Permission Denied: Not logged in") } } ctx.Error(403) return } else if comment.Type != models.CommentTypeComment && comment.Type != models.CommentTypeCode { ctx.Error(204) return } switch ctx.Params(":action") { case "react": reaction, err := models.CreateCommentReaction(ctx.User, comment.Issue, comment, form.Content) if err != nil { if models.IsErrForbiddenIssueReaction(err) { ctx.ServerError("ChangeIssueReaction", err) return } log.Info("CreateCommentReaction: %s", err) break } // Reload new reactions comment.Reactions = nil if err = comment.LoadReactions(); err != nil { log.Info("comment.LoadReactions: %s", err) break } log.Trace("Reaction for comment created: %d/%d/%d/%d", ctx.Repo.Repository.ID, comment.Issue.ID, comment.ID, reaction.ID) case "unreact": if err := models.DeleteCommentReaction(ctx.User, comment.Issue, comment, form.Content); err != nil { ctx.ServerError("DeleteCommentReaction", err) return } // Reload new reactions comment.Reactions = nil if err = comment.LoadReactions(); err != nil { log.Info("comment.LoadReactions: %s", err) break } log.Trace("Reaction for comment removed: %d/%d/%d", ctx.Repo.Repository.ID, comment.Issue.ID, comment.ID) default: ctx.NotFound(fmt.Sprintf("Unknown action %s", ctx.Params(":action")), nil) return } if len(comment.Reactions) == 0 { ctx.JSON(200, map[string]interface{}{ "empty": true, "html": "", }) return } html, err := ctx.HTMLString(string(tplReactions), map[string]interface{}{ "ctx": ctx.Data, "ActionURL": fmt.Sprintf("%s/comments/%d/reactions", ctx.Repo.RepoLink, comment.ID), "Reactions": comment.Reactions.GroupByType(), }) if err != nil { ctx.ServerError("ChangeCommentReaction.HTMLString", err) return } ctx.JSON(200, map[string]interface{}{ "html": html, }) } func addParticipant(poster *models.User, participants []*models.User) []*models.User { for _, part := range participants { if poster.ID == part.ID { return participants } } return append(participants, poster) } func filterXRefComments(ctx *context.Context, issue *models.Issue) error { // Remove comments that the user has no permissions to see for i := 0; i < len(issue.Comments); { c := issue.Comments[i] if models.CommentTypeIsRef(c.Type) && c.RefRepoID != issue.RepoID && c.RefRepoID != 0 { var err error // Set RefRepo for description in template c.RefRepo, err = models.GetRepositoryByID(c.RefRepoID) if err != nil { return err } perm, err := models.GetUserRepoPermission(c.RefRepo, ctx.User) if err != nil { return err } if !perm.CanReadIssuesOrPulls(c.RefIsPull) { issue.Comments = append(issue.Comments[:i], issue.Comments[i+1:]...) continue } } i++ } return nil } // GetIssueAttachments returns attachments for the issue func GetIssueAttachments(ctx *context.Context) { issue := GetActionIssue(ctx) var attachments = make([]*api.Attachment, len(issue.Attachments)) for i := 0; i < len(issue.Attachments); i++ { attachments[i] = issue.Attachments[i].APIFormat() } ctx.JSON(200, attachments) } // GetCommentAttachments returns attachments for the comment func GetCommentAttachments(ctx *context.Context) { comment, err := models.GetCommentByID(ctx.ParamsInt64(":id")) if err != nil { ctx.NotFoundOrServerError("GetCommentByID", models.IsErrCommentNotExist, err) return } var attachments = make([]*api.Attachment, 0) if comment.Type == models.CommentTypeComment { if err := comment.LoadAttachments(); err != nil { ctx.ServerError("LoadAttachments", err) return } for i := 0; i < len(comment.Attachments); i++ { attachments = append(attachments, comment.Attachments[i].APIFormat()) } } ctx.JSON(200, attachments) } func updateAttachments(item interface{}, files []string) error { var attachments []*models.Attachment switch content := item.(type) { case *models.Issue: attachments = content.Attachments case *models.Comment: attachments = content.Attachments default: return fmt.Errorf("Unknow Type") } for i := 0; i < len(attachments); i++ { if util.IsStringInSlice(attachments[i].UUID, files) { continue } if err := models.DeleteAttachment(attachments[i], true); err != nil { return err } } var err error if len(files) > 0 { switch content := item.(type) { case *models.Issue: err = content.UpdateAttachments(files) case *models.Comment: err = content.UpdateAttachments(files) default: return fmt.Errorf("Unknow Type") } if err != nil { return err } } switch content := item.(type) { case *models.Issue: content.Attachments, err = models.GetAttachmentsByIssueID(content.ID) case *models.Comment: content.Attachments, err = models.GetAttachmentsByCommentID(content.ID) default: return fmt.Errorf("Unknow Type") } return err } func attachmentsHTML(ctx *context.Context, attachments []*models.Attachment) string { attachHTML, err := ctx.HTMLString(string(tplAttachment), map[string]interface{}{ "ctx": ctx.Data, "Attachments": attachments, }) if err != nil { ctx.ServerError("attachmentsHTML.HTMLString", err) return "" } return attachHTML }