Skip to content

Commit 42a458c

Browse files
authored
Merge branch 'main' into main
2 parents 808e37a + 07c7100 commit 42a458c

File tree

8 files changed

+27
-11
lines changed

8 files changed

+27
-11
lines changed

models/issue.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ func (issue *Issue) ChangeContent(doer *User, content string) (err error) {
804804
return fmt.Errorf("UpdateIssueCols: %v", err)
805805
}
806806

807-
if err = issues.SaveIssueContentHistory(db.GetEngine(ctx), issue.PosterID, issue.ID, 0,
807+
if err = issues.SaveIssueContentHistory(db.GetEngine(ctx), doer.ID, issue.ID, 0,
808808
timeutil.TimeStampNow(), issue.Content, false); err != nil {
809809
return fmt.Errorf("SaveIssueContentHistory: %v", err)
810810
}
@@ -979,7 +979,7 @@ func newIssue(e db.Engine, doer *User, opts NewIssueOptions) (err error) {
979979
return err
980980
}
981981

982-
if err = issues.SaveIssueContentHistory(e, opts.Issue.PosterID, opts.Issue.ID, 0,
982+
if err = issues.SaveIssueContentHistory(e, doer.ID, opts.Issue.ID, 0,
983983
timeutil.TimeStampNow(), opts.Issue.Content, true); err != nil {
984984
return err
985985
}

models/issue_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ func testInsertIssue(t *testing.T, title, content string, expectIndex int64) *Is
357357
issue := Issue{
358358
RepoID: repo.ID,
359359
PosterID: user.ID,
360+
Poster: user,
360361
Title: title,
361362
Content: content,
362363
}

modules/markup/html.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var issueFullPatternOnce sync.Once
9494
func getIssueFullPattern() *regexp.Regexp {
9595
issueFullPatternOnce.Do(func() {
9696
issueFullPattern = regexp.MustCompile(regexp.QuoteMeta(setting.AppURL) +
97-
`\w+/\w+/(?:issues|pulls)/((?:\w{1,10}-)?[1-9][0-9]*)([\?|#]\S+.(\S+)?)?\b`)
97+
`\w+/\w+/(?:issues|pulls)/((?:\w{1,10}-)?[1-9][0-9]*)([\?|#](\S+)?)?\b`)
9898
})
9999
return issueFullPattern
100100
}

modules/markup/html_internal_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ func TestRender_FullIssueURLs(t *testing.T) {
265265
`<a href="http://localhost:3000/person/repo/issues/4#issuecomment-1234" class="ref-issue">person/repo#4</a>`)
266266
test("http://localhost:3000/gogits/gogs/issues/4",
267267
`<a href="http://localhost:3000/gogits/gogs/issues/4" class="ref-issue">#4</a>`)
268+
test("http://localhost:3000/gogits/gogs/issues/4 test",
269+
`<a href="http://localhost:3000/gogits/gogs/issues/4" class="ref-issue">#4</a> test`)
270+
test("http://localhost:3000/gogits/gogs/issues/4?a=1&b=2#comment-123 test",
271+
`<a href="http://localhost:3000/gogits/gogs/issues/4?a=1&amp;b=2#comment-123" class="ref-issue">#4</a> test`)
268272
}
269273

