|
|
@ -33,8 +33,8 @@ import { toast } from "./toast"; |
|
|
|
|
|
|
|
|
|
|
|
let setText = (text: string, row: Row) => { |
|
|
|
let setText = (text: string, row: Row) => { |
|
|
|
//fastRaf(() => {
|
|
|
|
//fastRaf(() => {
|
|
|
|
row.title.innerHTML = text; |
|
|
|
row.title.innerHTML = text || ''; |
|
|
|
row.container.style.display = ''; |
|
|
|
row.container.style.display = text ? '' : 'none'; |
|
|
|
//});
|
|
|
|
//});
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -207,6 +207,12 @@ export default class PeerProfile { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listenerSetter.add(rootScope)('peer_title_edit', (peerId) => { |
|
|
|
|
|
|
|
if(peerId === this.peerId) { |
|
|
|
|
|
|
|
this.fillUsername(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
listenerSetter.add(rootScope)('user_update', (userId) => { |
|
|
|
listenerSetter.add(rootScope)('user_update', (userId) => { |
|
|
|
if(this.peerId === userId.toPeerId()) { |
|
|
|
if(this.peerId === userId.toPeerId()) { |
|
|
|
this.setPeerStatus(); |
|
|
|
this.setPeerStatus(); |
|
|
@ -216,12 +222,8 @@ export default class PeerProfile { |
|
|
|
listenerSetter.add(rootScope)('contacts_update', (userId) => { |
|
|
|
listenerSetter.add(rootScope)('contacts_update', (userId) => { |
|
|
|
if(this.peerId === userId.toPeerId()) { |
|
|
|
if(this.peerId === userId.toPeerId()) { |
|
|
|
const user = appUsersManager.getUser(userId); |
|
|
|
const user = appUsersManager.getUser(userId); |
|
|
|
if(!user.pFlags.self) { |
|
|
|
if(!user.pFlags.self || !this.isDialog) { |
|
|
|
if(user.phone) { |
|
|
|
this.fillUserPhone(); |
|
|
|
setText(appUsersManager.formatUserPhone(user.phone), this.phone); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.phone.container.style.display = 'none'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -299,47 +301,44 @@ export default class PeerProfile { |
|
|
|
this.section.content.prepend(this.avatar, this.name, this.subtitle); |
|
|
|
this.section.content.prepend(this.avatar, this.name, this.subtitle); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public fillProfileElements() { |
|
|
|
private fillUsername() { |
|
|
|
if(!this.cleaned) return; |
|
|
|
const {peerId} = this; |
|
|
|
this.cleaned = false; |
|
|
|
if(peerId.isUser() && this.canBeDetailed()) { |
|
|
|
|
|
|
|
|
|
|
|
const peerId = this.peerId; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.cleanupHTML(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setAvatar(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// username
|
|
|
|
|
|
|
|
if(this.canBeDetailed()) { |
|
|
|
|
|
|
|
if(peerId.isUser()) { |
|
|
|
|
|
|
|
const username = appPeersManager.getPeerUsername(peerId); |
|
|
|
const username = appPeersManager.getPeerUsername(peerId); |
|
|
|
if(username) { |
|
|
|
setText(username, this.username); |
|
|
|
setText(appPeersManager.getPeerUsername(peerId), this.username); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(this.notifications) { |
|
|
|
private fillUserPhone() { |
|
|
|
const muted = appNotificationsManager.isPeerLocalMuted(peerId, false); |
|
|
|
const {peerId} = this; |
|
|
|
this.notifications.checkboxField.checked = !muted; |
|
|
|
if(peerId.isUser() && this.canBeDetailed()) { |
|
|
|
|
|
|
|
const user = appUsersManager.getUser(peerId); |
|
|
|
|
|
|
|
setText(user.phone ? appUsersManager.formatUserPhone(user.phone) : undefined, this.phone); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if(this.notifications) { |
|
|
|
|
|
|
|
fastRaf(() => { |
|
|
|
|
|
|
|
this.notifications.container.style.display = 'none'; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//let membersLi = this.profileTabs.firstElementChild.children[0] as HTMLLIElement;
|
|
|
|
private fillNotifications() { |
|
|
|
if(peerId.isUser()) { |
|
|
|
const notificationsRow = this.notifications; |
|
|
|
//membersLi.style.display = 'none';
|
|
|
|
if(!notificationsRow) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let user = appUsersManager.getUser(peerId); |
|
|
|
if(this.canBeDetailed()) { |
|
|
|
if(user.phone && this.canBeDetailed()) { |
|
|
|
const muted = appNotificationsManager.isPeerLocalMuted(this.peerId, false); |
|
|
|
setText(appUsersManager.formatUserPhone(user.phone), this.phone); |
|
|
|
notificationsRow.checkboxField.checked = !muted; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
fastRaf(() => { |
|
|
|
|
|
|
|
notificationsRow.container.style.display = 'none'; |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}/* else { |
|
|
|
} |
|
|
|
//membersLi.style.display = appPeersManager.isBroadcast(peerId) ? 'none' : '';
|
|
|
|
|
|
|
|
} */ |
|
|
|
private fillRows() { |
|
|
|
|
|
|
|
const peerId = this.peerId; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.fillUsername(); |
|
|
|
|
|
|
|
this.fillUserPhone(); |
|
|
|
|
|
|
|
this.fillNotifications(); |
|
|
|
this.setMoreDetails(); |
|
|
|
this.setMoreDetails(); |
|
|
|
|
|
|
|
|
|
|
|
replaceContent(this.name, new PeerTitle({ |
|
|
|
replaceContent(this.name, new PeerTitle({ |
|
|
@ -355,6 +354,15 @@ export default class PeerProfile { |
|
|
|
this.setPeerStatus(true); |
|
|
|
this.setPeerStatus(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public fillProfileElements() { |
|
|
|
|
|
|
|
if(!this.cleaned) return; |
|
|
|
|
|
|
|
this.cleaned = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.cleanupHTML(); |
|
|
|
|
|
|
|
this.setAvatar(); |
|
|
|
|
|
|
|
this.fillRows(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public setMoreDetails(override?: true) { |
|
|
|
public setMoreDetails(override?: true) { |
|
|
|
if(this.setMoreDetailsTimeout) { |
|
|
|
if(this.setMoreDetailsTimeout) { |
|
|
|
window.clearTimeout(this.setMoreDetailsTimeout); |
|
|
|
window.clearTimeout(this.setMoreDetailsTimeout); |
|
|
@ -376,9 +384,9 @@ export default class PeerProfile { |
|
|
|
|
|
|
|
|
|
|
|
//this.log('chatInfo res 2:', chatFull);
|
|
|
|
//this.log('chatInfo res 2:', chatFull);
|
|
|
|
|
|
|
|
|
|
|
|
if(peerFull.about) { |
|
|
|
// if(peerFull.about) {
|
|
|
|
setText(RichTextProcessor.wrapRichText(peerFull.about), this.bio); |
|
|
|
setText(peerFull.about ? RichTextProcessor.wrapRichText(peerFull.about) : undefined, this.bio); |
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if(!peerId.isUser()) { |
|
|
|
if(!peerId.isUser()) { |
|
|
|
const chat: Chat.channel = appChatsManager.getChat(peerId.toChatId()); |
|
|
|
const chat: Chat.channel = appChatsManager.getChat(peerId.toChatId()); |
|
|
|