diff options
-rw-r--r-- | models/issue_comment.go | 6 | ||||
-rw-r--r-- | models/user/setting.go | 54 | ||||
-rw-r--r-- | models/user/setting_keys.go | 10 | ||||
-rw-r--r-- | models/user/setting_test.go | 18 | ||||
-rw-r--r-- | modules/context/form.go | 10 | ||||
-rw-r--r-- | modules/notification/mail/mail.go | 2 | ||||
-rw-r--r-- | options/locale/locale_en-US.ini | 16 | ||||
-rw-r--r-- | routers/web/repo/issue.go | 17 | ||||
-rw-r--r-- | routers/web/user/setting/profile.go | 26 | ||||
-rw-r--r-- | routers/web/web.go | 1 | ||||
-rw-r--r-- | services/forms/user_form_hidden_comments.go | 105 | ||||
-rw-r--r-- | services/mailer/mail.go | 2 | ||||
-rw-r--r-- | services/mailer/mail_comment.go | 2 | ||||
-rw-r--r-- | services/pull/pull.go | 2 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 1486 | ||||
-rw-r--r-- | templates/user/settings/appearance.tmpl | 98 |
16 files changed, 1086 insertions, 769 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go index bf36881a00..34541dc3cd 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -99,7 +99,7 @@ const ( // 28 merge pull request CommentTypeMergePull // 29 push to PR head branch - CommentTypePullPush + CommentTypePullRequestPush // 30 Project changed CommentTypeProject // 31 Project board changed @@ -725,7 +725,7 @@ func (c *Comment) CodeCommentURL() string { // LoadPushCommits Load push commits func (c *Comment) LoadPushCommits(ctx context.Context) (err error) { - if c.Content == "" || c.Commits != nil || c.Type != CommentTypePullPush { + if c.Content == "" || c.Commits != nil || c.Type != CommentTypePullRequestPush { return nil } @@ -1325,7 +1325,7 @@ func CreatePushPullComment(ctx context.Context, pusher *user_model.User, pr *Pul } ops := &CreateCommentOptions{ - Type: CommentTypePullPush, + Type: CommentTypePullRequestPush, Doer: pusher, Repo: pr.BaseRepo, } diff --git a/models/user/setting.go b/models/user/setting.go index 5ff18f8265..fbb6fbab30 100644 --- a/models/user/setting.go +++ b/models/user/setting.go @@ -31,8 +31,8 @@ func init() { db.RegisterModel(new(Setting)) } -// GetSettings returns specific settings from user -func GetSettings(uid int64, keys []string) (map[string]*Setting, error) { +// GetUserSettings returns specific settings from user +func GetUserSettings(uid int64, keys []string) (map[string]*Setting, error) { settings := make([]*Setting, 0, len(keys)) if err := db.GetEngine(db.DefaultContext). Where("user_id=?", uid). @@ -62,21 +62,53 @@ func GetUserAllSettings(uid int64) (map[string]*Setting, error) { return settingsMap, nil } -// DeleteSetting deletes a specific setting for a user -func DeleteSetting(setting *Setting) error { - _, err := db.GetEngine(db.DefaultContext).Delete(setting) +func validateUserSettingKey(key string) error { + if len(key) == 0 { + return fmt.Errorf("setting key must be set") + } + if strings.ToLower(key) != key { + return fmt.Errorf("setting key should be lowercase") + } + return nil +} + +// GetUserSetting gets a specific setting for a user +func GetUserSetting(userID int64, key string, def ...string) (string, error) { + if err := validateUserSettingKey(key); err != nil { + return "", err + } + setting := &Setting{UserID: userID, SettingKey: key} + has, err := db.GetEngine(db.DefaultContext).Get(setting) + if err != nil { + return "", err + } + if !has { + if len(def) == 1 { + return def[0], nil + } + return "", nil + } + return setting.SettingValue, nil +} + +// DeleteUserSetting deletes a specific setting for a user +func DeleteUserSetting(userID int64, key string) error { + if err := validateUserSettingKey(key); err != nil { + return err + } + _, err := db.GetEngine(db.DefaultContext).Delete(&Setting{UserID: userID, SettingKey: key}) return err } -// SetSetting updates a users' setting for a specific key -func SetSetting(setting *Setting) error { - if strings.ToLower(setting.SettingKey) != setting.SettingKey { - return fmt.Errorf("setting key should be lowercase") +// SetUserSetting updates a users' setting for a specific key +func SetUserSetting(userID int64, key, value string) error { + if err := validateUserSettingKey(key); err != nil { + return err } - return upsertSettingValue(setting.UserID, setting.SettingKey, setting.SettingValue) + return upsertUserSettingValue(userID, key, value) } -func upsertSettingValue(userID int64, key, value string) error { +func upsertUserSettingValue(userID int64, key, value string) error { return db.WithTx(func(ctx context.Context) error { e := db.GetEngine(ctx) diff --git a/models/user/setting_keys.go b/models/user/setting_keys.go new file mode 100644 index 0000000000..458b78e357 --- /dev/null +++ b/models/user/setting_keys.go @@ -0,0 +1,10 @@ +// Copyright 2021 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package user + +const ( + // SettingsKeyHiddenCommentTypes is the settings key for hidden comment types + SettingsKeyHiddenCommentTypes = "issue.hidden_comment_types" +) diff --git a/models/user/setting_test.go b/models/user/setting_test.go index 81445a9f6f..0b42e0fe2a 100644 --- a/models/user/setting_test.go +++ b/models/user/setting_test.go @@ -19,21 +19,29 @@ func TestSettings(t *testing.T) { newSetting := &Setting{UserID: 99, SettingKey: keyName, SettingValue: "Gitea User Setting Test"} // create setting - err := SetSetting(newSetting) + err := SetUserSetting(newSetting.UserID, newSetting.SettingKey, newSetting.SettingValue) assert.NoError(t, err) // test about saving unchanged values - err = SetSetting(newSetting) + err = SetUserSetting(newSetting.UserID, newSetting.SettingKey, newSetting.SettingValue) assert.NoError(t, err) // get specific setting - settings, err := GetSettings(99, []string{keyName}) + settings, err := GetUserSettings(99, []string{keyName}) assert.NoError(t, err) assert.Len(t, settings, 1) assert.EqualValues(t, newSetting.SettingValue, settings[keyName].SettingValue) + settingValue, err := GetUserSetting(99, keyName) + assert.NoError(t, err) + assert.EqualValues(t, newSetting.SettingValue, settingValue) + + settingValue, err = GetUserSetting(99, "no_such") + assert.NoError(t, err) + assert.EqualValues(t, "", settingValue) + // updated setting updatedSetting := &Setting{UserID: 99, SettingKey: keyName, SettingValue: "Updated"} - err = SetSetting(updatedSetting) + err = SetUserSetting(updatedSetting.UserID, updatedSetting.SettingKey, updatedSetting.SettingValue) assert.NoError(t, err) // get all settings @@ -43,7 +51,7 @@ func TestSettings(t *testing.T) { assert.EqualValues(t, updatedSetting.SettingValue, settings[updatedSetting.SettingKey].SettingValue) // delete setting - err = DeleteSetting(&Setting{UserID: 99, SettingKey: keyName}) + err = DeleteUserSetting(99, keyName) assert.NoError(t, err) settings, err = GetUserAllSettings(99) assert.NoError(t, err) diff --git a/modules/context/form.go b/modules/context/form.go index 8d18590973..4f48d746b9 100644 --- a/modules/context/form.go +++ b/modules/context/form.go @@ -46,9 +46,11 @@ func (ctx *Context) FormInt64(key string) int64 { return v } -// FormBool returns true if the value for the provided key in the form is "1" or "true" +// FormBool returns true if the value for the provided key in the form is "1", "true" or "on" func (ctx *Context) FormBool(key string) bool { - v, _ := strconv.ParseBool(ctx.Req.FormValue(key)) + s := ctx.Req.FormValue(key) + v, _ := strconv.ParseBool(s) + v = v || strings.EqualFold(s, "on") return v } @@ -59,6 +61,8 @@ func (ctx *Context) FormOptionalBool(key string) util.OptionalBool { if len(value) == 0 { return util.OptionalBoolNone } - v, _ := strconv.ParseBool(ctx.Req.FormValue(key)) + s := ctx.Req.FormValue(key) + v, _ := strconv.ParseBool(s) + v = v || strings.EqualFold(s, "on") return util.OptionalBoolOf(v) } diff --git a/modules/notification/mail/mail.go b/modules/notification/mail/mail.go index 94ee16ff8c..21709d9454 100644 --- a/modules/notification/mail/mail.go +++ b/modules/notification/mail/mail.go @@ -42,7 +42,7 @@ func (m *mailNotifier) NotifyCreateIssueComment(doer *user_model.User, repo *rep act = models.ActionCommentIssue } else if comment.Type == models.CommentTypeCode { act = models.ActionCommentIssue - } else if comment.Type == models.CommentTypePullPush { + } else if comment.Type == models.CommentTypePullRequestPush { act = 0 } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index d8398f6d9f..301bd4f66e 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -549,6 +549,22 @@ continue = Continue cancel = Cancel language = Language ui = Theme +hidden_comment_types = Hidden comment types +comment_type_group_reference = Reference +comment_type_group_label = Label +comment_type_group_milestone = Milestone +comment_type_group_assignee = Assignee +comment_type_group_title = Title +comment_type_group_branch = Branch +comment_type_group_time_tracking = Time Tracking +comment_type_group_deadline = Deadline +comment_type_group_dependency = Dependency +comment_type_group_lock = Lock Status +comment_type_group_review_request = Review request +comment_type_group_pull_request_push = Added commits +comment_type_group_project = Project +comment_type_group_issue_ref = Issue reference +saved_successfully = Your settings were saved successfully. privacy = Privacy keep_activity_private = Hide the activity from the profile page keep_activity_private_popup = Makes the activity visible only for you and the admins diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index aff5fa8498..4f2716763a 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -10,6 +10,7 @@ import ( "errors" "fmt" "io" + "math/big" "net/http" "net/url" "path" @@ -1465,7 +1466,7 @@ func ViewIssue(ctx *context.Context) { ctx.ServerError("LoadResolveDoer", err) return } - } else if comment.Type == models.CommentTypePullPush { + } else if comment.Type == models.CommentTypePullRequestPush { participants = addParticipant(comment.Poster, participants) if err = comment.LoadPushCommits(ctx); err != nil { ctx.ServerError("LoadPushCommits", err) @@ -1650,6 +1651,20 @@ func ViewIssue(ctx *context.Context) { ctx.Data["IsRepoAdmin"] = ctx.IsSigned && (ctx.Repo.IsAdmin() || ctx.User.IsAdmin) ctx.Data["LockReasons"] = setting.Repository.Issue.LockReasons ctx.Data["RefEndName"] = git.RefEndName(issue.Ref) + + var hiddenCommentTypes *big.Int + if ctx.IsSigned { + val, err := user_model.GetUserSetting(ctx.User.ID, user_model.SettingsKeyHiddenCommentTypes) + if err != nil { + ctx.ServerError("GetUserSetting", err) + return + } + hiddenCommentTypes, _ = new(big.Int).SetString(val, 10) // we can safely ignore the failed conversion here + } + ctx.Data["ShouldShowCommentType"] = func(commentType models.CommentType) bool { + return hiddenCommentTypes == nil || hiddenCommentTypes.Bit(int(commentType)) == 0 + } + ctx.HTML(http.StatusOK, tplIssueView) } diff --git a/routers/web/user/setting/profile.go b/routers/web/user/setting/profile.go index 3a61f2f92a..e77e02348c 100644 --- a/routers/web/user/setting/profile.go +++ b/routers/web/user/setting/profile.go @@ -9,6 +9,7 @@ import ( "errors" "fmt" "io" + "math/big" "net/http" "os" "path/filepath" @@ -358,6 +359,18 @@ func Appearance(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["PageIsSettingsAppearance"] = true + var hiddenCommentTypes *big.Int + val, err := user_model.GetUserSetting(ctx.User.ID, user_model.SettingsKeyHiddenCommentTypes) + if err != nil { + ctx.ServerError("GetUserSetting", err) + return + } + hiddenCommentTypes, _ = new(big.Int).SetString(val, 10) // we can safely ignore the failed conversion here + + ctx.Data["IsCommentTypeGroupChecked"] = func(commentTypeGroup string) bool { + return forms.IsUserHiddenCommentTypeGroupChecked(commentTypeGroup, hiddenCommentTypes) + } + ctx.HTML(http.StatusOK, tplSettingsAppearance) } @@ -416,3 +429,16 @@ func UpdateUserLang(ctx *context.Context) { ctx.Flash.Success(i18n.Tr(ctx.User.Language, "settings.update_language_success")) ctx.Redirect(setting.AppSubURL + "/user/settings/appearance") } + +// UpdateUserHiddenComments update a user's shown comment types +func UpdateUserHiddenComments(ctx *context.Context) { + err := user_model.SetUserSetting(ctx.User.ID, user_model.SettingsKeyHiddenCommentTypes, forms.UserHiddenCommentTypesFromRequest(ctx).String()) + if err != nil { + ctx.ServerError("SetUserSetting", err) + return + } + + log.Trace("User settings updated: %s", ctx.User.Name) + ctx.Flash.Success(ctx.Tr("settings.saved_successfully")) + ctx.Redirect(setting.AppSubURL + "/user/settings/appearance") +} diff --git a/routers/web/web.go b/routers/web/web.go index 698f91b8ca..6415788e44 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -323,6 +323,7 @@ func RegisterRoutes(m *web.Route) { m.Group("/appearance", func() { m.Get("", user_setting.Appearance) m.Post("/language", bindIgnErr(forms.UpdateLanguageForm{}), user_setting.UpdateUserLang) + m.Post("/hidden_comments", user_setting.UpdateUserHiddenComments) m.Post("/theme", bindIgnErr(forms.UpdateThemeForm{}), user_setting.UpdateUIThemePost) }) m.Group("/security", func() { diff --git a/services/forms/user_form_hidden_comments.go b/services/forms/user_form_hidden_comments.go new file mode 100644 index 0000000000..e0c26e8ddf --- /dev/null +++ b/services/forms/user_form_hidden_comments.go @@ -0,0 +1,105 @@ +// Copyright 2021 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package forms + +import ( + "math/big" + + "code.gitea.io/gitea/models" + "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/log" +) + +type hiddenCommentTypeGroupsType map[string][]models.CommentType + +// hiddenCommentTypeGroups maps the group names to comment types, these group names comes from the Web UI (appearance.tmpl) +var hiddenCommentTypeGroups = hiddenCommentTypeGroupsType{ + "reference": { + /*3*/ models.CommentTypeIssueRef, + /*4*/ models.CommentTypeCommitRef, + /*5*/ models.CommentTypeCommentRef, + /*6*/ models.CommentTypePullRef, + }, + "label": { + /*7*/ models.CommentTypeLabel, + }, + "milestone": { + /*8*/ models.CommentTypeMilestone, + }, + "assignee": { + /*9*/ models.CommentTypeAssignees, + }, + "title": { + /*10*/ models.CommentTypeChangeTitle, + }, + "branch": { + /*11*/ models.CommentTypeDeleteBranch, + /*25*/ models.CommentTypeChangeTargetBranch, + }, + "time_tracking": { + /*12*/ models.CommentTypeStartTracking, + /*13*/ models.CommentTypeStopTracking, + /*14*/ models.CommentTypeAddTimeManual, + /*15*/ models.CommentTypeCancelTracking, + /*26*/ models.CommentTypeDeleteTimeManual, + }, + "deadline": { + /*16*/ models.CommentTypeAddedDeadline, + /*17*/ models.CommentTypeModifiedDeadline, + /*18*/ models.CommentTypeRemovedDeadline, + }, + "dependency": { + /*19*/ models.CommentTypeAddDependency, + /*20*/ models.CommentTypeRemoveDependency, + }, + "lock": { + /*23*/ models.CommentTypeLock, + /*24*/ models.CommentTypeUnlock, + }, + "review_request": { + /*27*/ models.CommentTypeReviewRequest, + }, + "pull_request_push": { + /*29*/ models.CommentTypePullRequestPush, + }, + "project": { + /*30*/ models.CommentTypeProject, + /*31*/ models.CommentTypeProjectBoard, + }, + "issue_ref": { + /*33*/ models.CommentTypeChangeIssueRef, + }, +} + +// UserHiddenCommentTypesFromRequest parse the form to hidden comment types bitset +func UserHiddenCommentTypesFromRequest(ctx *context.Context) *big.Int { + bitset := new(big.Int) + for group, commentTypes := range hiddenCommentTypeGroups { + if ctx.FormBool(group) { + for _, commentType := range commentTypes { + bitset = bitset.SetBit(bitset, int(commentType), 1) + } + } + } + return bitset +} + +// IsUserHiddenCommentTypeGroupChecked check whether a hidden comment type group is "enabled" (checked on UI) +func IsUserHiddenCommentTypeGroupChecked(group string, hiddenCommentTypes *big.Int) (ret bool) { + commentTypes, ok := hiddenCommentTypeGroups[group] + if !ok { + log.Critical("the group map for hidden comment types is out of sync, unknown group: %v", group) + return + } + if hiddenCommentTypes == nil { + return false + } + for _, commentType := range commentTypes { + if hiddenCommentTypes.Bit(int(commentType)) == 1 { + return true + } + } + return false +} diff --git a/services/mailer/mail.go b/services/mailer/mail.go index 5244cd0433..e5aa250083 100644 --- a/services/mailer/mail.go +++ b/services/mailer/mail.go @@ -449,7 +449,7 @@ func actionToTemplate(issue *models.Issue, actionType models.ActionType, name = "code" case models.CommentTypeAssignees: name = "assigned" - case models.CommentTypePullPush: + case models.CommentTypePullRequestPush: name = "push" default: name = "default" diff --git a/services/mailer/mail_comment.go b/services/mailer/mail_comment.go index a42458b2c2..baecd2a101 100644 --- a/services/mailer/mail_comment.go +++ b/services/mailer/mail_comment.go @@ -21,7 +21,7 @@ func MailParticipantsComment(ctx context.Context, c *models.Comment, opType mode } content := c.Content - if c.Type == models.CommentTypePullPush { + if c.Type == models.CommentTypePullRequestPush { content = "" } if err := mailIssueCommentToParticipants( diff --git a/services/pull/pull.go b/services/pull/pull.go index 4f691c0eba..10fbc124ac 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -108,7 +108,7 @@ func NewPullRequest(ctx context.Context, repo *repo_model.Repository, pull *mode } ops := &models.CreateCommentOptions{ - Type: models.CommentTypePullPush, + Type: models.CommentTypePullRequestPush, Doer: pull.Poster, Repo: repo, Issue: pr.Issue, diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 73057248c7..e7c161a3f3 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -1,835 +1,837 @@ {{ template "base/alert" }} {{range .Issue.Comments}} - {{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }} + {{if call $.ShouldShowCommentType .Type}} + {{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }} - <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, - 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING, - 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE, - 18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE, - 22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED, 25 = TARGET_BRANCH_CHANGED, - 26 = DELETE_TIME_MANUAL, 27 = REVIEW_REQUEST, 28 = MERGE_PULL_REQUEST, - 29 = PULL_PUSH_EVENT, 30 = PROJECT_CHANGED, 31 = PROJECT_BOARD_CHANGED - 32 = DISMISSED_REVIEW --> - {{if eq .Type 0}} - <div class="timeline-item comment" id="{{.HashTag}}"> - {{if .OriginalAuthor }} - <span class="timeline-avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span> - {{else}} - <a class="timeline-avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}> - {{avatar .Poster}} - </a> - {{end}} - <div class="content comment-container"> - <div class="ui top attached header comment-header df ac sb"> - <div class="comment-header-left df ac"> - {{if .OriginalAuthor }} - <span class="text black mr-2"> - {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} - {{ .OriginalAuthor }} - </span> - <span class="text grey"> - {{$.i18n.Tr "repo.issues.commented_at" (.Issue.HashTag|Escape) $createdStr | Safe}} {{if $.Repository.OriginalURL}} - </span> - <span class="text migrate"> - ({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}} - </span> - {{else}} - <span class="text grey"> - <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> - {{.Poster.GetDisplayName}} - </a> - {{$.i18n.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdStr | Safe}} - </span> - {{end}} - </div> - <div class="comment-header-right actions df ac"> - {{if (.ShowRole.HasRole "Poster")}} - <div class="ui basic label"> - {{$.i18n.Tr "repo.issues.poster"}} - </div> - {{end}} - {{if (.ShowRole.HasRole "Writer")}} - <div class="ui basic label"> - {{$.i18n.Tr "repo.issues.collaborator"}} - </div> - {{end}} - {{if (.ShowRole.HasRole "Owner")}} - <div class="ui basic label"> - {{$.i18n.Tr "repo.issues.owner"}} - </div> - {{end}} - {{if not $.Repository.IsArchived}} - {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} - {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} - {{end}} + <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, + 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING, + 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE, + 18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE, + 22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED, 25 = TARGET_BRANCH_CHANGED, + 26 = DELETE_TIME_MANUAL, 27 = REVIEW_REQUEST, 28 = MERGE_PULL_REQUEST, + 29 = PULL_PUSH_EVENT, 30 = PROJECT_CHANGED, 31 = PROJECT_BOARD_CHANGED + 32 = DISMISSED_REVIEW --> + {{if eq .Type 0}} + <div class="timeline-item comment" id="{{.HashTag}}"> + {{if .OriginalAuthor }} + <span class="timeline-avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span> + {{else}} + <a class="timeline-avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}> + {{avatar .Poster}} + </a> + {{end}} + <div class="content comment-container"> + <div class="ui top attached header comment-header df ac sb"> + <div class="comment-header-left df ac"> + {{if .OriginalAuthor }} + <span class="text black mr-2"> + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} + {{ .OriginalAuthor }} + </span> + <span class="text grey"> + {{$.i18n.Tr "repo.issues.commented_at" (.Issue.HashTag|Escape) $createdStr | Safe}} {{if $.Repository.OriginalURL}} + </span> + <span class="text migrate"> + ({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}} + </span> + {{else}} + <span class="text grey"> + <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> + {{.Poster.GetDisplayName}} + </a> + {{$.i18n.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdStr | Safe}} + </span> + {{end}} + </div> + <div class="comment-header-right actions df ac"> + {{if (.ShowRole.HasRole "Poster")}} + <div class="ui basic label"> + {{$.i18n.Tr "repo.issues.poster"}} + </div> + {{end}} + {{if (.ShowRole.HasRole "Writer")}} + <div class="ui basic label"> + {{$.i18n.Tr "repo.issues.collaborator"}} + </div> + {{end}} + {{if (.ShowRole.HasRole "Owner")}} + <div class="ui basic label"> + {{$.i18n.Tr "repo.issues.owner"}} + </div> + {{end}} + {{if not $.Repository.IsArchived}} + {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} + {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + {{end}} + </div> </div> - </div> - <div class="ui attached segment comment-body"> - <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}> - {{if .RenderedContent}} - {{.RenderedContent|Str2html}} - {{else}} - <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span> + <div class="ui attached segment comment-body"> + <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}> + {{if .RenderedContent}} + {{.RenderedContent|Str2html}} + {{else}} + <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span> + {{end}} + </div> + <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div> + <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> + {{if .Attachments}} + {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}} {{end}} </div> - <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div> - <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> - {{if .Attachments}} - {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}} + {{$reactions := .Reactions.GroupByType}} + {{if $reactions}} + <div class="ui attached segment reactions"> + {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} + </div> {{end}} </div> - {{$reactions := .Reactions.GroupByType}} - {{if $reactions}} - <div class="ui attached segment reactions"> - {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} - </div> - {{end}} </div> - </div> - {{else if eq .Type 1}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge bg-green text-white">{{svg "octicon-dot-fill"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{if .Issue.IsPull }} - {{$.i18n.Tr "repo.pulls.reopened_at" .EventTag $createdStr | Safe}} - {{else}} - {{$.i18n.Tr "repo.issues.reopened_at" .EventTag $createdStr | Safe}} - {{end}} - </span> - </div> - {{else if eq .Type 2}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge bg-red text-white">{{svg "octicon-circle-slash"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{if .Issue.IsPull }} - {{$.i18n.Tr "repo.pulls.closed_at" .EventTag $createdStr | Safe}} - {{else}} - {{$.i18n.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}} - {{end}} - </span> - </div> - {{else if eq .Type 28}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge bg-purple text-white">{{svg "octicon-git-merge"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$link := printf "%s/commit/%s" $.Repository.HTMLURL ($.Issue.PullRequest.MergedCommitID|PathEscape)}} - {{if eq $.Issue.PullRequest.Status 3}} - {{$.i18n.Tr "repo.issues.manually_pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Str2html}} - {{else}} - {{$.i18n.Tr "repo.issues.pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Str2html}} - {{end}} - </span> - </div> - {{else if eq .Type 3 5 6}} - {{ $refFrom:= "" }} - {{if ne .RefRepoID .Issue.RepoID}} - {{ $refFrom = $.i18n.Tr "repo.issues.ref_from" (.RefRepo.FullName|Escape) }} - {{end}} - {{ $refTr := "repo.issues.ref_issue_from" }} - {{if .Issue.IsPull}} - {{ $refTr = "repo.issues.ref_pull_from" }} - {{else if eq .RefAction 1 }} - {{ $refTr = "repo.issues.ref_closing_from" }} - {{else if eq .RefAction 2 }} - {{ $refTr = "repo.issues.ref_reopening_from" }} - {{end}} - {{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-bookmark"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - {{if eq .RefAction 3}}<del>{{end}} - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr $refTr (.EventTag|Escape) $createdStr (.RefCommentHTMLURL|Escape) $refFrom | Safe}} - </span> - {{if eq .RefAction 3}}</del>{{end}} - - <div class="detail"> - <span class="text grey"><a href="{{.RefIssueHTMLURL}}"><b>{{.RefIssueTitle}}</b> {{.RefIssueIdent}}</a></span> + {{else if eq .Type 1}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge bg-green text-white">{{svg "octicon-dot-fill"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{if .Issue.IsPull }} + {{$.i18n.Tr "repo.pulls.reopened_at" .EventTag $createdStr | Safe}} + {{else}} + {{$.i18n.Tr "repo.issues.reopened_at" .EventTag $createdStr | Safe}} + {{end}} + </span> </div> - </div> - {{else if eq .Type 4}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-bookmark"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.commit_ref_at" .EventTag $createdStr | Safe}} - </span> - <div class="detail"> - {{svg "octicon-git-commit"}} - <span class="text grey">{{.Content | Str2html}}</span> + {{else if eq .Type 2}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge bg-red text-white">{{svg "octicon-circle-slash"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{if .Issue.IsPull }} + {{$.i18n.Tr "repo.pulls.closed_at" .EventTag $createdStr | Safe}} + {{else}} + {{$.i18n.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}} + {{end}} + </span> </div> - </div> - {{else if eq .Type 7}} - {{if or .AddedLabels .RemovedLabels}} + {{else if eq .Type 28}} <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-tag"}}</span> + <span class="badge bg-purple text-white">{{svg "octicon-git-merge"}}</span> <a href="{{.Poster.HomeLink}}"> {{avatar .Poster}} </a> <span class="text grey"> <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{if and .AddedLabels (not .RemovedLabels)}} - {{$.i18n.TrN (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels" (RenderLabels .AddedLabels) $createdStr | Safe}} - {{else if and (not .AddedLabels) .RemovedLabels}} - {{$.i18n.TrN (len .RemovedLabels) "repo.issues.remove_label" "repo.issues.remove_labels" (RenderLabels .RemovedLabels) $createdStr | Safe}} + {{$link := printf "%s/commit/%s" $.Repository.HTMLURL ($.Issue.PullRequest.MergedCommitID|PathEscape)}} + {{if eq $.Issue.PullRequest.Status 3}} + {{$.i18n.Tr "repo.issues.manually_pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Str2html}} {{else}} - {{$.i18n.Tr "repo.issues.add_remove_labels" (RenderLabels .AddedLabels) (RenderLabels .RemovedLabels) $createdStr | Safe}} + {{$.i18n.Tr "repo.issues.pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Str2html}} {{end}} </span> </div> - {{end}} - {{else if eq .Type 8}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-milestone"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{if gt .OldMilestoneID 0}}{{if gt .MilestoneID 0}}{{$.i18n.Tr "repo.issues.change_milestone_at" (.OldMilestone.Name|Escape) (.Milestone.Name|Escape) $createdStr | Safe}}{{else}}{{$.i18n.Tr "repo.issues.remove_milestone_at" (.OldMilestone.Name|Escape) $createdStr | Safe}}{{end}}{{else if gt .MilestoneID 0}}{{$.i18n.Tr "repo.issues.add_milestone_at" (.Milestone.Name|Escape) $createdStr | Safe}}{{end}} - </span> - </div> - {{else if eq .Type 9}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-person"}}</span> - {{if gt .AssigneeID 0}} - {{if .RemovedAssignee}} - <a href="{{.Assignee.HomeLink}}"> - {{avatar .Assignee}} - </a> - <span class="text grey"> - <a class="author" href="{{.Assignee.HomeLink}}">{{.Assignee.GetDisplayName}}</a> - {{ if eq .Poster.ID .Assignee.ID }} - {{$.i18n.Tr "repo.issues.remove_self_assignment" $createdStr | Safe}} - {{ else }} - {{$.i18n.Tr "repo.issues.remove_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}} - {{ end }} - </span> - {{else}} - <a href="{{.Assignee.HomeLink}}"> - {{avatar .Assignee}} + {{else if eq .Type 3 5 6}} + {{ $refFrom:= "" }} + {{if ne .RefRepoID .Issue.RepoID}} + {{ $refFrom = $.i18n.Tr "repo.issues.ref_from" (.RefRepo.FullName|Escape) }} + {{end}} + {{ $refTr := "repo.issues.ref_issue_from" }} + {{if .Issue.IsPull}} + {{ $refTr = "repo.issues.ref_pull_from" }} + {{else if eq .RefAction 1 }} + {{ $refTr = "repo.issues.ref_closing_from" }} + {{else if eq .RefAction 2 }} + {{ $refTr = "repo.issues.ref_reopening_from" }} + {{end}} + {{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-bookmark"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + {{if eq .RefAction 3}}<del>{{end}} + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr $refTr (.EventTag|Escape) $createdStr (.RefCommentHTMLURL|Escape) $refFrom | Safe}} + </span> + {{if eq .RefAction 3}}</del>{{end}} + + <div class="detail"> + <span class="text grey"><a href="{{.RefIssueHTMLURL}}"><b>{{.RefIssueTitle}}</b> {{.RefIssueIdent}}</a></span> + </div> + </div> + {{else if eq .Type 4}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-bookmark"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.commit_ref_at" .EventTag $createdStr | Safe}} + </span> + <div class="detail"> + {{svg "octicon-git-commit"}} + <span class="text grey">{{.Content | Str2html}}</span> + </div> + </div> + {{else if eq .Type 7}} + {{if or .AddedLabels .RemovedLabels}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-tag"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} </a> <span class="text grey"> - <a class="author" href="{{.Assignee.HomeLink}}">{{.Assignee.GetDisplayName}}</a> - {{if eq .Poster.ID .AssigneeID}} - {{$.i18n.Tr "repo.issues.self_assign_at" $createdStr | Safe}} + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{if and .AddedLabels (not .RemovedLabels)}} + {{$.i18n.TrN (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels" (RenderLabels .AddedLabels) $createdStr | Safe}} + {{else if and (not .AddedLabels) .RemovedLabels}} + {{$.i18n.TrN (len .RemovedLabels) "repo.issues.remove_label" "repo.issues.remove_labels" (RenderLabels .RemovedLabels) $createdStr | Safe}} {{else}} - {{$.i18n.Tr "repo.issues.add_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}} + {{$.i18n.Tr "repo.issues.add_remove_labels" (RenderLabels .AddedLabels) (RenderLabels .RemovedLabels) $createdStr | Safe}} {{end}} </span> - {{end}} + </div> {{end}} - </div> - {{else if eq .Type 10}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-pencil"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji) (.NewTitle|RenderEmoji) $createdStr | Safe}} - </span> - </div> - {{else if eq .Type 11}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-git-branch"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.delete_branch_at" (.OldRef|Escape) $createdStr | Safe}} - </span> - </div> - {{else if eq .Type 12}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.start_tracking_history" $createdStr | Safe}} - </span> - </div> - {{else if eq .Type 13}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}} - </span> - {{ template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" . }} - <div class="detail"> - {{svg "octicon-clock"}} - <span class="text grey">{{.Content}}</span> - </div> - </div> - {{else if eq .Type 14}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.add_time_history" $createdStr | Safe}} - </span> - {{ template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" . }} - <div class="detail"> - {{svg "octicon-clock"}} - <span class="text grey">{{.Content}}</span> + {{else if eq .Type 8}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-milestone"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{if gt .OldMilestoneID 0}}{{if gt .MilestoneID 0}}{{$.i18n.Tr "repo.issues.change_milestone_at" (.OldMilestone.Name|Escape) (.Milestone.Name|Escape) $createdStr | Safe}}{{else}}{{$.i18n.Tr "repo.issues.remove_milestone_at" (.OldMilestone.Name|Escape) $createdStr | Safe}}{{end}}{{else if gt .MilestoneID 0}}{{$.i18n.Tr "repo.issues.add_milestone_at" (.Milestone.Name|Escape) $createdStr | Safe}}{{end}} + </span> </div> - </div> - {{else if eq .Type 15}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}} - </span> - </div> - {{else if eq .Type 16}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.due_date_added" .Content $createdStr | Safe}} - </span> - </div> - {{else if eq .Type 17}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.due_date_modified" (.Content | ParseDeadline) $createdStr | Safe}} - </span> - </div> - {{else if eq .Type 18}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.due_date_remove" .Content $createdStr | Safe}} - </span> - </div> - {{else if eq .Type 19}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-package-dependents"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.dependency.added_dependency" $createdStr | Safe}} - </span> - {{if .DependentIssue}} - <div class="detail"> - {{svg "octicon-plus"}} - <span class="text grey"> - <a href="{{.DependentIssue.HTMLURL}}"> - {{if eq .DependentIssue.RepoID .Issue.RepoID}} - #{{.DependentIssue.Index}} {{.DependentIssue.Title}} + {{else if eq .Type 9}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-person"}}</span> + {{if gt .AssigneeID 0}} + {{if .RemovedAssignee}} + <a href="{{.Assignee.HomeLink}}"> + {{avatar .Assignee}} + </a> + <span class="text grey"> + <a class="author" href="{{.Assignee.HomeLink}}">{{.Assignee.GetDisplayName}}</a> + {{ if eq .Poster.ID .Assignee.ID }} + {{$.i18n.Tr "repo.issues.remove_self_assignment" $createdStr | Safe}} + {{ else }} + {{$.i18n.Tr "repo.issues.remove_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}} + {{ end }} + </span> + {{else}} + <a href="{{.Assignee.HomeLink}}"> + {{avatar .Assignee}} + </a> + <span class="text grey"> + <a class="author" href="{{.Assignee.HomeLink}}">{{.Assignee.GetDisplayName}}</a> + {{if eq .Poster.ID .AssigneeID}} + {{$.i18n.Tr "repo.issues.self_assign_at" $createdStr | Safe}} {{else}} - {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}} + {{$.i18n.Tr "repo.issues.add_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}} {{end}} - </a> - </span> + </span> + {{end}} + {{end}} + </div> + {{else if eq .Type 10}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-pencil"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji) (.NewTitle|RenderEmoji) $createdStr | Safe}} + </span> + </div> + {{else if eq .Type 11}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-git-branch"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.delete_branch_at" (.OldRef|Escape) $createdStr | Safe}} + </span> + </div> + {{else if eq .Type 12}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.start_tracking_history" $createdStr | Safe}} + </span> + </div> + {{else if eq .Type 13}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}} + </span> + {{ template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" . }} + <div class="detail"> + {{svg "octicon-clock"}} + <span class="text grey">{{.Content}}</span> </div> - {{end}} - </div> - {{else if eq .Type 20}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-package-dependents"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.dependency.removed_dependency" $createdStr | Safe}} - </span> - {{if .DependentIssue}} + </div> + {{else if eq .Type 14}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.add_time_history" $createdStr | Safe}} + </span> + {{ template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" . }} <div class="detail"> - <span class="text grey">{{svg "octicon-trash"}}</span> - <span class="text grey"> - <a href="{{.DependentIssue.HTMLURL}}"> - {{if eq .DependentIssue.RepoID .Issue.RepoID}} - #{{.DependentIssue.Index}} {{.DependentIssue.Title}} - {{else}} - {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}} - {{end}} - </a> - </span> + {{svg "octicon-clock"}} + <span class="text grey">{{.Content}}</span> </div> - {{end}} - </div> - {{else if eq .Type 22}} - <div class="timeline-item-group"> - <div class="timeline-item event"> - {{if .OriginalAuthor }} - {{else}} - <a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> + </div> + {{else if eq .Type 15}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}} + </span> + </div> + {{else if eq .Type 16}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.due_date_added" .Content $createdStr | Safe}} + </span> + </div> + {{else if eq .Type 17}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.due_date_modified" (.Content | ParseDeadline) $createdStr | Safe}} + </span> + </div> + {{else if eq .Type 18}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.due_date_remove" .Content $createdStr | Safe}} + </span> + </div> + {{else if eq .Type 19}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-package-dependents"}}</span> + <a href="{{.Poster.HomeLink}}"> {{avatar .Poster}} </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.dependency.added_dependency" $createdStr | Safe}} + </span> + {{if .DependentIssue}} + <div class="detail"> + {{svg "octicon-plus"}} + <span class="text grey"> + <a href="{{.DependentIssue.HTMLURL}}"> + {{if eq .DependentIssue.RepoID .Issue.RepoID}} + #{{.DependentIssue.Index}} {{.DependentIssue.Title}} + {{else}} + {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}} + {{end}} + </a> + </span> + </div> {{end}} - <span class="badge{{if eq .Review.Type 1}} bg-green text-white{{else if eq .Review.Type 3}} bg-red text-white{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon)}}</span> + </div> + {{else if eq .Type 20}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-package-dependents"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> <span class="text grey"> - {{if .OriginalAuthor }} - <span class="text black"> - {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} - {{ .OriginalAuthor }} + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.dependency.removed_dependency" $createdStr | Safe}} + </span> + {{if .DependentIssue}} + <div class="detail"> + <span class="text grey">{{svg "octicon-trash"}}</span> + <span class="text grey"> + <a href="{{.DependentIssue.HTMLURL}}"> + {{if eq .DependentIssue.RepoID .Issue.RepoID}} + #{{.DependentIssue.Index}} {{.DependentIssue.Title}} + {{else}} + {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}} + {{end}} + </a> </span> - <span class="text grey"> {{if $.Repository.OriginalURL}}</span> - <span class="text migrate">({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span> + </div> + {{end}} + </div> + {{else if eq .Type 22}} + <div class="timeline-item-group"> + <div class="timeline-item event"> + {{if .OriginalAuthor }} {{else}} - <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> + <a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> + {{avatar .Poster}} + </a> {{end}} + <span class="badge{{if eq .Review.Type 1}} bg-green text-white{{else if eq .Review.Type 3}} bg-red text-white{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon)}}</span> + <span class="text grey"> + {{if .OriginalAuthor }} + <span class="text black"> + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} + {{ .OriginalAuthor }} + </span> + <span class="text grey"> {{if $.Repository.OriginalURL}}</span> + <span class="text migrate">({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span> + {{else}} + <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> + {{end}} - {{if eq .Review.Type 1}} - {{$.i18n.Tr "repo.issues.review.approve" $createdStr | Safe}} - {{else if eq .Review.Type 2}} - {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}} - {{else if eq .Review.Type 3}} - {{$.i18n.Tr "repo.issues.review.reject" $createdStr | Safe}} - {{else}} - {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}} - {{end}} - {{if .Review.Dismissed}} - <div class="ui small label">{{$.i18n.Tr "repo.issues.review.dismissed_label"}}</div> - {{end}} - </span> - </div> - {{if .Content}} - <div class="timeline-item comment" id="{{.HashTag}}"> - <div class="content comment-container"> - <div class="ui top attached header comment-header df ac sb"> - <div class="comment-header-left df ac"> - <span class="text grey"> - {{if .OriginalAuthor }} - <span class="text black"> - {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} - {{ .OriginalAuthor }} - </span> - <span class="text grey"> {{if $.Repository.OriginalURL}}</span> - <span class="text migrate">({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span> - {{else}} - <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> - {{end}} + {{if eq .Review.Type 1}} + {{$.i18n.Tr "repo.issues.review.approve" $createdStr | Safe}} + {{else if eq .Review.Type 2}} + {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}} + {{else if eq .Review.Type 3}} + {{$.i18n.Tr "repo.issues.review.reject" $createdStr | Safe}} + {{else}} + {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}} + {{end}} + {{if .Review.Dismissed}} + <div class="ui small label">{{$.i18n.Tr "repo.issues.review.dismissed_label"}}</div> + {{end}} + </span> + </div> + {{if .Content}} + <div class="timeline-item comment" id="{{.HashTag}}"> + <div class="content comment-container"> + <div class="ui top attached header comment-header df ac sb"> + <div class="comment-header-left df ac"> + <span class="text grey"> + {{if .OriginalAuthor }} + <span class="text black"> + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} + {{ .OriginalAuthor }} + </span> + <span class="text grey"> {{if $.Repository.OriginalURL}}</span> + <span class="text migrate">({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span> + {{else}} + <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> + {{end}} - {{$.i18n.Tr "repo.issues.review.left_comment" | Safe}} - </span> + {{$.i18n.Tr "repo.issues.review.left_comment" | Safe}} + </span> + </div> + <div class="comment-header-right actions df ac"> + {{if (.ShowRole.HasRole "Poster")}} + <div class="ui basic label"> + {{$.i18n.Tr "repo.issues.poster"}} + </div> + {{end}} + {{if (.ShowRole.HasRole "Writer")}} + <div class="ui basic label"> + {{$.i18n.Tr "repo.issues.collaborator"}} + </div> + {{end}} + {{if (.ShowRole.HasRole "Owner")}} + <div class="ui basic label"> + {{$.i18n.Tr "repo.issues.owner"}} + </div> + {{end}} + {{if not $.Repository.IsArchived}} + {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} + {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + {{end}} + </div> </div> - <div class="comment-header-right actions df ac"> - {{if (.ShowRole.HasRole "Poster")}} - <div class="ui basic label"> - {{$.i18n.Tr "repo.issues.poster"}} - </div> - {{end}} - {{if (.ShowRole.HasRole "Writer")}} - <div class="ui basic label"> - {{$.i18n.Tr "repo.issues.collaborator"}} - </div> - {{end}} - {{if (.ShowRole.HasRole "Owner")}} - <div class="ui basic label"> - {{$.i18n.Tr "repo.issues.owner"}} - </div> - {{end}} - {{if not $.Repository.IsArchived}} - {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} - {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + <div class="ui attached segment comment-body"> + <div class="render-content markup"> + {{if .RenderedContent}} + {{.RenderedContent|Str2html}} + {{else}} + <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span> {{end}} - </div> - </div> - <div class="ui attached segment comment-body"> - <div class="render-content markup"> - {{if .RenderedContent}} - {{.RenderedContent|Str2html}} - {{else}} - <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span> + </div> + <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div> + <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> + {{if .Attachments}} + {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}} {{end}} </div> - <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div> - <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> - {{if .Attachments}} - {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}} + {{$reactions := .Reactions.GroupByType}} + {{if $reactions}} + <div class="ui attached segment reactions"> + {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} + </div> {{end}} </div> - {{$reactions := .Reactions.GroupByType}} - {{if $reactions}} - <div class="ui attached segment reactions"> - {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} - </div> - {{end}} </div> - </div> - {{end}} + {{end}} - {{if .Review.CodeComments}} - <div class="timeline-item event"> - {{ range $filename, $lines := .Review.CodeComments}} - {{range $line, $comms := $lines}} - <div class="ui segments"> - <div class="ui segment py-3 df ac sb word-break"> - {{$invalid := (index $comms 0).Invalidated}} - {{$resolved := (index $comms 0).IsResolved}} - {{$resolveDoer := (index $comms 0).ResolveDoer}} - {{$isNotPending := (not (eq (index $comms 0).Review.Type 0))}} - <div class="df ac"> - <a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment ml-3">{{$filename}}</a> - {{if $invalid }} - <span class="ui label basic small ml-3"> - {{$.i18n.Tr "repo.issues.review.outdated"}} - </span> - {{end}} - </div> - <div> - {{if or $invalid $resolved}} - <button id="show-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="{{if not $resolved}}hide {{end}}ui compact right labeled button show-outdated df ac"> - {{svg "octicon-unfold" 16 "mr-3"}} - {{if $resolved}} - {{$.i18n.Tr "repo.issues.review.show_resolved"}} - {{else}} - {{$.i18n.Tr "repo.issues.review.show_outdated"}} - {{end}} - </button> - <button id="hide-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="{{if $resolved}}hide {{end}}ui compact right labeled button hide-outdated df ac"> - {{svg "octicon-fold" 16 "mr-3"}} - {{if $resolved}} - {{$.i18n.Tr "repo.issues.review.hide_resolved"}} - {{else}} - {{$.i18n.Tr "repo.issues.review.hide_outdated"}} - {{end}} - </button> - {{end}} + {{if .Review.CodeComments}} + <div class="timeline-item event"> + {{ range $filename, $lines := .Review.CodeComments}} + {{range $line, $comms := $lines}} + <div class="ui segments"> + <div class="ui segment py-3 df ac sb word-break"> + {{$invalid := (index $comms 0).Invalidated}} + {{$resolved := (index $comms 0).IsResolved}} + {{$resolveDoer := (index $comms 0).ResolveDoer}} + {{$isNotPending := (not (eq (index $comms 0).Review.Type 0))}} + <div class="df ac"> + <a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment ml-3">{{$filename}}</a> + {{if $invalid }} + <span class="ui label basic small ml-3"> + {{$.i18n.Tr "repo.issues.review.outdated"}} + </span> + {{end}} + </div> + <div> + {{if or $invalid $resolved}} + <button id="show-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="{{if not $resolved}}hide {{end}}ui compact right labeled button show-outdated df ac"> + {{svg "octicon-unfold" 16 "mr-3"}} + {{if $resolved}} + {{$.i18n.Tr "repo.issues.review.show_resolved"}} + {{else}} + {{$.i18n.Tr "repo.issues.review.show_outdated"}} + {{end}} + </button> + <button id="hide-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="{{if $resolved}}hide {{end}}ui compact right labeled button hide-outdated df ac"> + {{svg "octicon-fold" 16 "mr-3"}} + {{if $resolved}} + {{$.i18n.Tr "repo.issues.review.hide_resolved"}} + {{else}} + {{$.i18n.Tr "repo.issues.review.hide_outdated"}} + {{end}} + </button> + {{end}} + </div> </div> - </div> - {{$diff := (CommentMustAsDiff (index $comms 0))}} - {{if $diff}} - {{$file := (index $diff.Files 0)}} - <div id="code-preview-{{(index $comms 0).ID}}" class="ui table segment{{if $resolved}} hide{{end}}"> - <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}"> - <div class="file-body file-code code-view code-diff code-diff-unified unicode-escaped"> - <table> - <tbody> - {{template "repo/diff/section_unified" dict "file" $file "root" $}} - </tbody> - </table> + {{$diff := (CommentMustAsDiff (index $comms 0))}} + {{if $diff}} + {{$file := (index $diff.Files 0)}} + <div id="code-preview-{{(index $comms 0).ID}}" class="ui table segment{{if $resolved}} hide{{end}}"> + <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}"> + <div class="file-body file-code code-view code-diff code-diff-unified unicode-escaped"> + <table> + <tbody> + {{template "repo/diff/section_unified" dict "file" $file "root" $}} + </tbody> + </table> + </div> </div> </div> - </div> - {{end}} - <div id="code-comments-{{(index $comms 0).ID}}" class="comment-code-cloud ui segment{{if $resolved}} hide{{end}}"> - <div class="ui comments mb-0"> - {{range $comms}} - {{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.Lang }} - <div class="comment code-comment pb-4" id="{{.HashTag}}"> - <div class="content"> - <div class="header comment-header"> - <div class="comment-header-left df ac"> - {{if not .OriginalAuthor }} - <a class="avatar"> - {{avatar .Poster}} - </a> - {{end}} - <span class="text grey"> - {{if .OriginalAuthor }} - <span class="text black"> - {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} - {{ .OriginalAuthor }} - </span> - <span class="text grey"> {{if $.Repository.OriginalURL}}</span> - <span class="text migrate">({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span> - {{else}} - <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> + {{end}} + <div id="code-comments-{{(index $comms 0).ID}}" class="comment-code-cloud ui segment{{if $resolved}} hide{{end}}"> + <div class="ui comments mb-0"> + {{range $comms}} + {{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.Lang }} + <div class="comment code-comment pb-4" id="{{.HashTag}}"> + <div class="content"> + <div class="header comment-header"> + <div class="comment-header-left df ac"> + {{if not .OriginalAuthor }} + <a class="avatar"> + {{avatar .Poster}} + </a> + {{end}} + <span class="text grey"> + {{if .OriginalAuthor }} + <span class="text black"> + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} + {{ .OriginalAuthor }} + </span> + <span class="text grey"> {{if $.Repository.OriginalURL}}</span> + <span class="text migrate">({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span> + {{else}} + <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> + {{end}} + {{$.i18n.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdSubStr | Safe}} + </span> + </div> + <div class="comment-header-right actions df ac"> + {{if (.ShowRole.HasRole "Poster")}} + <div class="ui basic label"> + {{$.i18n.Tr "repo.issues.poster"}} + </div> {{end}} - {{$.i18n.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdSubStr | Safe}} - </span> + {{if (.ShowRole.HasRole "Writer")}} + <div class="ui basic label"> + {{$.i18n.Tr "repo.issues.collaborator"}} + </div> + {{end}} + {{if (.ShowRole.HasRole "Owner")}} + <div class="ui basic label"> + {{$.i18n.Tr "repo.issues.owner"}} + </div> + {{end}} + {{if not $.Repository.IsArchived}} + {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} + {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + {{end}} + </div> </div> - <div class="comment-header-right actions df ac"> - {{if (.ShowRole.HasRole "Poster")}} - <div class="ui basic label"> - {{$.i18n.Tr "repo.issues.poster"}} - </div> - {{end}} - {{if (.ShowRole.HasRole "Writer")}} - <div class="ui basic label"> - {{$.i18n.Tr "repo.issues.collaborator"}} - </div> - {{end}} - {{if (.ShowRole.HasRole "Owner")}} - <div class="ui basic label"> - {{$.i18n.Tr "repo.issues.owner"}} - </div> - {{end}} - {{if not $.Repository.IsArchived}} - {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}} - {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} + <div class="text comment-content"> + <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}> + {{if .RenderedContent}} + {{.RenderedContent|Str2html}} + {{else}} + <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span> {{end}} + </div> + <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div> + <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> </div> - </div> - <div class="text comment-content"> - <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}> - {{if .RenderedContent}} - {{.RenderedContent|Str2html}} - {{else}} - <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span> + {{$reactions := .Reactions.GroupByType}} + {{if $reactions}} + <div class="ui attached segment reactions"> + {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} + </div> {{end}} - </div> - <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div> - <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> </div> - {{$reactions := .Reactions.GroupByType}} - {{if $reactions}} - <div class="ui attached segment reactions"> - {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} - </div> - {{end}} - </div> - </div> - {{end}} - </div> - <div class="code-comment-buttons df ac fw mt-3 mb-2 mx-3"> - <div class="f1"> - {{if $resolved}} - <div class="ui grey text"> - {{svg "octicon-check" 16 "mr-2"}} - <b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}} </div> {{end}} </div> - <div class="code-comment-buttons-buttons"> - {{if and $.CanMarkConversation $isNotPending}} - <button class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $comms 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> - {{if $resolved}} - {{$.i18n.Tr "repo.issues.review.un_resolve_conversation"}} - {{else}} - {{$.i18n.Tr "repo.issues.review.resolve_conversation"}} - {{end}} - </button> - {{end}} - {{if and $.SignedUserID (not $.Repository.IsArchived)}} - <button class="comment-form-reply ui green tiny labeled icon button ml-2 mr-0"> - {{svg "octicon-reply" 16 "reply icon mr-2"}}{{$.i18n.Tr "repo.diff.comment.reply"}} - </button> - {{end}} + <div class="code-comment-buttons df ac fw mt-3 mb-2 mx-3"> + <div class="f1"> + {{if $resolved}} + <div class="ui grey text"> + {{svg "octicon-check" 16 "mr-2"}} + <b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}} + </div> + {{end}} + </div> + <div class="code-comment-buttons-buttons"> + {{if and $.CanMarkConversation $isNotPending}} + <button class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $comms 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> + {{if $resolved}} + {{$.i18n.Tr "repo.issues.review.un_resolve_conversation"}} + {{else}} + {{$.i18n.Tr "repo.issues.review.resolve_conversation"}} + {{end}} + </button> + {{end}} + {{if and $.SignedUserID (not $.Repository.IsArchived)}} + <button class="comment-form-reply ui green tiny labeled icon button ml-2 mr-0"> + {{svg "octicon-reply" 16 "reply icon mr-2"}}{{$.i18n.Tr "repo.diff.comment.reply"}} + </button> + {{end}} + </div> </div> + {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $comms 0).ReviewID "root" $ "comment" (index $comms 0)}} </div> - {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $comms 0).ReviewID "root" $ "comment" (index $comms 0)}} </div> - </div> + {{end}} {{end}} + </div> {{end}} </div> - {{end}} - </div> - {{else if eq .Type 23}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-lock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - {{ if .Content }} + {{else if eq .Type 23}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-lock"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + {{ if .Content }} + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.lock_with_reason" .Content $createdStr | Safe}} + </span> + {{ else }} + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{$.i18n.Tr "repo.issues.lock_no_reason" $createdStr | Safe}} + </span> + {{ end }} + </div> + {{else if eq .Type 24}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-key"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> <span class="text grey"> <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.lock_with_reason" .Content $createdStr | Safe}} + {{$.i18n.Tr "repo.issues.unlock_comment" $createdStr | Safe}} + </span> + </div> + {{else if eq .Type 25}} + <div class="timeline-item event"> + <span class="badge">{{svg "octicon-git-branch"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> + {{$.i18n.Tr "repo.pulls.change_target_branch_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}} </span> - {{ else }} + </div> + {{else if eq .Type 26}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-clock"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> <span class="text grey"> <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.lock_no_reason" $createdStr | Safe}} + {{$.i18n.Tr "repo.issues.del_time_history" $createdStr | Safe}} </span> - {{ end }} - </div> - {{else if eq .Type 24}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-key"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.unlock_comment" $createdStr | Safe}} - </span> - </div> - {{else if eq .Type 25}} - <div class="timeline-item event"> - <span class="badge">{{svg "octicon-git-branch"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> - {{$.i18n.Tr "repo.pulls.change_target_branch_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}} - </span> - </div> - {{else if eq .Type 26}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-clock"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{$.i18n.Tr "repo.issues.del_time_history" $createdStr | Safe}} - </span> - <div class="detail"> - {{svg "octicon-clock"}} - <span class="text grey">{{.Content}}</span> + <div class="detail"> + {{svg "octicon-clock"}} + <span class="text grey">{{.Content}}</span> + </div> </div> - </div> - {{else if eq .Type 27}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-eye"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{if (gt .AssigneeID 0)}} - {{if .RemovedAssignee}} - {{if eq .PosterID .AssigneeID}} - {{$.i18n.Tr "repo.issues.review.remove_review_request_self" $createdStr | Safe}} + {{else if eq .Type 27}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-eye"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{if (gt .AssigneeID 0)}} + {{if .RemovedAssignee}} + {{if eq .PosterID .AssigneeID}} + {{$.i18n.Tr "repo.issues.review.remove_review_request_self" $createdStr | Safe}} + {{else}} + {{$.i18n.Tr "repo.issues.review.remove_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}} + {{end}} {{else}} - {{$.i18n.Tr "repo.issues.review.remove_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}} + {{$.i18n.Tr "repo.issues.review.add_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}} {{end}} {{else}} - {{$.i18n.Tr "repo.issues.review.add_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}} - {{end}} - {{else}} - {{if .RemovedAssignee}} - {{$.i18n.Tr "repo.issues.review.remove_review_request" (.AssigneeTeam.Name|Escape) $createdStr | Safe}} - {{else}} - {{$.i18n.Tr "repo.issues.review.add_review_request" (.AssigneeTeam.Name|Escape) $createdStr | Safe}} + {{if .RemovedAssignee}} + {{$.i18n.Tr "repo.issues.review.remove_review_request" (.AssigneeTeam.Name|Escape) $createdStr | Safe}} + {{else}} + {{$.i18n.Tr "repo.issues.review.add_review_request" (.AssigneeTeam.Name|Escape) $createdStr | Safe}} + {{end}} {{end}} - {{end}} - </span> - </div> - {{else if and (eq .Type 29) (or (gt .CommitsNum 0) .IsForcePush)}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-repo-push"}}</span> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{ if .IsForcePush }} - {{$.i18n.Tr "repo.issues.force_push_codes" ($.Issue.PullRequest.HeadBranch|Escape) (ShortSha .OldCommit) (($.Issue.Repo.CommitLink .OldCommit)|Escape) (ShortSha .NewCommit) (($.Issue.Repo.CommitLink .NewCommit)|Escape) $createdStr | Safe}} - {{else}} - {{$.i18n.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr | Safe}} - {{end}} - </span> - </div> - {{if not .IsForcePush}} - {{template "repo/commits_list_small" dict "comment" . "root" $}} - {{end}} - {{else if eq .Type 30}} - {{if not $.UnitProjectsGlobalDisabled}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-project"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{if gt .OldProjectID 0}} - {{if gt .ProjectID 0}} - {{$.i18n.Tr "repo.issues.change_project_at" (.OldProject.Title|Escape) (.Project.Title|Escape) $createdStr | Safe}} + </span> + </div> + {{else if and (eq .Type 29) (or (gt .CommitsNum 0) .IsForcePush)}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-repo-push"}}</span> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{ if .IsForcePush }} + {{$.i18n.Tr "repo.issues.force_push_codes" ($.Issue.PullRequest.HeadBranch|Escape) (ShortSha .OldCommit) (($.Issue.Repo.CommitLink .OldCommit)|Escape) (ShortSha .NewCommit) (($.Issue.Repo.CommitLink .NewCommit)|Escape) $createdStr | Safe}} {{else}} - {{$.i18n.Tr "repo.issues.remove_project_at" (.OldProject.Title|Escape) $createdStr | Safe}} + {{$.i18n.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr | Safe}} {{end}} - {{else if gt .ProjectID 0}} - {{$.i18n.Tr "repo.issues.add_project_at" (.Project.Title|Escape) $createdStr | Safe}} - {{end}} - </span> - </div> - {{end}} - {{else if eq .Type 32}} - <div class="timeline-item-group"> + </span> + </div> + {{if not .IsForcePush}} + {{template "repo/commits_list_small" dict "comment" . "root" $}} + {{end}} + {{else if eq .Type 30}} + {{if not $.UnitProjectsGlobalDisabled}} <div class="timeline-item event" id="{{.HashTag}}"> - <a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> - <img src="{{.Poster.AvatarLink}}"> + <span class="badge">{{svg "octicon-project"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} </a> - <span class="badge grey">{{svg "octicon-x" 16}}</span> <span class="text grey"> - <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> - {{$reviewerName := ""}} - {{if eq .Review.OriginalAuthor ""}} - {{$reviewerName = .Review.Reviewer.Name}} - {{else}} - {{$reviewerName = .Review.OriginalAuthor}} + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{if gt .OldProjectID 0}} + {{if gt .ProjectID 0}} + {{$.i18n.Tr "repo.issues.change_project_at" (.OldProject.Title|Escape) (.Project.Title|Escape) $createdStr | Safe}} + {{else}} + {{$.i18n.Tr "repo.issues.remove_project_at" (.OldProject.Title|Escape) $createdStr | Safe}} + {{end}} + {{else if gt .ProjectID 0}} + {{$.i18n.Tr "repo.issues.add_project_at" (.Project.Title|Escape) $createdStr | Safe}} {{end}} - {{$.i18n.Tr "repo.issues.review.dismissed" $reviewerName $createdStr | Safe}} </span> </div> - {{if .Content}} - <div class="timeline-item comment"> - <div class="content"> - <div class="ui top attached header arrow-top"> - <span class="text grey"> - {{$.i18n.Tr "action.review_dismissed_reason"}} - </span> - </div> - <div class="ui attached segment"> - <div class="render-content markup"> - {{if .RenderedContent}} - {{.RenderedContent|Str2html}} - {{else}} - <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span> - {{end}} + {{end}} + {{else if eq .Type 32}} + <div class="timeline-item-group"> + <div class="timeline-item event" id="{{.HashTag}}"> + <a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}> + <img src="{{.Poster.AvatarLink}}"> + </a> + <span class="badge grey">{{svg "octicon-x" 16}}</span> + <span class="text grey"> + <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> + {{$reviewerName := ""}} + {{if eq .Review.OriginalAuthor ""}} + {{$reviewerName = .Review.Reviewer.Name}} + {{else}} + {{$reviewerName = .Review.OriginalAuthor}} + {{end}} + {{$.i18n.Tr "repo.issues.review.dismissed" $reviewerName $createdStr | Safe}} + </span> + </div> + {{if .Content}} + <div class="timeline-item comment"> + <div class="content"> + <div class="ui top attached header arrow-top"> + <span class="text grey"> + {{$.i18n.Tr "action.review_dismissed_reason"}} + </span> + </div> + <div class="ui attached segment"> + <div class="render-content markup"> + {{if .RenderedContent}} + {{.RenderedContent|Str2html}} + {{else}} + <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span> + {{end}} + </div> </div> </div> </div> - </div> - {{end}} - </div> - {{else if eq .Type 33}} - <div class="timeline-item event" id="{{.HashTag}}"> - <span class="badge">{{svg "octicon-git-branch"}}</span> - <a href="{{.Poster.HomeLink}}"> - {{avatar .Poster}} - </a> - <span class="text grey"> - <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> - {{if and .OldRef .NewRef}} - {{$.i18n.Tr "repo.issues.change_ref_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}} - {{else if .OldRef}} - {{$.i18n.Tr "repo.issues.remove_ref_at" (.OldRef|Escape) $createdStr | Safe}} - {{else}} - {{$.i18n.Tr "repo.issues.add_ref_at" (.NewRef|Escape) $createdStr | Safe}} {{end}} - </span> - </div> + </div> + {{else if eq .Type 33}} + <div class="timeline-item event" id="{{.HashTag}}"> + <span class="badge">{{svg "octicon-git-branch"}}</span> + <a href="{{.Poster.HomeLink}}"> + {{avatar .Poster}} + </a> + <span class="text grey"> + <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a> + {{if and .OldRef .NewRef}} + {{$.i18n.Tr "repo.issues.change_ref_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}} + {{else if .OldRef}} + {{$.i18n.Tr "repo.issues.remove_ref_at" (.OldRef|Escape) $createdStr | Safe}} + {{else}} + {{$.i18n.Tr "repo.issues.add_ref_at" (.NewRef|Escape) $createdStr | Safe}} + {{end}} + </span> + </div> + {{end}} {{end}} {{end}} diff --git a/templates/user/settings/appearance.tmpl b/templates/user/settings/appearance.tmpl index 777b89c750..fe4a668dd5 100644 --- a/templates/user/settings/appearance.tmpl +++ b/templates/user/settings/appearance.tmpl @@ -68,6 +68,104 @@ </div> </form> </div> + + <!-- Shown comment event types --> + <h4 class="ui top attached header"> + {{.i18n.Tr "settings.hidden_comment_types"}} + </h4> + <div class="ui attached segment"> + <form class="ui form" action="{{.Link}}/hidden_comments" method="post"> + {{.CsrfTokenHtml}} + <div class="inline field"> + <div class="ui checkbox"> + <input name="reference" type="checkbox" {{if(call .IsCommentTypeGroupChecked "reference")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_reference"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="label" type="checkbox" {{if (call .IsCommentTypeGroupChecked "label")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_label"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="milestone" type="checkbox" {{if (call .IsCommentTypeGroupChecked "milestone")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_milestone"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="assignee" type="checkbox" {{if (call .IsCommentTypeGroupChecked "assignee")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_assignee"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="title" type="checkbox" {{if (call .IsCommentTypeGroupChecked "title")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_title"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="branch" type="checkbox" {{if (call .IsCommentTypeGroupChecked "branch")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_branch"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="time_tracking" type="checkbox" {{if (call .IsCommentTypeGroupChecked "time_tracking")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_time_tracking"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="deadline" type="checkbox" {{if (call .IsCommentTypeGroupChecked "deadline")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_deadline"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="dependency" type="checkbox" {{if (call .IsCommentTypeGroupChecked "dependency")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_dependency"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="lock" type="checkbox" {{if (call .IsCommentTypeGroupChecked "lock")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_lock"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="review_request" type="checkbox" {{if (call .IsCommentTypeGroupChecked "review_request")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_review_request"}}</label> + </div> + </div> + + <div class="inline field"> + <div class="ui checkbox"> + <input name="pull_request_push" type="checkbox" {{if (call .IsCommentTypeGroupChecked "pull_request_push")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_pull_request_push"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="project" type="checkbox" {{if (call .IsCommentTypeGroupChecked "project")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_project"}}</label> + </div> + </div> + <div class="inline field"> + <div class="ui checkbox"> + <input name="issue_ref" type="checkbox" {{if (call .IsCommentTypeGroupChecked "issue_ref")}}checked{{end}}> + <label>{{.i18n.Tr "settings.comment_type_group_issue_ref"}}</label> + </div> + </div> + <div class="field"> + <button class="ui green button">{{$.i18n.Tr "save"}}</button> + </div> + </form> + </div> </div> </div> |