diff --git a/public/home/home.js b/public/home/home.js index 030b62183..bcf129945 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -65,39 +65,35 @@ socket.onmessage = function (e) { for(var i = messageQueue.length -1; i >=0; i--){ var record = messageQueue[i]; - html += "
"; - - html += " \"\"" - html += "
" - html += " " + record.ActUser.Name + "" + var recordPrefix = getMsg(record); var actionName = getAction(record.OpType,isZh); if(record.OpType == "6" || record.OpType == "10" || record.OpType == "12" || record.OpType == "13"){ - html += actionName; + html += recordPrefix + actionName; html += " " + getIssueText(record) + "" } else if(record.OpType == "7" || record.OpType == "11" || record.OpType == "14" || record.OpType == "15" || record.OpType == "22" || record.OpType == "23"){ - html += actionName; + html += recordPrefix + actionName; html += " " + getPRText(record) + "" } else if(record.OpType == "1"){ - html += actionName; + html += recordPrefix + actionName; html += " " + getRepoLink(record) + "" } - else if(record.OpType == "9"){ + else if(record.OpType == "9" || record.OpType == "5"){ actionName = actionName.replace("{branch}",record.RefName); - html += actionName; + html += recordPrefix + actionName; html += " " + getRepoLink(record) + "" }else if(record.OpType == "17"){ actionName = actionName.replace("{deleteBranchName}",record.RefName); var repoLink = "" + getRepoLink(record) + "" actionName = actionName.replace("{repoName}",repoLink); - html += actionName; + html += recordPrefix + actionName; } else if(record.OpType == "2"){ actionName = actionName.replace("{oldRepoName}",record.Content); - html += actionName; + html += recordPrefix + actionName; html += " " + getRepoLink(record) + "" } else{ @@ -127,6 +123,15 @@ socket.onmessage = function (e) { swiperNewMessage.updateProgress(); }; +function getMsg(record){ + var html =""; + html += "
"; + html += " \"\"" + html += "
" + html += " " + record.ActUser.Name + "" + return html; +} + function getRepoLink(record){ return "/" + record.Repo.OwnerName + "/" + record.Repo.Name; } @@ -223,6 +228,7 @@ function getIssueText(record){ var actionNameZH={ "1":"创建了项目", "2":"重命名项目 {oldRepoName} 为", + "5":"推送了 {branch} 分支的代码到", "6":"创建了任务", "7":"创建了合并请求", "9":"推送了 {branch} 分支的代码到", @@ -240,6 +246,7 @@ var actionNameZH={ var actionNameEN={ "1":"created repository", "2":"renamed repository from {oldRepoName} to ", + "5":"pushed to {branch} at", "6":"opened issue", "7":"created pull request", "9":"pushed to {branch} at",