Browse Source

Fix forwarded name from main channel

Fix peer subtitle in chat list
master
morethanwords 4 years ago
parent
commit
1d668b3d1b
  1. 7
      src/lib/appManagers/appDialogsManager.ts
  2. 4
      src/lib/appManagers/appImManager.ts
  3. 6
      src/lib/appManagers/appMessagesManager.ts

7
src/lib/appManagers/appDialogsManager.ts

@ -693,15 +693,16 @@ export class AppDialogsManager {
/* if(lastMessage.from_id == auth.id) { // You: */ /* if(lastMessage.from_id == auth.id) { // You: */
if(peer._ != 'peerUser' && peerID != lastMessage.fromID) { if(peer._ != 'peerUser' && peerID != lastMessage.fromID) {
let sender = appUsersManager.getUser(lastMessage.fromID); const sender = appPeersManager.getPeer(lastMessage.fromID);
if(sender && sender.id) { if(sender && sender.id) {
let senderBold = document.createElement('b'); const senderBold = document.createElement('b');
let str = ''; let str = '';
if(sender.id == $rootScope.myID) { if(sender.id == $rootScope.myID) {
str = 'You'; str = 'You';
} else { } else {
str = sender.first_name || sender.last_name || sender.username; //str = sender.first_name || sender.last_name || sender.username;
str = appPeersManager.getPeerTitle(lastMessage.fromID, true, true);
} }
//senderBold.innerText = str + ': '; //senderBold.innerText = str + ': ';

4
src/lib/appManagers/appImManager.ts

@ -2168,7 +2168,7 @@ export class AppImManager {
if((this.peerID < 0 && !our) || message.fwd_from || message.reply_to_mid) { // chat if((this.peerID < 0 && !our) || message.fwd_from || message.reply_to_mid) { // chat
let title = appPeersManager.getPeerTitle(message.fwdFromID || message.fromID); let title = appPeersManager.getPeerTitle(message.fwdFromID || message.fromID);
const isForwardFromChannel = !message.fromID && message.fwd_from; const isForwardFromChannel = message.from_id && message.from_id._ == 'peerChannel' && message.fromID == message.fwdFromID;
let isHidden = message.fwd_from && !message.fwd_from.from_id && !message.fwd_from.channel_id; let isHidden = message.fwd_from && !message.fwd_from.from_id && !message.fwd_from.channel_id;
if(isHidden) { if(isHidden) {
@ -2181,7 +2181,7 @@ export class AppImManager {
//this.log(title); //this.log(title);
if((message.fwdFromID || message.fwd_from)) { if((message.fwdFromID || message.fwd_from)) {
if(this.peerID != this.myID) { if(this.peerID != this.myID && !isForwardFromChannel) {
bubble.classList.add('forwarded'); bubble.classList.add('forwarded');
} }

6
src/lib/appManagers/appMessagesManager.ts

@ -2243,7 +2243,7 @@ export class AppMessagesManager {
const fwdHeader = apiMessage.fwd_from; const fwdHeader = apiMessage.fwd_from;
if(fwdHeader) { if(fwdHeader) {
if(peerID == myID) { //if(peerID == myID) {
if(fwdHeader.saved_from_peer && fwdHeader.saved_from_msg_id) { if(fwdHeader.saved_from_peer && fwdHeader.saved_from_msg_id) {
const savedFromPeerID = appPeersManager.getPeerID(fwdHeader.saved_from_peer); const savedFromPeerID = appPeersManager.getPeerID(fwdHeader.saved_from_peer);
const savedFromMid = appMessagesIDsManager.getFullMessageID(fwdHeader.saved_from_msg_id, const savedFromMid = appMessagesIDsManager.getFullMessageID(fwdHeader.saved_from_msg_id,
@ -2252,9 +2252,9 @@ export class AppMessagesManager {
} }
apiMessage.fromID = fwdHeader.channel_id ? -fwdHeader.channel_id : appPeersManager.getPeerID(fwdHeader.from_id); apiMessage.fromID = fwdHeader.channel_id ? -fwdHeader.channel_id : appPeersManager.getPeerID(fwdHeader.from_id);
} else { /* } else {
apiMessage.fwdPostID = fwdHeader.channel_post; apiMessage.fwdPostID = fwdHeader.channel_post;
} } */
apiMessage.fwdFromID = fwdHeader.channel_id ? -fwdHeader.channel_id : appPeersManager.getPeerID(fwdHeader.from_id); apiMessage.fwdFromID = fwdHeader.channel_id ? -fwdHeader.channel_id : appPeersManager.getPeerID(fwdHeader.from_id);

Loading…
Cancel
Save