Commit 1ee02f0d by Takuya Ogawa

Merge branch 'features/1.3.0_chat' into 'features/1.3.0'

- redmineのチャットについて

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