Commit 76e4242e by Jeong Gilmo

- redmineのチャットについて

 #36142 #36147に修正、対応しました。
 その他の不具合も対応しました。
parent 3f9f4e13
...@@ -203,11 +203,7 @@ socket.on('refreshRoomList', function(rooms, activeRoomId = null){ ...@@ -203,11 +203,7 @@ socket.on('refreshRoomList', function(rooms, activeRoomId = null){
room.profileImagePath = './images/user-profile.png' room.profileImagePath = './images/user-profile.png'
if (room.message) { if (room.message) {
try { room.message = room.message.toString()
room.message = decodeURIComponent(room.message)
} catch(e) {
room.message = room.message
}
} else { } else {
room.message = getLocalizedString("noMessages") room.message = getLocalizedString("noMessages")
} }
...@@ -378,13 +374,19 @@ jQuery('#roomKeywordSearch').on('shown.bs.dropdown', function (e){ ...@@ -378,13 +374,19 @@ jQuery('#roomKeywordSearch').on('shown.bs.dropdown', function (e){
// #36145 // #36145
jQuery('#roomKeyButton').on('click', function(event) { jQuery('#roomKeyButton').on('click', function(event) {
// #36147に対応
// キーワード検索の値が変更し、検索を行う // キーワード検索の値が変更し、検索を行う
if (!jQuery('#roomKeyword').val()) { if (jQuery('#roomKeyword').val().length > 0) {
// 検索結果がない場合、チャットルームのリストを表示する
socket.emit('getRoomList');
} else {
// 検索結果が有る場合、結果を表示する // 検索結果が有る場合、結果を表示する
socket.emit('roomSearch', jQuery('#roomKeyword').val()); socket.emit('roomSearch', encodeURIComponent(jQuery('#roomKeyword').val()));
} else {
// 検索結果がない場合、チャットルームのリストを表示する
// #36147; #36145; orderByUnreadにチェックした場合、該当状態にsortされるように
if(jQuery('#orderByTime').hasClass('dropdown-item-checked')) {
socket.emit('getRoomList');
} else {
socket.emit('getRoomList', true);
}
} }
}); });
...@@ -462,12 +464,6 @@ socket.on('loadMessages', function(messages, shopMemberId){ ...@@ -462,12 +464,6 @@ socket.on('loadMessages', function(messages, shopMemberId){
//userProfilePathが使えるpathかをcheckして使えないpathの場合、default画像の経路に変更 //userProfilePathが使えるpathかをcheckして使えないpathの場合、default画像の経路に変更
message.profileImagePath = profileImgPathValidCheck(message.profileImagePath, message.checkProfileExist) message.profileImagePath = profileImgPathValidCheck(message.profileImagePath, message.checkProfileExist)
try {
message.message = decodeURIComponent(message.message)
} catch(e) {
message.message = message.message
}
let html = Mustache.render(template, { let html = Mustache.render(template, {
text: message.message, text: message.message,
from: message.loginId, from: message.loginId,
...@@ -961,16 +957,6 @@ socket.on('refreshUserListInGroup', function(users, isInvite){ ...@@ -961,16 +957,6 @@ socket.on('refreshUserListInGroup', function(users, isInvite){
jQuery('#pills-user-tab').tab('show'); jQuery('#pills-user-tab').tab('show');
}); });
// #36135, #36142
jQuery('#newRoomName').on('keyup', function(event) {
if ($('#newRoomName').val().trim().length >= 20) {
alert("Please enter room name less than 20 characters");
var inputText = $('#newRoomName').val();
$('#newRoomName').val(inputText.substr(0, $('#newRoomName').prop("maxlength")));
event.preventDefault();
}
})
// グループ画面での検索 // グループ画面での検索
jQuery('#groupListKeyword').on('input', function(event) { jQuery('#groupListKeyword').on('input', function(event) {
// data-name値で当該キーワードが入っているグループのみを表示する。 // data-name値で当該キーワードが入っているグループのみを表示する。
...@@ -1256,10 +1242,22 @@ function showConfirmView(isInvite){ ...@@ -1256,10 +1242,22 @@ function showConfirmView(isInvite){
if (jQuery('#select_user_list .user_list').find('.userCheckBox').length > 0) { if (jQuery('#select_user_list .user_list').find('.userCheckBox').length > 0) {
// #36130に対応 // #36130に対応
const trimmedRoomName = jQuery('#newRoomName').val().trim() const trimmedRoomName = jQuery('#newRoomName').val().trim()
if(trimmedRoomName.length == 0) { if (trimmedRoomName.length == 0) {
//ルーム名を入力しなかったら、ルーム名textFieldにfocusを置く //ルーム名を入力しなかったら、ルーム名textFieldにfocusを置く
jQuery('#newRoomName').focus(); jQuery('#newRoomName').focus();
alert("Input RoomName"); alert("Input RoomName");
} else if(trimmedRoomName.includes(';') || trimmedRoomName.includes('/') || trimmedRoomName.includes('?') || trimmedRoomName.includes(':') || trimmedRoomName.includes("@")
|| trimmedRoomName.includes('&') || trimmedRoomName.includes('=') || trimmedRoomName.includes("+") || trimmedRoomName.includes('$') || trimmedRoomName.includes(",") || trimmedRoomName.includes('-')
|| trimmedRoomName.includes('_') || trimmedRoomName.includes('.') || trimmedRoomName.includes('!') || trimmedRoomName.includes('~') || trimmedRoomName.includes('*') || trimmedRoomName.includes("\'")
|| trimmedRoomName.includes('(') || trimmedRoomName.includes(')') || trimmedRoomName.includes('#') || trimmedRoomName.includes("\\") || trimmedRoomName.includes("\"") || trimmedRoomName.includes("`")) {
// #36147
alert("InvalidSpecialCharacterRoomName")
} else if (trimmedRoomName.length > 20) {
// #36142
var inputText = $('#newRoomName').val().trim(); // #36142 文字列の前又は後の空白文字列を削除
alert("Please enter room name less than 20 characters", () => {
$('#newRoomName').val(inputText.substr(0, $('#newRoomName').prop("maxlength")));
});
} else { } else {
//loadingIndicatorを表示 //loadingIndicatorを表示
showLoadingIndicator(); showLoadingIndicator();
...@@ -1267,13 +1265,13 @@ function showConfirmView(isInvite){ ...@@ -1267,13 +1265,13 @@ function showConfirmView(isInvite){
return e.dataset.id; return e.dataset.id;
}); });
// 新しいルーム // ルーム名のtrimmingした後、URIencodingを行う
let newRoomName = jQuery('#newRoomName').val(); const encodedRoomName = encodeURIComponent(trimmedRoomName);
socket.emit('createNewRoom', userIdList, newRoomName, function(newRoomId) { socket.emit('createNewRoom', userIdList, encodedRoomName, function(newRoomId) {
socket.emit('joinRoom', newRoomId, newRoomName, function () { socket.emit('joinRoom', newRoomId, trimmedRoomName, function () {
saveRoomInfo(newRoomId, newRoomName); saveRoomInfo(newRoomId, trimmedRoomName);
jQuery('#messages').html(''); jQuery('#messages').html('');
jQuery('.titleRoomName').text(newRoomName).data('roomName', newRoomName); jQuery('.titleRoomName').text(trimmedRoomName).data('roomName', trimmedRoomName);
jQuery("#userSelectionDeleteBtn").hide(); jQuery("#userSelectionDeleteBtn").hide();
jQuery('#pills-chat-tab').tab('show'); jQuery('#pills-chat-tab').tab('show');
}); });
......
...@@ -1433,4 +1433,5 @@ ...@@ -1433,4 +1433,5 @@
<string name="msg_chat_confirm_member">選択したメンバーをリストから削除しますか?</string> <string name="msg_chat_confirm_member">選択したメンバーをリストから削除しますか?</string>
<string name="msg_chat_confirm_delete">このチャットルームを削除しますか?</string> <string name="msg_chat_confirm_delete">このチャットルームを削除しますか?</string>
<string name="msg_error_chat_room_name_too_long">ルーム名は文字列20字以内に入力してください。</string> <string name="msg_error_chat_room_name_too_long">ルーム名は文字列20字以内に入力してください。</string>
<string name="msg_error_chat_name_has_invalid_character">特殊文字 ;/?:@&amp;=+$,-_.!~*\'()#\\\"` はルーム名に含めることができません。</string>
</resources> </resources>
...@@ -1441,4 +1441,5 @@ ...@@ -1441,4 +1441,5 @@
<string name="msg_chat_confirm_member">목록에서 선택된 멤버를 삭제하시겠습니까?</string> <string name="msg_chat_confirm_member">목록에서 선택된 멤버를 삭제하시겠습니까?</string>
<string name="msg_chat_confirm_delete">이 방을 삭제 하시겠습니까?</string> <string name="msg_chat_confirm_delete">이 방을 삭제 하시겠습니까?</string>
<string name="msg_error_chat_room_name_too_long">방 제목은 20자 이내로 입력해 주세요.</string> <string name="msg_error_chat_room_name_too_long">방 제목은 20자 이내로 입력해 주세요.</string>
<string name="msg_error_chat_name_has_invalid_character">특수문자 ;/?:@&amp;=+$,-_.!~*\'()#\\\"` 는 방 제목에 포함될 수 없습니다.</string>
</resources> </resources>
\ No newline at end of file
...@@ -1439,4 +1439,5 @@ ...@@ -1439,4 +1439,5 @@
<string name="msg_chat_confirm_member">Do you want to remove selected members from the list?</string> <string name="msg_chat_confirm_member">Do you want to remove selected members from the list?</string>
<string name="msg_chat_confirm_delete">Do you want to delete this room?</string> <string name="msg_chat_confirm_delete">Do you want to delete this room?</string>
<string name="msg_error_chat_room_name_too_long">Please enter room name less than 20 characters.</string> <string name="msg_error_chat_room_name_too_long">Please enter room name less than 20 characters.</string>
<string name="msg_error_chat_name_has_invalid_character">The character ;/?:@&amp;=+$,-_.!~*\'()#\\\"` cannot be included in the roomname.</string>
</resources> </resources>
\ No newline at end of file
...@@ -8,6 +8,7 @@ import android.content.Context; ...@@ -8,6 +8,7 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.res.Configuration;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.media.Image; import android.media.Image;
import android.net.Uri; import android.net.Uri;
...@@ -90,6 +91,11 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -90,6 +91,11 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (isNormalSize()) {
setPortraitIfNormal();
}
setContentView(R.layout.chat_webview); setContentView(R.layout.chat_webview);
Intent intent = getIntent(); Intent intent = getIntent();
chatWebviewUrl = intent.getStringExtra("chatWebviewUrl"); chatWebviewUrl = intent.getStringExtra("chatWebviewUrl");
...@@ -143,6 +149,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -143,6 +149,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@Override @Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) { public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
boolean result; boolean result;
// result = startCameraIntent(ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE_VIDEO, true);
result = startCameraIntent(ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true); result = startCameraIntent(ABOOK_CHECK_TASK_IMAGE, "Camera", ABookKeys.IMAGE, true);
if (result) { if (result) {
if (mUploadMessage != null) { if (mUploadMessage != null) {
...@@ -182,6 +189,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -182,6 +189,8 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
// #36142 // #36142
} else if (message.equals("Please enter room name less than 20 characters")) { } else if (message.equals("Please enter room name less than 20 characters")) {
message = getString(R.string.msg_error_chat_room_name_too_long); message = getString(R.string.msg_error_chat_room_name_too_long);
} else if (message.equals("InvalidSpecialCharacterRoomName")) {
message = getString(R.string.msg_error_chat_name_has_invalid_character);
} else { } else {
message = message; message = message;
} }
...@@ -231,27 +240,22 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -231,27 +240,22 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} else { } else {
message = "Confirm ?"; message = "Confirm ?";
} }
new AlertDialog.Builder(ChatWebviewActivity.this) ABookAlertDialog confirmAlert = AlertDialogUtil.createAlertDialog(ChatWebviewActivity.this, R.string.app_name);
.setTitle(getString(R.string.app_name)) confirmAlert.setMessage(message);
.setMessage(message) confirmAlert.setButton(DialogInterface.BUTTON_POSITIVE, getResources().getString(R.string.confirm), new DialogInterface.OnClickListener() {
.setPositiveButton(android.R.string.ok, @Override
new DialogInterface.OnClickListener() public void onClick(DialogInterface dialog, int which) {
{ result.confirm();
public void onClick(DialogInterface dialog, int which) }
{ });
result.confirm(); confirmAlert.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(R.string.cancel), new DialogInterface.OnClickListener() {
} @Override
}) public void onClick(DialogInterface dialog, int which) {
.setNegativeButton(android.R.string.cancel, result.cancel();
new DialogInterface.OnClickListener() }
{ });
public void onClick(DialogInterface dialog, int which) confirmAlert.setCancelable(false);
{ showAlertDialog(confirmAlert);
result.cancel();
}
})
.create()
.show();
return true; return true;
} }
...@@ -346,6 +350,14 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -346,6 +350,14 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} }
@Override @Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (isNormalSize()) {
setPortraitIfNormal();
}
}
@Override
public void onDestroy(){ public void onDestroy(){
super.onDestroy(); super.onDestroy();
......
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