Przeglądaj źródła

fix blank topic (#3948)

tags/v1.5.0-dev
Lunny Xiao 6 lat temu
rodzic
commit
c14870c5ac
No account linked to committer's email address
2 zmienionych plików z 9 dodań i 1 usunięć
  1. 4
    0
      public/js/index.js
  2. 5
    1
      routers/repo/topic.go

+ 4
- 0
public/js/index.js Wyświetl plik

@@ -2197,7 +2197,11 @@ function initTopicbar() {
alert(res.message);
} else {
viewDiv.children(".topic").remove();
if (topics.length == 0) {
return
}
var topicArray = topics.split(",");
var last = viewDiv.children("a").last();
for (var i=0;i < topicArray.length; i++) {
$('<div class="ui green basic label topic" style="cursor:pointer;">'+topicArray[i]+'</div>').insertBefore(last)

+ 5
- 1
routers/repo/topic.go Wyświetl plik

@@ -21,7 +21,11 @@ func TopicPost(ctx *context.Context) {
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...)
if err != nil {

Ładowanie…
Anuluj
Zapisz