Browse Source

Show anonymous messages in megagroups as out

master
Eduard Kuzmenko 4 years ago
parent
commit
bb7c2bbe47
  1. 9
      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

9
src/components/chat/bubbles.ts

@ -1451,7 +1451,8 @@ export default class ChatBubbles { @@ -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 { @@ -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;
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) */ {

6
src/components/popups/newMedia.ts

@ -267,6 +267,9 @@ export default class PopupNewMedia extends PopupElement { @@ -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 { @@ -280,8 +283,7 @@ export default class PopupNewMedia extends PopupElement {
url: params.objectURL
}
}
} as any,
uploading: true
} as any
});
const finish = () => {

5
src/components/wrappers.ts

@ -343,14 +343,15 @@ export const formatDate = (timestamp: number, monthShort = false, withYear = tru @@ -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();

10
src/scss/partials/_chatBubble.scss

@ -1432,7 +1432,7 @@ $bubble-margin: .25rem; @@ -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; @@ -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; @@ -1863,9 +1867,9 @@ $bubble-margin: .25rem;
}
}
&.is-reply .name {
/* &.is-reply .name {
display: none;
}
} */
.document-ico:after {
border-top-color: #eeffde;

Loading…
Cancel
Save