pull/498/head
Mikunj 6 years ago
parent 0883b1b650
commit 0b898612d9

@ -324,17 +324,20 @@ class LokiPublicChannelAPI {
// get moderator status
async pollOnceForModerators() {
// get moderator status
const res = await this.serverRequest(`loki/v1/channel/${this.channelId}/get_moderators`);
const res = await this.serverRequest(
`loki/v1/channel/${this.channelId}/get_moderators`
);
const ourNumber = textsecure.storage.user.getNumber();
// if no problems and we have data
let moderators;
if (!res.err && res.response && res.response.moderators) {
moderators = res.response.moderators;
// Get the list of moderators if no errors occurred
const moderators = !res.err && res.response && res.response.moderators;
// if we encountered problems then we'll keep the old mod status
if (moderators) {
this.modStatus = moderators.includes(ourNumber);
}
// if problems, we won't drop moderator status
await this.conversation.setModerators(moderators);
await this.conversation.setModerators(moderators || []);
// get token info
const tokenRes = await this.serverRequest('token');

@ -2054,16 +2054,16 @@
}
.module-avatar__icon--crown-wrapper {
position: absolute;
bottom: 0;
right: 0;
height: 21px;
width: 21px;
transform: translate(25%, 25%);
padding: 9%;
background-color: $color-white;
border-radius: 50%;
filter: drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.3));
position: absolute;
bottom: 0;
right: 0;
height: 21px;
width: 21px;
transform: translate(25%, 25%);
padding: 9%;
background-color: $color-white;
border-radius: 50%;
filter: drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.3));
}
.module-avatar__icon--crown {

@ -94,7 +94,11 @@ export class JazzIcon extends React.PureComponent<Props> {
private hueShift(colors: Array<string>, generator: RNG) {
const amount = generator.random() * 30 - wobble / 2;
return colors.map(hex => Color(hex).rotate(amount).hex());
return colors.map(hex =>
Color(hex)
.rotate(amount)
.hex()
);
}
private genShape(

@ -196,6 +196,34 @@ export class Message extends React.PureComponent<Props, State> {
});
}
public renderMetadataBadges() {
const { direction, isP2p, isPublic, isModerator } = this.props;
const badges = [isPublic && 'Public', isP2p && 'P2p', isModerator && 'Mod'];
return badges
.map(badgeText => {
if (typeof badgeText !== 'string') {
return null;
}
return (
<span
className={classNames(
'module-message__metadata__badge',
`module-message__metadata__badge--${direction}`,
`module-message__metadata__badge--${badgeText.toLowerCase()}`,
`module-message__metadata__badge--${badgeText.toLowerCase()}--${direction}`
)}
key={badgeText}
>
&nbsp;&nbsp;{badgeText}
</span>
);
})
.filter(i => !!i);
}
public renderMetadata() {
const {
collapseMetadata,
@ -207,9 +235,6 @@ export class Message extends React.PureComponent<Props, State> {
text,
textPending,
timestamp,
isP2p,
isPublic,
isModerator,
} = this.props;
if (collapseMetadata) {
@ -220,23 +245,6 @@ export class Message extends React.PureComponent<Props, State> {
const withImageNoCaption = Boolean(!text && isShowingImage);
const showError = status === 'error' && direction === 'outgoing';
const badges = [isPublic && 'Public', isP2p && 'P2p', isModerator && 'Mod'].map(badgeText => {
if (typeof badgeText !== 'string') return null;
return (
<span
className={classNames(
`module-message__metadata__badge`,
`module-message__metadata__badge--${direction}`,
`module-message__metadata__badge--${badgeText.toLowerCase()}`,
`module-message__metadata__badge--${badgeText.toLowerCase()}--${direction}`
)}
key={badgeText}
>
&nbsp;&nbsp;{badgeText}
</span>
)
}).filter(i => !!i);
return (
<div
className={classNames(
@ -268,7 +276,7 @@ export class Message extends React.PureComponent<Props, State> {
module="module-message__metadata__date"
/>
)}
{badges}
{this.renderMetadataBadges()}
{expirationLength && expirationTimestamp ? (
<ExpireTimer
direction={direction}

Loading…
Cancel
Save