Commit b4c29715 by Kim Eunchul

#43695 ウェブソケットの送信方式変更

parent 38cd9254
CHAT_SOCKET.bindOnNewMessage = function () {
// New Message
// #36170
socket.on(SOCKET_KEY.NEW_MESSAGE, function (message, roomID, roomName, onlineUsers) {
CHAT_SOCKET.handleMessage(message, roomName, SOCKET_KEY.NEW_MESSAGE, roomID, onlineUsers);
socket.on(SOCKET_KEY.NEW_MESSAGE, function (message, roomID, roomName) {
CHAT_SOCKET.handleMessage(message, roomName, SOCKET_KEY.NEW_MESSAGE);
});
socket.on(SOCKET_KEY.NEW_COMMUNICATION, function (message, roomID, roomName, collaborationType, meetingID) {
CHAT_SOCKET.handleMessage(message, roomName, SOCKET_KEY.NEW_COMMUNICATION, null, null, collaborationType, meetingID);
CHAT_SOCKET.handleMessage(message, roomName, SOCKET_KEY.NEW_COMMUNICATION, collaborationType, meetingID);
});
};
CHAT_SOCKET.handleMessage = function (message, roomName, socketKey, roomID = null, onlineUsers = null, collaborationType = null, meetingID = null) {
CHAT_SOCKET.handleMessage = function (message, roomName, socketKey, collaborationType = null, meetingID = null) {
const systemMessageTemplate = getTemplate(TemplateURL.SYSTEM_MESSAGE);
const unwrappedMessageInfo = CHAT_SOCKET.decodeMessage(message.text);
......@@ -41,7 +41,7 @@ CHAT_SOCKET.handleMessage = function (message, roomName, socketKey, roomID = nul
meetingID
);
} else {
CHAT_SOCKET.addTextMessage(messageText, message, socket.id, roomID, onlineUsers);
CHAT_SOCKET.addTextMessage(messageText, message, socket.id);
}
if (typeof ChatRoom !== "undefined") {
......@@ -132,7 +132,7 @@ CHAT_SOCKET.renderCollaborationMessage = function (
});
};
CHAT_SOCKET.addTextMessage = function (messageText, message, socketID, roomID, onlineUsers) {
CHAT_SOCKET.addTextMessage = function (messageText, message, socketID) {
const messageTextWithSID = CHAT_SOCKET.insertSID(messageText);
const messageSender = JSON.parse(
NativeBridgeDataSource.getUserInfoList(message.userId)
......@@ -142,16 +142,13 @@ CHAT_SOCKET.addTextMessage = function (messageText, message, socketID, roomID, o
message.id === socketID
);
const profileImagePath = Common.getProfileImgUrl(message.profileImagePath);
const users = NativeBridgeDataSource.getUsersInRoom(roomID);
const unreadCount = users.length - (onlineUsers.users.length - 1);
const html = CHAT_SOCKET.renderTextMessage(
textMessageTemplate,
messageTextWithSID,
shopMemberName,
profileImagePath,
message.userId,
message.createdAt,
unreadCount
message.createdAt
);
$("#messages").prepend(html);
};
......@@ -162,8 +159,7 @@ CHAT_SOCKET.renderTextMessage = function (
from,
profileImagePath,
userID,
createdAt,
unreadCount
createdAt
) {
let messageTime = CHAT_UTIL.formatDate(createdAt);
let dataInsertedTemplate = Mustache.render(template, {
......@@ -175,7 +171,6 @@ CHAT_SOCKET.renderTextMessage = function (
createdAtDay: messageTime.createdAtDay,
createdAtTime: messageTime.createdAtTime,
isToday: true,
unreadCount: unreadCount,
});
// イメージの場合、img tagを追加する
......
......@@ -96,7 +96,7 @@ ChatRoom.loadMessages = function (joinRoomID, joinRoomName) {
// メッセージ表示
let messages = NativeBridgeDataSource.getMessagesByRoomID(roomID);
ChatRoom.prependMessage(messages, roomID);
ChatRoom.prependMessage(messages);
CHAT_SOCKET.cleanUpCollaborationMessage(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment