mirror of
https://github.com/jech/galene.git
synced 2024-11-22 16:45:58 +01:00
Fix chathistory and display of anonymous users.
Chathistory messages were formatted incorrectly. We were also not formatting correctly messages from anonymous users.
This commit is contained in:
parent
3a2efbcc7e
commit
0fe3ed2e15
2 changed files with 14 additions and 17 deletions
|
@ -1194,7 +1194,7 @@ func handleAction(c *webClient, a interface{}) error {
|
||||||
for _, m := range h {
|
for _, m := range h {
|
||||||
err := c.write(clientMessage{
|
err := c.write(clientMessage{
|
||||||
Type: "chathistory",
|
Type: "chathistory",
|
||||||
Id: m.Id,
|
Source: m.Id,
|
||||||
Username: m.User,
|
Username: m.User,
|
||||||
Time: m.Time,
|
Time: m.Time,
|
||||||
Value: m.Value,
|
Value: m.Value,
|
||||||
|
|
|
@ -2594,12 +2594,11 @@ function addToChatbox(peerId, dest, nick, time, privileged, history, kind, messa
|
||||||
if(kind !== 'me') {
|
if(kind !== 'me') {
|
||||||
let p = formatLines(message.toString().split('\n'));
|
let p = formatLines(message.toString().split('\n'));
|
||||||
let doHeader = true;
|
let doHeader = true;
|
||||||
if(!peerId && !dest && !nick) {
|
if(lastMessage.nick !== (nick || null) ||
|
||||||
doHeader = false;
|
lastMessage.peerId !== (peerId || null) ||
|
||||||
} else if(lastMessage.nick !== (nick || null) ||
|
|
||||||
lastMessage.peerId !== peerId ||
|
|
||||||
lastMessage.dest !== (dest || null) ||
|
lastMessage.dest !== (dest || null) ||
|
||||||
!time || !lastMessage.time) {
|
!time || !lastMessage.time) {
|
||||||
|
console.log("A", nick, peerId, dest, time, lastMessage.time);
|
||||||
doHeader = true;
|
doHeader = true;
|
||||||
} else {
|
} else {
|
||||||
let delta = time - lastMessage.time;
|
let delta = time - lastMessage.time;
|
||||||
|
@ -2608,16 +2607,14 @@ function addToChatbox(peerId, dest, nick, time, privileged, history, kind, messa
|
||||||
|
|
||||||
if(doHeader) {
|
if(doHeader) {
|
||||||
let header = document.createElement('p');
|
let header = document.createElement('p');
|
||||||
if(peerId || nick || dest) {
|
|
||||||
let user = document.createElement('span');
|
let user = document.createElement('span');
|
||||||
let u = serverConnection.users[dest];
|
let u = dest && serverConnection.users[dest];
|
||||||
let name = (u && u.username);
|
let name = (u && u.username);
|
||||||
user.textContent = dest ?
|
user.textContent = dest ?
|
||||||
`${nick||'(anon)'} \u2192 ${name || '(anon)'}` :
|
`${nick || '(anon)'} \u2192 ${name || '(anon)'}` :
|
||||||
(nick || '(anon)');
|
(nick || '(anon)');
|
||||||
user.classList.add('message-user');
|
user.classList.add('message-user');
|
||||||
header.appendChild(user);
|
header.appendChild(user);
|
||||||
}
|
|
||||||
header.classList.add('message-header');
|
header.classList.add('message-header');
|
||||||
container.appendChild(header);
|
container.appendChild(header);
|
||||||
if(time) {
|
if(time) {
|
||||||
|
|
Loading…
Reference in a new issue