mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 12:54:53 -05:00
fix blank topic (#3948)
This commit is contained in:
parent
bc8400747a
commit
c14870c5ac
2 changed files with 9 additions and 1 deletions
|
@ -2197,7 +2197,11 @@ function initTopicbar() {
|
||||||
alert(res.message);
|
alert(res.message);
|
||||||
} else {
|
} else {
|
||||||
viewDiv.children(".topic").remove();
|
viewDiv.children(".topic").remove();
|
||||||
|
if (topics.length == 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
var topicArray = topics.split(",");
|
var topicArray = topics.split(",");
|
||||||
|
|
||||||
var last = viewDiv.children("a").last();
|
var last = viewDiv.children("a").last();
|
||||||
for (var i=0;i < topicArray.length; i++) {
|
for (var i=0;i < topicArray.length; i++) {
|
||||||
$('<div class="ui green basic label topic" style="cursor:pointer;">'+topicArray[i]+'</div>').insertBefore(last)
|
$('<div class="ui green basic label topic" style="cursor:pointer;">'+topicArray[i]+'</div>').insertBefore(last)
|
||||||
|
|
|
@ -21,7 +21,11 @@ func TopicPost(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
topics := strings.Split(ctx.Query("topics"), ",")
|
var topics = make([]string, 0)
|
||||||
|
var topicsStr = strings.TrimSpace(ctx.Query("topics"))
|
||||||
|
if len(topicsStr) > 0 {
|
||||||
|
topics = strings.Split(topicsStr, ",")
|
||||||
|
}
|
||||||
|
|
||||||
err := models.SaveTopics(ctx.Repo.Repository.ID, topics...)
|
err := models.SaveTopics(ctx.Repo.Repository.ID, topics...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue