Updated isModerator to senderIsModerator and fixed logic of isModerator function

pull/652/head
Vince 6 years ago
parent 43a91ab672
commit e9068d56ce

@ -648,14 +648,16 @@
isP2p: !!this.get('isP2p'), isP2p: !!this.get('isP2p'),
isPublic: !!this.get('isPublic'), isPublic: !!this.get('isPublic'),
isRss: !!this.get('isRss'), isRss: !!this.get('isRss'),
isModerator: senderIsModerator:
!!this.get('isPublic') && !!this.get('isPublic') &&
this.getConversation().isModerator(this.getSource()), conversation &&
conversation.isModerator(phoneNumber),
isDeletable: isDeletable:
!this.get('isPublic') || !this.get('isPublic') ||
this.getConversation().isModerator(this.OUR_NUMBER) || conversation && conversation.isModerator(this.OUR_NUMBER) ||
this.getSource() === this.OUR_NUMBER, this.getSource() === this.OUR_NUMBER,
hasModPerms: this.getConversation().isModerator(this.OUR_NUMBER), hasModPerms:
conversation && !!conversation.isModerator(this.OUR_NUMBER),
onCopyText: () => this.copyText(), onCopyText: () => this.copyText(),
onSelectMessage: () => this.selectMessage(), onSelectMessage: () => this.selectMessage(),

@ -55,7 +55,7 @@ interface LinkPreviewType {
export interface Props { export interface Props {
disableMenu?: boolean; disableMenu?: boolean;
isModerator?: boolean; senderIsModerator?: boolean;
isDeletable: boolean; isDeletable: boolean;
hasModPerms?: boolean; hasModPerms?: boolean;
text?: string; text?: string;
@ -212,9 +212,13 @@ export class Message extends React.PureComponent<Props, State> {
} }
public renderMetadataBadges() { public renderMetadataBadges() {
const { direction, isP2p, isPublic, isModerator } = this.props; const { direction, isP2p, isPublic, senderIsModerator } = this.props;
const badges = [isPublic && 'Public', isP2p && 'P2p', isModerator && 'Mod']; const badges = [
isPublic && 'Public',
isP2p && 'P2p',
senderIsModerator && 'Mod',
];
return badges return badges
.map(badgeText => { .map(badgeText => {
@ -657,7 +661,7 @@ export class Message extends React.PureComponent<Props, State> {
authorPhoneNumber, authorPhoneNumber,
authorProfileName, authorProfileName,
collapseMetadata, collapseMetadata,
isModerator, senderIsModerator,
authorColor, authorColor,
conversationType, conversationType,
direction, direction,
@ -684,7 +688,7 @@ export class Message extends React.PureComponent<Props, State> {
profileName={authorProfileName} profileName={authorProfileName}
size={36} size={36}
/> />
{isModerator && ( {senderIsModerator && (
<div className="module-avatar__icon--crown-wrapper"> <div className="module-avatar__icon--crown-wrapper">
<div className="module-avatar__icon--crown" /> <div className="module-avatar__icon--crown" />
</div> </div>

Loading…
Cancel
Save