Browse Source

#1398

fix bug
tags/v1.22.1.3
chenyifan01 3 years ago
parent
commit
897005a1ae
2 changed files with 14 additions and 13 deletions
  1. +12
    -12
      public/home/home.js
  2. +2
    -1
      routers/home.go

+ 12
- 12
public/home/home.js View File

@@ -64,18 +64,18 @@ socket.onmessage = function (e) {
var currentTime = new Date().getTime();
for(var i = 0; i < messageQueue.length; i++){
var record = messageQueue[i];
var recordPrefix = getMsg(record);
var actionName = getAction(record.OpType,isZh);
if(record.OpType == "6" || record.OpType == "10" || record.OpType == "12" || record.OpType == "13"){
html += recordPrefix + actionName;
html += " <a href=\"" + getIssueLink(record) + "\" rel=\"nofollow\">" + getIssueText(record) + "</a>"
html += " <a href=\"" + getIssueLink(record) + "\" rel=\"nofollow\">" + getIssueText(record) + "</a>"
}
else if(record.OpType == "7" || record.OpType == "11" || record.OpType == "14" || record.OpType == "15" || record.OpType == "22"
|| record.OpType == "23"){
html += recordPrefix + actionName;
html += " <a href=\"" + getPRLink(record) + "\" rel=\"nofollow\">" + getPRText(record) + "</a>"
html += " <a href=\"" + getPRLink(record) + "\" rel=\"nofollow\">" + getPRText(record) + "</a>"
}
else if(record.OpType == "1"){
html += recordPrefix + actionName;
@@ -120,7 +120,7 @@ function getMsg(record){
html += "<div class=\"swiper-slide item\">";
html += " <img class=\"ui avatar image\" src=\"/user/avatar/" + record.ActUser.Name + "/-1\" alt=\"\">"
html += " <div class=\"middle aligned content nowrap\">"
html += " <a href=\"/" + record.ActUser.Name + "\" title=\"\">" + record.ActUser.Name + "</a>"
html += " <a href=\"/" + record.ActUser.Name + "\" title=\"\">" + record.ActUser.Name + "</a>"
return html;
}

@@ -133,7 +133,7 @@ function getRepotext(record){
}
function getRepoLink(record){
return record.Repo.OwnerName + "/" + record.Repo.Name;
}

function getTime(UpdatedUnix,currentTime){
@@ -143,7 +143,7 @@ function getTime(UpdatedUnix,currentTime){
if( timeEscSecond < 0){
timeEscSecond = 1;
}
var hours= Math.floor(timeEscSecond / 3600);
//计算相差分钟数
var leave2 = Math.floor(timeEscSecond % (3600)); //计算小时数后剩余的秒数
@@ -172,11 +172,11 @@ function getPRText(record){
}else{
return record.Repo.OwnerName + "/" + record.Repo.Name + "#" + getIssueId(record);
}
}

function getIssueLink(record){
return "/" + record.Repo.OwnerName + "/" + record.Repo.Name + "/issues/" + getIssueId(record);
}

@@ -202,7 +202,7 @@ function getIssueText(record){
}else{
return record.Repo.OwnerName + "/" + record.Repo.Name + "#" + getIssueId(record);
}
}

/*
@@ -354,7 +354,7 @@ function displayRepo(json){
html += " <i class=\"ri-star-line\"></i>" + record["NumStars"] + "<i class=\"ri-git-branch-line am-ml-10\"></i>" + record["NumForks"];
html += " </span>";
html += " <img class=\"left floated mini ui image\" src=\"" + record["Avatar"] + "\">";
html += " <a class=\"header nowrap\" href=\"/" + record["OwnerName"] + "/" + record["Name"] + "\">" + record["Name"] +"</a>";
html += " <a class=\"header nowrap\" href=\"/" + record["OwnerName"] + "/" + record["Name"] + "\">" + record["Alias"] +"</a>";
html += " <div class=\"description nowrap-2\">" + record["Description"] + " </div>";
html += " <div class=\"ui tags nowrap am-mt-10\">"
if(record["Topics"] != null){
@@ -408,4 +408,4 @@ function displayOrg(json){
}
}
orgDiv.innerHTML = html;
}
}

+ 2
- 1
routers/home.go View File

@@ -629,7 +629,8 @@ func RecommendRepoFromPromote(ctx *context.Context) {
if err == nil {
repoMap := make(map[string]interface{})
repoMap["ID"] = fmt.Sprint(repo.ID)
repoMap["Name"] = repo.Alias
repoMap["Name"] = repo.Name
repoMap["Alias"] = repo.Alias
repoMap["OwnerName"] = repo.OwnerName
repoMap["NumStars"] = repo.NumStars
repoMap["NumForks"] = repo.NumForks


Loading…
Cancel
Save