Eduard Kuzmenko
3 years ago
9 changed files with 55 additions and 17 deletions
@ -0,0 +1,8 @@ |
|||||||
|
import { _i18n } from "../lib/langPack"; |
||||||
|
|
||||||
|
export default function generateFakeIcon(isScam?: boolean) { |
||||||
|
const span = document.createElement('span'); |
||||||
|
span.classList.add('badge-fake'); |
||||||
|
_i18n(span, isScam ? 'ScamMessage' : 'FakeMessage'); |
||||||
|
return span; |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
import { Chat, User } from "../layer"; |
||||||
|
import appPeersManager from "../lib/appManagers/appPeersManager"; |
||||||
|
import generateFakeIcon from "./generateFakeIcon"; |
||||||
|
import generateVerifiedIcon from "./generateVerifiedIcon"; |
||||||
|
|
||||||
|
export default function generateTitleIcons(peerId: PeerId) { |
||||||
|
const elements: Element[] = []; |
||||||
|
const peer = appPeersManager.getPeer(peerId); |
||||||
|
if(peer?.pFlags?.verified) { |
||||||
|
elements.push(generateVerifiedIcon()); |
||||||
|
} |
||||||
|
|
||||||
|
if((peer as Chat.channel).pFlags.fake || (peer as User.user).pFlags.scam) { |
||||||
|
elements.push(generateFakeIcon((peer as User.user).pFlags.scam)); |
||||||
|
} |
||||||
|
|
||||||
|
return elements; |
||||||
|
} |
Loading…
Reference in new issue