Browse Source

Show anonymous messages in megagroups as out

master
Eduard Kuzmenko 4 years ago
parent
commit
bb7c2bbe47
  1. 11
      src/components/chat/bubbles.ts
  2. 6
      src/components/popups/newMedia.ts
  3. 5
      src/components/wrappers.ts
  4. 10
      src/scss/partials/_chatBubble.scss

11
src/components/chat/bubbles.ts

@ -1451,7 +1451,8 @@ export default class ChatBubbles {
} }
const peerId = this.peerId; 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'); const messageDiv = document.createElement('div');
messageDiv.classList.add('message'); messageDiv.classList.add('message');
@ -2185,11 +2186,15 @@ export default class ChatBubbles {
bubble.classList.add('is-reply'); 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'); let nameDiv = document.createElement('div');
nameDiv.classList.add('name'); nameDiv.classList.add('name');
nameDiv.innerHTML = title; 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; nameDiv.dataset.peerId = message.fromId;
nameContainer.append(nameDiv); nameContainer.append(nameDiv);
} else /* if(!message.reply_to_mid) */ { } else /* if(!message.reply_to_mid) */ {

6
src/components/popups/newMedia.ts

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

5
src/components/wrappers.ts

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

10
src/scss/partials/_chatBubble.scss

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

Loading…
Cancel
Save