Skip to content

Commit

Permalink
Merge branch 'main' into generate_repo_permission
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored May 24, 2021
2 parents 9be54ec + 3aaf648 commit 7f4f66f
Show file tree
Hide file tree
Showing 29 changed files with 301 additions and 1,092 deletions.
19 changes: 10 additions & 9 deletions modules/markup/markdown/goldmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,18 +384,19 @@ func (r *HTMLRenderer) renderTaskCheckBoxListItem(w util.BufWriter, source []byt
} else {
_, _ = w.WriteString("<li>")
}
end := ">"
if r.XHTML {
end = " />"
_, _ = w.WriteString(`<input type="checkbox" disabled=""`)
segments := node.FirstChild().Lines()
if segments.Len() > 0 {
segment := segments.At(0)
_, _ = w.WriteString(fmt.Sprintf(` data-source-position="%d"`, segment.Start))
}
var err error
if n.IsChecked {
_, err = w.WriteString(`<input type="checkbox" disabled="" checked=""` + end)
} else {
_, err = w.WriteString(`<input type="checkbox" disabled=""` + end)
_, _ = w.WriteString(` checked=""`)
}
if err != nil {
return ast.WalkStop, err
if r.XHTML {
_, _ = w.WriteString(` />`)
} else {
_ = w.WriteByte('>')
}
fc := n.FirstChild()
if fc != nil {
Expand Down
6 changes: 3 additions & 3 deletions modules/markup/markdown/markdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ func testAnswers(baseURLContent, baseURLImages string) []string {
<p>(from <a href="https://www.markdownguide.org/extended-syntax/" rel="nofollow">https://www.markdownguide.org/extended-syntax/</a>)</p>
<h3 id="user-content-checkboxes">Checkboxes</h3>
<ul>
<li class="task-list-item"><input type="checkbox" disabled=""/>unchecked</li>
<li class="task-list-item"><input type="checkbox" disabled="" checked=""/>checked</li>
<li class="task-list-item"><input type="checkbox" disabled=""/>still unchecked</li>
<li class="task-list-item"><input type="checkbox" disabled="" data-source-position="434"/>unchecked</li>
<li class="task-list-item"><input type="checkbox" disabled="" data-source-position="450" checked=""/>checked</li>
<li class="task-list-item"><input type="checkbox" disabled="" data-source-position="464"/>still unchecked</li>
</ul>
<h3 id="user-content-definition-list">Definition list</h3>
<dl>
Expand Down
2 changes: 1 addition & 1 deletion modules/markup/sanitizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func ReplaceSanitizer() {

// Checkboxes
sanitizer.policy.AllowAttrs("type").Matching(regexp.MustCompile(`^checkbox$`)).OnElements("input")
sanitizer.policy.AllowAttrs("checked", "disabled").OnElements("input")
sanitizer.policy.AllowAttrs("checked", "disabled", "data-source-position").OnElements("input")

// Custom URL-Schemes
if len(setting.Markdown.CustomURLSchemes) > 0 {
Expand Down
4 changes: 2 additions & 2 deletions modules/setting/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var (
IssueConnStr: "",
IssueIndexerName: "gitea_issues",
IssueQueueType: LevelQueueType,
IssueQueueDir: "indexers/issues.queue",
IssueQueueDir: "queues/common",
IssueQueueConnStr: "",
IssueQueueBatchNumber: 20,

Expand All @@ -76,7 +76,7 @@ func newIndexerService() {
Indexer.IssueIndexerName = sec.Key("ISSUE_INDEXER_NAME").MustString(Indexer.IssueIndexerName)

Indexer.IssueQueueType = sec.Key("ISSUE_INDEXER_QUEUE_TYPE").MustString(LevelQueueType)
Indexer.IssueQueueDir = sec.Key("ISSUE_INDEXER_QUEUE_DIR").MustString(path.Join(AppDataPath, "indexers/issues.queue"))
Indexer.IssueQueueDir = sec.Key("ISSUE_INDEXER_QUEUE_DIR").MustString(path.Join(AppDataPath, "queues/common"))
Indexer.IssueQueueConnStr = sec.Key("ISSUE_INDEXER_QUEUE_CONN_STR").MustString("")
Indexer.IssueQueueBatchNumber = sec.Key("ISSUE_INDEXER_QUEUE_BATCH_NUMBER").MustInt(20)

Expand Down
6 changes: 3 additions & 3 deletions modules/setting/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func GetQueueSettings(name string) QueueSettings {
q.Name = name

// DataDir is not directly inheritable
q.DataDir = filepath.Join(Queue.DataDir, name)
q.DataDir = filepath.Join(Queue.DataDir, "common")
// QueueName is not directly inheritable either
q.QueueName = name + Queue.QueueName
for _, key := range sec.Keys() {
Expand Down Expand Up @@ -103,11 +103,11 @@ func NewQueueService() {
Queue.WrapIfNecessary = sec.Key("WRAP_IF_NECESSARY").MustBool(true)
Queue.MaxAttempts = sec.Key("MAX_ATTEMPTS").MustInt(10)
Queue.Timeout = sec.Key("TIMEOUT").MustDuration(GracefulHammerTime + 30*time.Second)
Queue.Workers = sec.Key("WORKERS").MustInt(1)
Queue.Workers = sec.Key("WORKERS").MustInt(0)
Queue.MaxWorkers = sec.Key("MAX_WORKERS").MustInt(10)
Queue.BlockTimeout = sec.Key("BLOCK_TIMEOUT").MustDuration(1 * time.Second)
Queue.BoostTimeout = sec.Key("BOOST_TIMEOUT").MustDuration(5 * time.Minute)
Queue.BoostWorkers = sec.Key("BOOST_WORKERS").MustInt(5)
Queue.BoostWorkers = sec.Key("BOOST_WORKERS").MustInt(1)
Queue.QueueName = sec.Key("QUEUE_NAME").MustString("_queue")
Queue.SetName = sec.Key("SET_NAME").MustString("")

Expand Down
1 change: 1 addition & 0 deletions public/img/svg/fontawesome-openid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/img/svg/fontawesome-windows.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7f4f66f

Please sign in to comment.