drop typing message for public groups and fix opengroup sending

pull/1194/head
Audric Ackermann 5 years ago
parent b07b195102
commit cae608fd01
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -2292,8 +2292,8 @@
"groupNamePlaceholder": {
"message": "Group Name"
},
"inviteFriends": {
"message": "Invite Friends"
"inviteContacts": {
"message": "Invite Contacts"
},
"manageModerators": {
"message": "Manage Moderators"

@ -311,6 +311,10 @@
},
async bumpTyping() {
if (this.isPublic()) {
window.console.debug('public conversation... No need to bumpTyping');
return;
}
// We don't send typing messages if the setting is disabled or we do not have a session
// or we blocked that user
const devicePubkey = new libsession.Types.PubKey(this.id);
@ -1318,8 +1322,24 @@
options.messageType = message.get('type');
options.isPublic = this.isPublic();
if (options.isPublic) {
options.publicSendData = await this.getPublicSendData();
if (this.isPublic()) {
// FIXME audric add back attachments, quote, preview
const openGroup = {
server: this.get('server'),
channel: this.get('channelId'),
conversationId: this.id,
};
const openGroupParams = {
body,
timestamp: Date.now(),
group: openGroup,
};
const openGroupMessage = new libsession.Messages.Outgoing.OpenGroupMessage(
openGroupParams
);
await libsession.getMessageQueue().sendToGroup(openGroupMessage);
return null;
}
options.sessionRestoration = sessionRestoration;
@ -1383,6 +1403,8 @@
// let dest = destination;
// let numbers = groupNumbers;
if (this.isMediumGroup()) {
// FIXME audric to implement back
// dest = this.id;
// numbers = [destination];
// options.isMediumGroup = true;
@ -2077,6 +2099,13 @@
// conversation is viewed, another error message shows up for the contact
read = read.filter(item => !item.hasErrors);
if (this.isPublic()) {
window.console.debug(
'public conversation... No need to send read receipt'
);
return;
}
const devicePubkey = new libsession.Types.PubKey(this.id);
const hasSession = await libsession.Protocols.SessionProtocol.hasSession(
devicePubkey

@ -14,12 +14,15 @@ declare class LokiAppDotNetServerAPI {
}
export interface LokiPublicChannelAPI {
sendMessage(data: {
quote?: Quote;
attachments: Array<AttachmentPointer>;
preview: Array<Preview>;
body?: string;
}): Promise<boolean>;
sendMessage(
data: {
quote?: Quote;
attachments: Array<AttachmentPointer>;
preview: Array<Preview>;
body?: string;
},
timestamp: number
): Promise<boolean>;
}
export default LokiAppDotNetServerAPI;

@ -100,7 +100,7 @@ export async function sendToOpenGroup(
The only problem is that `channelAPI.sendMessage` returns true/false and doesn't throw any error so we can never be sure why sending failed.
This should be fixed and we shouldn't rely on returning true/false, rather return nothing (success) or throw an error (failure)
*/
const { group, quote, attachments, preview, body } = message;
const { group, quote, attachments, preview, body, timestamp } = message;
const channelAPI = await window.lokiPublicChatAPI.findOrCreateChannel(
group.server,
group.channel,
@ -108,12 +108,15 @@ export async function sendToOpenGroup(
);
// Don't think returning true/false on `sendMessage` is a good way
return channelAPI.sendMessage({
quote,
attachments: attachments || [],
preview,
body,
});
return channelAPI.sendMessage(
{
quote,
attachments: attachments || [],
preview,
body,
},
timestamp
);
// TODO: The below should be handled in whichever class calls this
/*

Loading…
Cancel
Save