diff --git a/src/main/java/org/b3log/symphony/util/Vocation.java b/src/main/java/org/b3log/symphony/util/Vocation.java
index 3a9e637f..2cbfdaf8 100644
--- a/src/main/java/org/b3log/symphony/util/Vocation.java
+++ b/src/main/java/org/b3log/symphony/util/Vocation.java
@@ -96,7 +96,7 @@ public static boolean refresh() {
return false;
}
} catch (Exception e) {
- LOGGER.log(Level.ERROR, "Failed to refresh Vocation Date. [vocationData=\"" + vocationData + "\"]", e);
+ LOGGER.log(Level.ERROR, "Failed to refresh Vocation Date. [vocationData=\"" + vocationData + "\"]");
return false;
}
}
diff --git a/src/main/resources/js/chat.js b/src/main/resources/js/chat.js
index 1d8dbc27..799ca937 100644
--- a/src/main/resources/js/chat.js
+++ b/src/main/resources/js/chat.js
@@ -46,7 +46,7 @@ var Chat = {
reqRecentList = $.ajax({
url: Label.servePath + '/chat/get-list?apiKey=' + apiKey,
type: 'GET',
- async: false,
+ async: true,
success: function (result) {
if (0 === result.result) {
let data = result.data;
@@ -78,6 +78,7 @@ var Chat = {
var reqLoadUser = $.ajax({
url: Label.servePath + "/user/" + toUser,
type: "GET",
+ async: true,
success: function (result) {
if (result.code === -1) {
alert('指定的用户名不存在,请检查后重试!');
@@ -108,7 +109,7 @@ var Chat = {
$.ajax({
url: Label.servePath + '/chat/has-unread?apiKey=' + apiKey,
type: 'GET',
- async: false,
+ async: true,
success: function (result) {
let count = result.result;
let list = result.data;
@@ -119,6 +120,8 @@ var Chat = {
});
} else {
// 已选定用户,获取第一页聊天信息
+ // 选中用户
+ $("#chatTo" + toUser).css("background-color", "#f1f1f1");
// 状态
$("#chatStatus").html('和 ' +
'' + toUser + ' ' +
@@ -210,7 +213,8 @@ var Chat = {
// 用户已读
$.ajax({
url: Label.servePath + "/chat/mark-as-read?apiKey=" + apiKey + "&fromUser=" + Chat.toUser,
- type: "GET"
+ type: "GET",
+ async: true
});
}
}
@@ -239,13 +243,13 @@ var Chat = {
$.ajax({
url: Label.servePath + "/chat/mark-as-read?apiKey=" + apiKey + "&fromUser=" + Chat.toUser,
type: "GET",
- async: false
+ async: true
});
// 加载未读消息
var loadUnread = $.ajax({
url: Label.servePath + '/chat/has-unread?apiKey=' + apiKey,
type: 'GET',
- async: false,
+ async: true,
success: function (result) {
let count = result.result;
let list = result.data;
@@ -254,10 +258,6 @@ var Chat = {
});
}
});
- $.when(loadUnread).done(function () {
- // 选中用户
- $("#chatTo" + toUser).css("background-color", "#f1f1f1");
- });
}
});
});
@@ -279,7 +279,7 @@ var Chat = {
$.ajax({
url: Label.servePath + "/chat/get-message?apiKey=" + apiKey + "&toUser=" + Chat.toUser + "&page=" + Chat.page + "&pageSize=20",
type: "GET",
- async: false,
+ async: true,
success: function (result) {
try {
result.data.length;
@@ -448,7 +448,8 @@ var Chat = {
revoke(oId) {
$.ajax({
url: Label.servePath + "/chat/revoke?apiKey=" + apiKey + "&oId=" + oId,
- type: "GET"
+ type: "GET",
+ async: true
});
},
@@ -456,6 +457,7 @@ var Chat = {
$.ajax({
url: Label.servePath + "/chat/mark-all-as-read?apiKey=" + apiKey,
type: "GET",
+ async: true,
success: function (result) {
result.users.forEach((user) => {
$("#chatTo" + user).css("background-color", "");
diff --git a/src/main/resources/js/chat.min.js b/src/main/resources/js/chat.min.js
index b24a4728..a7567915 100644
--- a/src/main/resources/js/chat.min.js
+++ b/src/main/resources/js/chat.min.js
@@ -1,4 +1,4 @@
-var Chat={page:1,toUser:"",init:function(e){let a;if(void 0!==e){Chat.page=1;try{Chat.ws.close()}catch(e){}$("#chats").html(""),$("#chatTo"+Chat.toUser).css("background-color",""),Chat.toUser="",Chat.noMore=!1,a=e}else a=getQueryVariable("toUser");Chat.toUser=a,e=$.ajax({url:Label.servePath+"/chat/get-list?apiKey="+apiKey,type:"GET",async:!1,success:function(e){0===e.result&&0!==(e=e.data).length&&e.forEach(e=>{"文件传输助手"===e.receiverUserName?$("#fileTransferMsg").html(e.preview):e.senderUserName!=Label.currentUserName?$("#chatTo"+e.senderUserName).length<=0&&Chat.addToMessageList(e.senderUserName,e.senderAvatar,e.preview,e.receiverOnlineFlag):$("#chatTo"+e.receiverUserName).length<=0&&Chat.addToMessageList(e.receiverUserName,e.receiverAvatar,e.preview,e.receiverOnlineFlag)})}}),$.when(e).done(function(){var e;""!==a&&"FileTransfer"!==a&&(e=$.ajax({url:Label.servePath+"/user/"+a,type:"GET",success:function(e){-1===e.code&&(alert("指定的用户名不存在,请检查后重试!"),location.href=Label.servePath+"/chat"),$("#chatTo"+e.userName).length<=0&&Chat.addToMessageList(e.userName,e.userAvatarURL," "),a=e.userName,Chat.toUser=a}})),$.when(e).done(function(){var e;""===a?($("#chatStatus").html('请在左侧列表选择最近聊天的成员,或直接发起聊天。
'),$("#chatWithInput").keypress(function(e){13==e.which&&Chat.startAChat()}),$.ajax({url:Label.servePath+"/chat/has-unread?apiKey="+apiKey,type:"GET",async:!1,success:function(e){e.result;e.data.forEach(e=>{$("#chatTo"+e.senderUserName).css("background-color","#fff4eb")})}})):($("#chatStatus").html('和 '+a+" 聊天中"),$("#buttons").show(),$(".pagination__chat").show(),Chat.editor=Util.newVditor({id:"messageContent",cache:!0,preview:{mode:"editor"},resize:{enable:!0,position:"bottom"},height:150,placeholder:"说点什么吧,友善第一哦。",toolbar:["emoji","link","upload","edit-mode",{name:"more",toolbar:["insert-after","fullscreen","preview","info","help"]}],ctrlEnter:function(){Chat.send()}}),Chat.ws=new WebSocket(chatChannelURL+a),Chat.ws.onopen=function(){console.log("Connected to chat channel websocket.")},Chat.ws.onmessage=function(e){var a,t,s,n,r,i,o,l,c,e=JSON.parse(e.data);"revoke"===e.type?$("#chat"+e.data).remove():-1===e.code?$("#chatContentTip").addClass("error").html("