270274
func TestRegExp_sha1CurrentPattern(t *testing.T) {

options/locale/locale_zh-TW.ini

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ change_username=您的帳號已更改。
520520
change_username_prompt=注意:修改帳號也會更改您的帳戶的 URL。
521521
change_username_redirect_prompt=舊的帳號被領用前,會重新導向您的新帳號。
522522
continue=繼續操作
523-
cancel=取消操作
523+
cancel=取消
524524
language=語言
525525
ui=佈景主題
526526
privacy=隱私
@@ -926,6 +926,9 @@ star_guest_user=登入以為此儲存庫加上星號。
926926
copy_link=複製連結
927927
copy_link_success=已複製連結
928928
copy_link_error=請按下 ⌘-C 或 Ctrl-C 複製
929+
copy_branch=複製
930+
copy_branch_success=已複製分支名稱
931+
copy_branch_error=按下 ⌘C 或 Ctrl-C 以複製
929932
copied=複製成功
930933
unwatch=取消關注
931934
watch=關注
@@ -980,6 +983,7 @@ commit_graph=提交線圖
980983
commit_graph.select=選擇分支
981984
commit_graph.hide_pr_refs=隱藏合併請求
982985
commit_graph.monochrome=單色
986+
commit_graph.color=彩色
983987
blame=Blame
984988
normal_view=標準檢視
985989
line=行
@@ -1096,6 +1100,7 @@ projects.board.set_default=設為預設
10961100
projects.board.set_default_desc=將此看板設定為未分類問題及合併請求的預設看板
10971101
projects.board.delete=刪除看板
10981102
projects.board.deletion_desc=刪除專案看板會將所有相關的問題移動到「未分類」,是否繼續?
1103+
projects.board.color=顏色
10991104
projects.open=開啟
11001105
projects.close=關閉
11011106

@@ -1799,6 +1804,7 @@ settings.content_type=POST Content Type
17991804
settings.secret=Secret
18001805
settings.slack_username=服務名稱
18011806
settings.slack_icon_url=圖標 URL
1807+
settings.slack_color=顏色
18021808
settings.discord_username=使用者名稱
18031809
settings.discord_icon_url=Icon URL
18041810
settings.event_desc=觸發條件:

routers/web/repo/issue_content_history.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,13 @@ func canSoftDeleteContentHistory(ctx *context.Context, issue *models.Issue, comm
8888
if ctx.Repo.IsOwner() {
8989
canSoftDelete = true
9090
} else if ctx.Repo.CanWrite(models.UnitTypeIssues) {
91-
canSoftDelete = ctx.User.ID == history.PosterID
9291
if comment == nil {
93-
canSoftDelete = canSoftDelete && (ctx.User.ID == issue.PosterID)
92+
// the issue poster or the history poster can soft-delete
93+
canSoftDelete = ctx.User.ID == issue.PosterID || ctx.User.ID == history.PosterID
9494
canSoftDelete = canSoftDelete && (history.IssueID == issue.ID)
9595
} else {
96-
canSoftDelete = canSoftDelete && (ctx.User.ID == comment.PosterID)
96+
// the comment poster or the history poster can soft-delete
97+
canSoftDelete = ctx.User.ID == comment.PosterID || ctx.User.ID == history.PosterID
9798
canSoftDelete = canSoftDelete && (history.IssueID == issue.ID)
9899
canSoftDelete = canSoftDelete && (history.CommentID == comment.ID)
99100
}
@@ -137,7 +138,8 @@ func GetContentHistoryDetail(ctx *context.Context) {
137138

138139
// compare the current history revision with the previous one
139140
dmp := diffmatchpatch.New()
140-
diff := dmp.DiffMain(prevHistoryContentText, history.ContentText, true)
141+
// `checklines=false` makes better diff result
142+
diff := dmp.DiffMain(prevHistoryContentText, history.ContentText, false)
141143
diff = dmp.DiffCleanupEfficiency(diff)
142144

143145
// use chroma to render the diff html

web_src/js/features/issue-content-history.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function showContentHistoryDetail(issueBaseUrl, commentId, historyId, itemTitleH
1212
if ($dialog.length) return;
1313

1414
$dialog = $(`
15-
<div class="ui modal content-history-detail-dialog" style="min-height: 50%;">
15+
<div class="ui modal content-history-detail-dialog">
1616
<i class="close icon inside"></i>
1717
<div class="header">
1818
${itemTitleHtml}
@@ -24,7 +24,7 @@ function showContentHistoryDetail(issueBaseUrl, commentId, historyId, itemTitleH
2424
</div>
2525
</div>
2626
<!-- ".modal .content" style was polluted in "_base.less": "&.modal > .content" -->
27-
<div class="scrolling content" style="text-align: left;">
27+
<div class="scrolling content" style="text-align: left; min-height: 30vh;">
2828
<div class="ui loader active"></div>
2929
</div>
3030
</div>`);

web_src/less/markup/content.less

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,12 @@
158158

159159
.task-list-item {
160160
list-style-type: none;
161+
position: relative;
161162

162163
input[type="checkbox"] {
163-
margin: 0 6px .25em -1.6em;
164+
position: absolute;
165+
top: .25em;
166+
left: -1.6em;
164167
}
165168
}
166169

0 commit comments

Comments
 (0)