Merge branch 'clearnet' into use-user-obj

pull/475/head
Ryan Tharp 6 years ago committed by GitHub
commit 3f35170eae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -398,6 +398,17 @@ class LokiPublicChannelAPI {
// get moderation actions
async pollForDeletions() {
try {
await this.pollOnceForDeletions();
} catch (e) {
log.warn(`Error while polling for public chat deletions: ${e}`);
}
setTimeout(() => {
this.pollForDeletions();
}, DELETION_POLL_EVERY);
}
async pollOnceForDeletions() {
// grab the last 200 deletions
const params = {
count: 200,
@ -435,15 +446,21 @@ class LokiPublicChannelAPI {
this.deleteLastId = res.response.meta.max_id;
({ more } = res.response);
}
// set up next poll
this.timers.delete = setTimeout(() => {
this.pollForDeletions();
}, PUBLICCHAT_DELETION_POLL_EVERY);
}
// get channel messages
async pollForMessages() {
try {
await this.pollOnceForMessages();
} catch (e) {
log.warn(`Error while polling for public chat messages: ${e}`);
}
setTimeout(() => {
this.pollForMessages();
}, GROUPCHAT_POLL_EVERY);
}
async pollOnceForMessages() {
const params = {
include_annotations: 1,
count: -20,
@ -469,7 +486,10 @@ class LokiPublicChannelAPI {
if (adnMessage.is_deleted) {
return;
}
if (adnMessage.annotations && adnMessage.annotations.length) {
if (
Array.isArray(adnMessage.annotations) &&
adnMessage.annotations.length !== 0
) {
const noteValue = adnMessage.annotations[0].value;
({ timestamp } = noteValue);
@ -532,10 +552,6 @@ class LokiPublicChannelAPI {
});
this.conversation.setLastRetrievedMessage(this.lastGot);
}
this.timers.message = setTimeout(() => {
this.pollForMessages();
}, PUBLICCHAT_MSG_POLL_EVERY);
}
// create a message in the channel

@ -56,18 +56,16 @@ export class MessageDetail extends React.Component<Props> {
public renderDeleteButton() {
const { i18n, message } = this.props;
return (
message.isDeletable ? (
<div className="module-message-detail__delete-button-container">
<button
onClick={message.onDelete}
className="module-message-detail__delete-button"
>
{i18n('deleteThisMessage')}
</button>
</div>
) : null
);
return message.isDeletable ? (
<div className="module-message-detail__delete-button-container">
<button
onClick={message.onDelete}
className="module-message-detail__delete-button"
>
{i18n('deleteThisMessage')}
</button>
</div>
) : null;
}
public renderContact(contact: Contact) {

Loading…
Cancel
Save