Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config options to hide issue events #17414

Merged
merged 52 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
c31588d
Add config option to hide issue events
qwerty287 Oct 23, 2021
b2ac2a5
Make configurable using a list
qwerty287 Oct 24, 2021
e499016
Add docs
qwerty287 Oct 24, 2021
d14beda
Add missing newline
qwerty287 Oct 25, 2021
3d8abdc
Merge branch 'main' into hide-issue-events
qwerty287 Oct 25, 2021
7e94f54
Merge branch 'main' into hide-issue-events
qwerty287 Oct 26, 2021
141611e
Merge branch 'main' into hide-issue-events
qwerty287 Oct 28, 2021
c3f40ae
Merge branch 'main' into hide-issue-events
qwerty287 Oct 29, 2021
d17579d
Merge branch 'main' into hide-issue-events
qwerty287 Nov 1, 2021
26270f1
Merge branch 'main' into hide-issue-events
qwerty287 Nov 12, 2021
7eabacf
Fix merge issues
qwerty287 Nov 12, 2021
20e9fc9
Merge branch 'main' into hide-issue-events
qwerty287 Nov 15, 2021
3891745
Merge branch 'main' into hide-issue-events
qwerty287 Nov 16, 2021
8fa5fe4
Merge branch 'main' into hide-issue-events
qwerty287 Nov 21, 2021
2463c85
Merge branch 'main' into hide-issue-events
qwerty287 Nov 22, 2021
2f49cab
Allow changes per user settings
qwerty287 Nov 22, 2021
f0e6e02
Fix lint
qwerty287 Nov 22, 2021
395a714
Merge branch 'main' into hide-issue-events
qwerty287 Nov 23, 2021
20b6975
Merge branch 'main' into hide-issue-events
qwerty287 Nov 26, 2021
15a5ab6
Rm old docs
qwerty287 Nov 27, 2021
02ba951
Apply suggestions from code review
qwerty287 Nov 27, 2021
9afedcf
Merge branch 'main' into hide-issue-events
qwerty287 Nov 28, 2021
3cd7818
Merge branch 'main' into hide-issue-events
qwerty287 Nov 29, 2021
afc675c
Use bitsets
qwerty287 Dec 2, 2021
d2b84b5
Rm comment
qwerty287 Dec 2, 2021
e16472b
fmt
qwerty287 Dec 2, 2021
1e09a6d
Merge branch 'main' into hide-issue-events
qwerty287 Dec 2, 2021
3a76a14
Fix lint
qwerty287 Dec 2, 2021
2b22ebe
Merge branch 'main' into hide-issue-events
qwerty287 Dec 6, 2021
33276f9
Merge branch 'main' into hide-issue-events
qwerty287 Dec 8, 2021
debb758
Merge branch 'main' into hide-issue-events
qwerty287 Dec 12, 2021
ff70bdb
Use variable/constant to provide key
qwerty287 Dec 14, 2021
ec2c9de
Merge branch 'hide-issue-events' of github.com:qwerty287/gitea into h…
qwerty287 Dec 14, 2021
9f61e51
fmt
qwerty287 Dec 14, 2021
050af8b
fix lint
qwerty287 Dec 14, 2021
d5a02bc
Merge branch 'main' into hide-issue-events
qwerty287 Dec 21, 2021
b2a77c1
Merge branch 'main' into hide-issue-events
qwerty287 Dec 24, 2021
241def9
refactor
wxiaoguang Dec 25, 2021
7a48acd
Add a prefix for user setting key
wxiaoguang Dec 25, 2021
b134912
Merge pull request #2 from wxiaoguang/hide-issue-events
qwerty287 Dec 26, 2021
5a92210
Merge branch 'main' into hide-issue-events
qwerty287 Dec 26, 2021
e05fb4b
Add license comment
wxiaoguang Dec 27, 2021
110300e
Merge branch 'main' into hide-issue-events
wxiaoguang Dec 27, 2021
a9666b1
Add license comment
wxiaoguang Dec 27, 2021
8723518
Merge branch 'main' into hide-issue-events
qwerty287 Jan 7, 2022
e2de406
Merge branch 'main' into hide-issue-events
zeripath Jan 7, 2022
e6b31ad
Update services/forms/user_form_hidden_comments.go
wxiaoguang Jan 8, 2022
b8c2785
Merge branch 'main' into hide-issue-events
zeripath Jan 8, 2022
24a927a
Merge branch 'main' into hide-issue-events
qwerty287 Jan 12, 2022
eb8caac
Merge branch 'main' into hide-issue-events
qwerty287 Jan 21, 2022
dcd7041
Merge branch 'main' into hide-issue-events
6543 Jan 21, 2022
c3933ba
check len == 0
6543 Jan 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions custom/conf/app.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,9 @@ PATH =
;;
;; Whether to enable a Service Worker to cache frontend assets
;USE_SERVICE_WORKER = true
;;
;; Whether to hide issue events (like added/removed labels, changed milestones/projects...).
;HIDE_ISSUE_EVENTS = false
qwerty287 marked this conversation as resolved.
Show resolved Hide resolved

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down
1 change: 1 addition & 0 deletions docs/content/doc/advanced/config-cheat-sheet.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
- `DEFAULT_SHOW_FULL_NAME`: **false**: Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
- `SEARCH_REPO_DESCRIPTION`: **true**: Whether to search within description at repository search on explore page.
- `USE_SERVICE_WORKER`: **true**: Whether to enable a Service Worker to cache frontend assets.
- `HIDE_ISSUE_EVENTS`: **false**: Whether to hide issue events (like added/removed labels, changed milestones/projects...).

