Small chat bugfixes.
This commit is contained in:
parent
8ea3f6b132
commit
3c8a5777bd
7 changed files with 71 additions and 74 deletions
|
@ -119,7 +119,6 @@ class App.CustomerChat extends App.Controller
|
|||
type: 'error'
|
||||
msg: App.i18n.translateContent('To be able to chat you need to select min. one chat topic in settings!')
|
||||
)
|
||||
return
|
||||
|
||||
@meta.active = state
|
||||
|
||||
|
@ -148,7 +147,6 @@ class App.CustomerChat extends App.Controller
|
|||
if @meta.active_sessions
|
||||
for session in @meta.active_sessions
|
||||
@addChat(session)
|
||||
console.log('updateMeta aC', session)
|
||||
@meta.active_sessions = false
|
||||
|
||||
@updateNavMenu()
|
||||
|
@ -281,7 +279,8 @@ class ChatWindow extends App.Controller
|
|||
if preferences.chat && preferences.chat.phrase
|
||||
phrases = preferences.chat.phrase[@session.chat_id]
|
||||
if phrases
|
||||
@sendMessage phrases
|
||||
@input.html(phrases)
|
||||
@sendMessage()
|
||||
|
||||
focus: =>
|
||||
@input.focus()
|
||||
|
@ -352,12 +351,10 @@ class ChatWindow extends App.Controller
|
|||
event.preventDefault()
|
||||
@sendMessage()
|
||||
|
||||
sendMessage: (content) =>
|
||||
if !content
|
||||
sendMessage: =>
|
||||
content = @input.html()
|
||||
return if !content
|
||||
|
||||
console.log('send', content, @session.session_id)
|
||||
App.WebSocket.send(
|
||||
event:'chat_session_message'
|
||||
data:
|
||||
|
|
|
@ -23,7 +23,7 @@ class Sessions::Event::ChatSessionStart < Sessions::Event::ChatBase
|
|||
chat_user = User.find(chat_session.user_id)
|
||||
url = nil
|
||||
if chat_user.image && chat_user.image != 'none'
|
||||
url = "/api/v1/users/image/#{chat_user.image}"
|
||||
url = "#{Setting.get('http_type')}://#{Setting.get('fqdn')}/api/v1/users/image/#{chat_user.image}"
|
||||
end
|
||||
user = {
|
||||
name: chat_user.fullname,
|
||||
|
|
|
@ -452,7 +452,7 @@ do($ = window.jQuery, window) ->
|
|||
wsConnect: =>
|
||||
@detectHost() if !@options.host
|
||||
|
||||
@log 'notice', "Connecting to #{@options.host}"
|
||||
@log 'debug', "Connecting to #{@options.host}"
|
||||
@ws = new window.WebSocket("#{@options.host}")
|
||||
@ws.onopen = @onWebSocketOpen
|
||||
|
||||
|
|
|
@ -558,7 +558,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
|
|||
if (!this.options.host) {
|
||||
this.detectHost();
|
||||
}
|
||||
this.log('notice', "Connecting to " + this.options.host);
|
||||
this.log('debug', "Connecting to " + this.options.host);
|
||||
this.ws = new window.WebSocket("" + this.options.host);
|
||||
this.ws.onopen = this.onWebSocketOpen;
|
||||
this.ws.onmessage = this.onWebSocketMessage;
|
||||
|
@ -683,67 +683,6 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
|
|||
return window.ZammadChat = ZammadChat;
|
||||
})(window.jQuery, window);
|
||||
|
||||
if (!window.zammadChatTemplates) {
|
||||
window.zammadChatTemplates = {};
|
||||
}
|
||||
window.zammadChatTemplates["agent"] = function (__obj) {
|
||||
if (!__obj) __obj = {};
|
||||
var __out = [], __capture = function(callback) {
|
||||
var out = __out, result;
|
||||
__out = [];
|
||||
callback.call(this);
|
||||
result = __out.join('');
|
||||
__out = out;
|
||||
return __safe(result);
|
||||
}, __sanitize = function(value) {
|
||||
if (value && value.ecoSafe) {
|
||||
return value;
|
||||
} else if (typeof value !== 'undefined' && value != null) {
|
||||
return __escape(value);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
|
||||
__safe = __obj.safe = function(value) {
|
||||
if (value && value.ecoSafe) {
|
||||
return value;
|
||||
} else {
|
||||
if (!(typeof value !== 'undefined' && value != null)) value = '';
|
||||
var result = new String(value);
|
||||
result.ecoSafe = true;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
if (!__escape) {
|
||||
__escape = __obj.escape = function(value) {
|
||||
return ('' + value)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"');
|
||||
};
|
||||
}
|
||||
(function() {
|
||||
(function() {
|
||||
if (this.agent.avatar) {
|
||||
__out.push('\n<img class="zammad-chat-agent-avatar" src="');
|
||||
__out.push(__sanitize(this.agent.avatar));
|
||||
__out.push('">\n');
|
||||
}
|
||||
|
||||
__out.push('\n<span class="zammad-chat-agent-sentence">\n <span class="zammad-chat-agent-name">');
|
||||
|
||||
__out.push(__sanitize(this.agent.name));
|
||||
|
||||
__out.push('</span>\n</span>');
|
||||
|
||||
}).call(this);
|
||||
|
||||
}).call(__obj);
|
||||
__obj.safe = __objSafe, __obj.escape = __escape;
|
||||
return __out.join('');
|
||||
};
|
||||
|
||||
/*!
|
||||
* ----------------------------------------------------------------------------
|
||||
* "THE BEER-WARE LICENSE" (Revision 42):
|
||||
|
@ -821,6 +760,67 @@ jQuery.fn.autoGrow = function(options) {
|
|||
|
||||
});
|
||||
};
|
||||
if (!window.zammadChatTemplates) {
|
||||
window.zammadChatTemplates = {};
|
||||
}
|
||||
window.zammadChatTemplates["agent"] = function (__obj) {
|
||||
if (!__obj) __obj = {};
|
||||
var __out = [], __capture = function(callback) {
|
||||
var out = __out, result;
|
||||
__out = [];
|
||||
callback.call(this);
|
||||
result = __out.join('');
|
||||
__out = out;
|
||||
return __safe(result);
|
||||
}, __sanitize = function(value) {
|
||||
if (value && value.ecoSafe) {
|
||||
return value;
|
||||
} else if (typeof value !== 'undefined' && value != null) {
|
||||
return __escape(value);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
|
||||
__safe = __obj.safe = function(value) {
|
||||
if (value && value.ecoSafe) {
|
||||
return value;
|
||||
} else {
|
||||
if (!(typeof value !== 'undefined' && value != null)) value = '';
|
||||
var result = new String(value);
|
||||
result.ecoSafe = true;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
if (!__escape) {
|
||||
__escape = __obj.escape = function(value) {
|
||||
return ('' + value)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"');
|
||||
};
|
||||
}
|
||||
(function() {
|
||||
(function() {
|
||||
if (this.agent.avatar) {
|
||||
__out.push('\n<img class="zammad-chat-agent-avatar" src="');
|
||||
__out.push(__sanitize(this.agent.avatar));
|
||||
__out.push('">\n');
|
||||
}
|
||||
|
||||
__out.push('\n<span class="zammad-chat-agent-sentence">\n <span class="zammad-chat-agent-name">');
|
||||
|
||||
__out.push(__sanitize(this.agent.name));
|
||||
|
||||
__out.push('</span>\n</span>');
|
||||
|
||||
}).call(this);
|
||||
|
||||
}).call(__obj);
|
||||
__obj.safe = __objSafe, __obj.escape = __escape;
|
||||
return __out.join('');
|
||||
};
|
||||
|
||||
if (!window.zammadChatTemplates) {
|
||||
window.zammadChatTemplates = {};
|
||||
}
|
||||
|
|
2
public/assets/chat/chat.min.js
vendored
2
public/assets/chat/chat.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -138,7 +138,7 @@
|
|||
-->
|
||||
<script>
|
||||
var chat = new ZammadChat({
|
||||
chat_id: 1,
|
||||
chatId: 1,
|
||||
host: 'ws://localhost:6042',
|
||||
debug: true
|
||||
});
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
<script src="chat.js"></script>
|
||||
<script>
|
||||
var chat = new ZammadChat({
|
||||
chat_id: 1,
|
||||
chatId: 1,
|
||||
host: 'ws://localhost:6042',
|
||||
debug: true,
|
||||
background: '#494d52',
|
||||
|
|
Loading…
Reference in a new issue