Skip to content

Commit af5bae4

Browse files
Merge pull request #5739 from christianbeeznest/GH-5712
Internal: Fix chat emoji handling and user ID references - refs #5712
2 parents c0d7c68 + ddb139d commit af5bae4

File tree

2 files changed

+5
-50
lines changed

2 files changed

+5
-50
lines changed

src/CoreBundle/Controller/ChatController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public function index(): Response
4141
[
4242
'restrict_to_coach' => ('true' === api_get_setting('chat.course_chat_restrict_to_coach')),
4343
'user' => api_get_user_info(),
44+
'emoji_smile' => '<span>&#128522;</span>',
45+
'course_url_params' => api_get_cidreq(),
4446
]
4547
);
4648
}

src/CoreBundle/Resources/views/Chat/chat.html.twig

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@
114114
buttonTitle = user.isConnected ? '{{ 'StartAChat'|get_lang }}' : '{{ 'LeaveAMessage'|get_lang }}';
115115
116116
html += '<li class="col-xs-12">' +
117-
' <div class="chat-user" data-name="' + user.complete_name + '" data-user="' + user.id + '">' +
117+
' <div class="chat-user" data-name="' + user.complete_name + '" data-user="' + user.user_id + '">' +
118118
' <img src="' + user.image_url + '" alt="' + user.complete_name + '" class="img-circle user-image-chat"/>' +
119119
' <ul class="list-unstyled">' +
120120
' <li>' + user.complete_name;
121121
122-
if (user.id != {{ user.id }}) {
123-
html += ' <button type="button" class="btn btn-link btn-xs" title="' + buttonTitle + '" data-name="' + user.complete_name + '" data-user="' + user.id + '">' +
122+
if (user.user_id != {{ user.user_id }}) {
123+
html += ' <button type="button" class="btn btn-link btn-xs" title="' + buttonTitle + '" data-name="' + user.complete_name + '" data-user="' + user.user_id + '">' +
124124
' <i class="fa fa-comments text-' + buttonStatus + '"></i><span class="sr-only">' + buttonTitle + '</span>' +
125125
' </button>';
126126
}
@@ -209,53 +209,6 @@
209209
$('[data-toggle="tab"][href="#tab1"]').show().tab('show');
210210
});
211211
212-
/*$('textarea#chat-writer').emojiarea({
213-
button: '#emojis'
214-
});*/
215-
216-
/*$('body').delay(1500).find('.emoji-wysiwyg-editor').textcomplete([{
217-
match: /\B:([\-+\w]*)$/,
218-
search: function (term, callback) {
219-
var results = [];
220-
var results2 = [];
221-
var results3 = [];
222-
$.each(emojiStrategy, function (shortname, data) {
223-
if (shortname.indexOf(term) > -1) {
224-
results.push(shortname);
225-
} else {
226-
if ((data.aliases !== null) && (data.aliases.indexOf(term) > -1)) {
227-
results2.push(shortname);
228-
} else if ((data.keywords !== null) && (data.keywords.indexOf(term) > -1)) {
229-
results3.push(shortname);
230-
}
231-
}
232-
});
233-
234-
if (term.length >= 3) {
235-
results.sort(function (a, b) {
236-
return (a.length > b.length);
237-
});
238-
results2.sort(function (a, b) {
239-
return (a.length > b.length);
240-
});
241-
results3.sort();
242-
}
243-
244-
var newResults = results.concat(results2).concat(results3);
245-
callback(newResults);
246-
},
247-
template: function (shortname) {
248-
return '<img class="emojione" src="{{ _p.web_lib }}javascript/emojione/png/'
249-
+ emojiStrategy[shortname].unicode
250-
+ '.png"> :' + shortname + ':';
251-
},
252-
replace: function (shortname) {
253-
return ':' + shortname + ': ';
254-
},
255-
index: 1,
256-
maxCount: 10
257-
}], {});
258-
*/
259212
$('button#chat-send-message').on('click', ChChat.onSendMessageListener);
260213
$('#chat-users').on('click', 'div.chat-user', function (e) {
261214
e.preventDefault();

0 commit comments

Comments
 (0)