Show anonymous messages in megagroups as out

This commit is contained in:
Eduard Kuzmenko 2020-12-20 06:41:42 +02:00
parent 7e464418a6
commit 30e161026a
4 changed files with 22 additions and 10 deletions

View File

@ -1451,7 +1451,8 @@ export default class ChatBubbles {
}
const peerId = this.peerId;
const our = message.fromId == rootScope.myId; // * can't use 'message.pFlags.out' here because this check will be used to define side of message (left-right)
// * can't use 'message.pFlags.out' here because this check will be used to define side of message (left-right)
const our = message.fromId == rootScope.myId || (message.pFlags.out && this.appPeersManager.isMegagroup(this.peerId));
const messageDiv = document.createElement('div');
messageDiv.classList.add('message');
@ -2185,11 +2186,15 @@ export default class ChatBubbles {
bubble.classList.add('is-reply');
}
if(!bubble.classList.contains('sticker') && (peerId < 0 && peerId != message.fromId)) {
if(!bubble.classList.contains('sticker') && (peerId < 0 && (peerId != message.fromId || our)) && message.fromId !== rootScope.myId) {
let nameDiv = document.createElement('div');
nameDiv.classList.add('name');
nameDiv.innerHTML = title;
nameDiv.style.color = this.appPeersManager.getPeerColorById(message.fromId, false);
if(!our) {
nameDiv.style.color = this.appPeersManager.getPeerColorById(message.fromId, false);
}
nameDiv.dataset.peerId = message.fromId;
nameContainer.append(nameDiv);
} else /* if(!message.reply_to_mid) */ {

View File

@ -267,6 +267,9 @@ export default class PopupNewMedia extends PopupElement {
const docDiv = wrapDocument({
message: {
_: 'message',
pFlags: {
is_outgoing: true
},
mid: 0,
peerId: 0,
media: {
@ -280,8 +283,7 @@ export default class PopupNewMedia extends PopupElement {
url: params.objectURL
}
}
} as any,
uploading: true
} as any
});
const finish = () => {

View File

@ -343,14 +343,15 @@ export const formatDate = (timestamp: number, monthShort = false, withYear = tru
return str + ' at ' + date.getHours() + ':' + ('0' + date.getMinutes()).slice(-2);
};
export function wrapDocument({message, withTime, uploading, fontWeight}: {
export function wrapDocument({message, withTime, fontWeight}: {
message: any,
withTime?: boolean,
uploading?: boolean,
fontWeight?: number
}): HTMLElement {
if(!fontWeight) fontWeight = 500;
const uploading = message.pFlags.is_outgoing;
const doc = message.media.document || message.media.webpage.document;
if(doc.type == 'audio' || doc.type == 'voice') {
const audioElement = new AudioElement();

View File

@ -1432,7 +1432,7 @@ $bubble-margin: .25rem;
}
&:not(.sticker):not(.emoji-big) {
&.hide-name, &:not(.is-group-first), &.is-out {
&.hide-name, &:not(.is-group-first)/* , &.is-out */ {
.reply {
margin-top: 6px;
}
@ -1759,6 +1759,10 @@ $bubble-margin: .25rem;
&, .poll-footer-button {
border-radius: 12px 6px 6px 12px;
}
.name {
color: #50af4f;
}
}
&.is-group-first {
@ -1863,9 +1867,9 @@ $bubble-margin: .25rem;
}
}
&.is-reply .name {
/* &.is-reply .name {
display: none;
}
} */
.document-ico:after {
border-top-color: #eeffde;