Commit bc911e43 authored by Penar Musaraj's avatar Penar Musaraj
Browse files

Display user avatars when call has users

parent 211c8d6b
......@@ -59,9 +59,18 @@ module BigBlue
if data['response']['returncode'] == "SUCCESS"
att = data['response']['attendees']['attendee']
usernames = att.is_a?(Array) ? att.pluck("userID") : [att["userID"]]
users = User.where("lower(username) IN (?)", usernames)
avatars = users.map do |s|
{
name: s.name || s.username,
avatar_url: s.avatar_template_url.gsub('{size}', '25')
}
end
{
count: data['response']['participantCount'],
usernames: att.is_a?(Array) ? att.pluck("userID") : [att["userID"]]
avatars: avatars
}
else
{}
......
......@@ -3,7 +3,6 @@ import showModal from "discourse/lib/show-modal";
import { iconHTML } from "discourse-common/lib/icon-library";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { avatarImg } from "discourse/widgets/post";
function launchBBB($elem, fullWindow) {
const data = $elem.data();
......@@ -45,8 +44,13 @@ function attachStatus($elem, helper) {
const data = $elem.data();
ajax(`/bbb/status/${data.meetingID}.json`).then(res => {
if (res.usernames) {
status.html(`On the call: ${res.usernames.join(", ")}`);
if (res.avatars) {
status.html(`<span>On the call: </span>`);
res.avatars.forEach(function(avatar) {
status.append(
`<img src="${avatar.avatar_url}" class="avatar" width="25" height="25" title="${avatar.name}" />`
);
});
}
});
}
......
......@@ -2,3 +2,7 @@
margin-left: 1em;
font-size: 0.9em;
}
.bbb-status img {
margin-left: 0.5em;
}
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