### UI - Admin (`ui.admin`)

Expand Down
2 changes: 2 additions & 0 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ var (
CustomEmojisMap map[string]string `ini:"-"`
SearchRepoDescription bool
UseServiceWorker bool
HideIssueEvents bool

Notification struct {
MinTimeout time.Duration
Expand Down Expand Up @@ -983,6 +984,7 @@ func NewContext() {
UI.DefaultShowFullName = Cfg.Section("ui").Key("DEFAULT_SHOW_FULL_NAME").MustBool(false)
UI.SearchRepoDescription = Cfg.Section("ui").Key("SEARCH_REPO_DESCRIPTION").MustBool(true)
UI.UseServiceWorker = Cfg.Section("ui").Key("USE_SERVICE_WORKER").MustBool(true)
UI.HideIssueEvents = Cfg.Section("ui").Key("HIDE_ISSUE_EVENTS").MustBool(false)

HasRobotsTxt, err = util.IsFile(path.Join(CustomPath, "robots.txt"))
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,7 @@ func ViewIssue(ctx *context.Context) {
ctx.Data["HasProjectsWritePermission"] = ctx.Repo.CanWrite(models.UnitTypeProjects)
ctx.Data["IsRepoAdmin"] = ctx.IsSigned && (ctx.Repo.IsAdmin() || ctx.User.IsAdmin)
ctx.Data["LockReasons"] = setting.Repository.Issue.LockReasons
ctx.Data["HideIssueEvents"] = setting.UI.HideIssueEvents
ctx.Data["RefEndName"] = git.RefEndName(issue.Ref)
ctx.HTML(http.StatusOK, tplIssueView)
}
Expand Down
48 changes: 24 additions & 24 deletions templates/repo/issue/view_content/comments.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
{{end}}
</span>
</div>
{{else if eq .Type 3 5 6}}
{{else if and (eq .Type 3 5 6) (not $.HideIssueEvents)}}
{{ $refFrom:= "" }}
{{if ne .RefRepoID .Issue.RepoID}}
{{ $refFrom = $.i18n.Tr "repo.issues.ref_from" .RefRepo.FullName }}
Expand Down Expand Up @@ -161,7 +161,7 @@
<span class="text grey"><a href="{{.RefIssueHTMLURL}}"><b>{{.RefIssueTitle | Str2html}}</b> {{.RefIssueIdent | Str2html}}</a></span>
</div>
</div>
{{else if eq .Type 4}}
{{else if and (eq .Type 4) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-bookmark"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -176,7 +176,7 @@
<span class="text grey">{{.Content | Str2html}}</span>
</div>
</div>
{{else if eq .Type 7}}
{{else if and (eq .Type 7) (not $.HideIssueEvents)}}
{{if or .AddedLabels .RemovedLabels}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-tag"}}</span>
Expand All @@ -195,7 +195,7 @@
</span>
</div>
{{end}}
{{else if eq .Type 8}}
{{else if and (eq .Type 8) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-milestone"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -206,7 +206,7 @@
{{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}}
{{else if and (eq .Type 9) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-person"}}</span>
{{if gt .AssigneeID 0}}
Expand Down Expand Up @@ -237,7 +237,7 @@
{{end}}
{{end}}
</div>
{{else if eq .Type 10}}
{{else if and (eq .Type 10) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-pencil"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -248,7 +248,7 @@
{{$.i18n.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji) (.NewTitle|RenderEmoji) $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 11}}
{{else if and (eq .Type 11) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-git-branch"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -259,7 +259,7 @@
{{$.i18n.Tr "repo.issues.delete_branch_at" (.OldRef|Escape) $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 12}}
{{else if and (eq .Type 12) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -270,7 +270,7 @@
{{$.i18n.Tr "repo.issues.start_tracking_history" $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 13}}
{{else if and (eq .Type 13) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -286,7 +286,7 @@
<span class="text grey">{{.Content}}</span>
</div>
</div>
{{else if eq .Type 14}}
{{else if and (eq .Type 14) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -302,7 +302,7 @@
<span class="text grey">{{.Content}}</span>
</div>
</div>
{{else if eq .Type 15}}
{{else if and (eq .Type 15) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -313,7 +313,7 @@
{{$.i18n.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 16}}
{{else if and (eq .Type 16) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -324,7 +324,7 @@
{{$.i18n.Tr "repo.issues.due_date_added" .Content $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 17}}
{{else if and (eq .Type 17) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -335,7 +335,7 @@
{{$.i18n.Tr "repo.issues.due_date_modified" (.Content | ParseDeadline) $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 18}}
{{else if and (eq .Type 18) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -346,7 +346,7 @@
{{$.i18n.Tr "repo.issues.due_date_remove" .Content $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 19}}
{{else if and (eq .Type 19) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-package-dependents"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -371,7 +371,7 @@
</div>
{{end}}
</div>
{{else if eq .Type 20}}
{{else if and (eq .Type 20) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-package-dependents"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand Down Expand Up @@ -624,7 +624,7 @@
</div>
{{end}}
</div>
{{else if eq .Type 23}}
{{else if and (eq .Type 23) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-lock"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -642,7 +642,7 @@
</span>
{{ end }}
</div>
{{else if eq .Type 24}}
{{else if and (eq .Type 24) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-key"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -653,7 +653,7 @@
{{$.i18n.Tr "repo.issues.unlock_comment" $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 25}}
{{else if and (eq .Type 25) (not $.HideIssueEvents)}}
<div class="timeline-item event">
<span class="badge">{{svg "octicon-git-branch"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -664,7 +664,7 @@
{{$.i18n.Tr "repo.pulls.change_target_branch_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}}
</span>
</div>
{{else if eq .Type 26}}
{{else if and (eq .Type 26) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -679,7 +679,7 @@
<span class="text grey">{{.Content}}</span>
</div>
</div>
{{else if eq .Type 27}}
{{else if and (eq .Type 27) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-eye"}}</span>
<a href="{{.Poster.HomeLink}}">
Expand All @@ -706,7 +706,7 @@
{{end}}
</span>
</div>
{{else if and (eq .Type 29) (or (gt .CommitsNum 0) .IsForcePush)}}
{{else if and (eq .Type 29) (or (gt .CommitsNum 0) .IsForcePush) (not $.HideIssueEvents)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-repo-push"}}</span>
<span class="text grey">
Expand All @@ -721,7 +721,7 @@
{{if not .IsForcePush}}
{{template "repo/commits_list_small" dict "comment" . "root" $}}
{{end}}
{{else if eq .Type 30}}
{{else if and (eq .Type 30) (not $.HideIssueEvents)}}
{{if not $.UnitProjectsGlobalDisabled}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-project"}}</span>
Expand All @@ -742,7 +742,7 @@
</span>
</div>
{{end}}
{{else if eq .Type 32}}
{{else if and (eq .Type 32) (not $.HideIssueEvents)}}
<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}}>
Expand Down