Commit 4d124b44 by Kang Donghun

協業開始メッセージ表示修正

parent ca6ea671
...@@ -175,6 +175,11 @@ function setSocketAction () { ...@@ -175,6 +175,11 @@ function setSocketAction () {
, function(text) { , function(text) {
systemMessageTemplate = text; systemMessageTemplate = text;
}); });
var openCollaborationMessageTemplate;
$.get({ url: "./template/template_open_collaboration_message.html", async: false }
, function(text) {
openCollaborationMessageTemplate = text;
});
let template = userMessageTemplate; let template = userMessageTemplate;
if (message.id === socket.id) { if (message.id === socket.id) {
...@@ -188,13 +193,42 @@ function setSocketAction () { ...@@ -188,13 +193,42 @@ function setSocketAction () {
} catch(e) { } catch(e) {
message.text = message.text message.text = message.text
} }
let type;
let collaborationType;
if ( message.text.includes(messageSeperator) ) { if ( message.text.includes(messageSeperator) ) {
message.text = message.text.split(messageSeperator)[0]; let text = message.text.split(messageSeperator);
message.text = text[0];
type = text[1];
if (type == messageType.COMMUNICATIONSTART || type == messageType.COMMUNICATIONEND) {
collaborationType = text[2];
var userInCollaboration;
if (CHAT_UTIL.isIOS()) {
userInCollaboration = JSON.parse(CHAT_DB.getUserInfoList(message.userId));
} else if (CHAT_UTIL.isAndroid()) {
userInCollaboration = JSON.parse(android.getUserInfoList(message.userId));
} }
userInCollaboration.forEach(function(user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
})
template = openCollaborationMessageTemplate;
let html = Mustache.render(template, {
roomName: roomName,
userCount: 1,
userList: userInCollaboration,
insertDate: message.insertDate,
collaborationType: collaborationType,
isToday: true,
createdAtDay: messageTime.createdAtDay,
createdAtTime: messageTime.createdAtTime,
isOtherYear: false
});
$('#messages').append(html);
} else {
var replacePath = message.text; var replacePath = message.text;
replacePath = replacePath.replaceAll('?fileName=', '?sid=' + CHAT.globalLoginParameter.sid + '&fileName='); replacePath = replacePath.replaceAll('?fileName=', '?sid=' + CHAT.globalLoginParameter.sid + '&fileName=');
message.text = replacePath; message.text = replacePath;
//TODO newMessageの際にDB格納が必要。 //TODO newMessageの際にDB格納が必要。
let html = Mustache.render(template, { let html = Mustache.render(template, {
text: message.text, text: message.text,
from: message.from, from: message.from,
...@@ -207,6 +241,8 @@ function setSocketAction () { ...@@ -207,6 +241,8 @@ function setSocketAction () {
// イメージの場合、img tagを追加する // イメージの場合、img tagを追加する
html = message.text.includes('attachedImages') || message.text.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html; html = message.text.includes('attachedImages') || message.text.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html;
$('#messages').append(html); $('#messages').append(html);
}
}
// 画像、動画の描画を待ってからスクロール // 画像、動画の描画を待ってからスクロール
setTimeout(function () { setTimeout(function () {
......
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