removing pubkey from message request response.
This commit is contained in:
parent
f93a2e5fad
commit
8a8a5ca82c
|
@ -37,9 +37,7 @@ message Unsend {
|
|||
|
||||
message MessageRequestResponse {
|
||||
// @required
|
||||
required bytes publicKey = 1; // The public key of the contact that was approved
|
||||
// @required
|
||||
required bool isApproved = 2;
|
||||
required bool isApproved = 1;
|
||||
}
|
||||
|
||||
message Content {
|
||||
|
|
|
@ -656,6 +656,13 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
|
|||
// void forceSyncConfigurationNowIfNeeded();
|
||||
}
|
||||
|
||||
// TODO: remove once dev-tested
|
||||
// if (chatMessageParams.body?.includes('unapprove')) {
|
||||
// await this.setIsApproved(false);
|
||||
// await this.setDidApproveMe(false);
|
||||
// // void forceSyncConfigurationNowIfNeeded();
|
||||
// }
|
||||
|
||||
if (this.isOpenGroupV2()) {
|
||||
const chatMessageOpenGroupV2 = new OpenGroupVisibleMessage(chatMessageParams);
|
||||
const roomInfos = this.toOpenGroupV2();
|
||||
|
@ -1198,7 +1205,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
|
|||
}
|
||||
}
|
||||
|
||||
public async setIsApproved(value: boolean, commit: boolean = true) {
|
||||
public async setIsApproved(value: boolean, shouldCommit: boolean = true) {
|
||||
if (value !== this.isApproved()) {
|
||||
window?.log?.info(`Setting ${this.attributes.profileName} isApproved to:: ${value}`);
|
||||
this.set({
|
||||
|
@ -1211,18 +1218,22 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
|
|||
void forceSyncConfigurationNowIfNeeded();
|
||||
}
|
||||
|
||||
await this.commit();
|
||||
if (shouldCommit) {
|
||||
await this.commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async setDidApproveMe(value: boolean, commit: boolean = false) {
|
||||
public async setDidApproveMe(value: boolean, shouldCommit: boolean = true) {
|
||||
if (value !== this.didApproveMe()) {
|
||||
window?.log?.info(`Setting ${this.attributes.profileName} didApproveMe to:: ${value}`);
|
||||
this.set({
|
||||
didApproveMe: value,
|
||||
});
|
||||
|
||||
await this.commit();
|
||||
if (shouldCommit) {
|
||||
await this.commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ export type PropsForMessageRequestResponse = MessageRequestResponseMsg & {
|
|||
receivedAt?: number;
|
||||
isUnread: boolean;
|
||||
isApproved?: boolean;
|
||||
publicKey?: string;
|
||||
source?: string;
|
||||
};
|
||||
|
||||
|
@ -196,7 +195,6 @@ export interface MessageAttributesOptionals {
|
|||
messageRequestResponse?: {
|
||||
/** 1 means approved, 0 means unapproved. */
|
||||
isApproved?: number;
|
||||
publicKey?: string;
|
||||
};
|
||||
unread?: number;
|
||||
group?: any;
|
||||
|
|
|
@ -158,7 +158,6 @@ const handleContactReceived = async (
|
|||
received_at: Date.now(),
|
||||
messageRequestResponse: {
|
||||
isApproved: 1,
|
||||
publicKey: UserUtils.getOurPubKeyStrFromCache(), // it's a sync therefore the pubkey would be ours
|
||||
},
|
||||
unread: 1, // 1 means unread
|
||||
expireTimer: 0,
|
||||
|
|
|
@ -531,7 +531,7 @@ async function handleMessageRequestResponse(
|
|||
envelope: EnvelopePlus,
|
||||
messageRequestResponse: SignalService.MessageRequestResponse
|
||||
) {
|
||||
const { isApproved, publicKey } = messageRequestResponse;
|
||||
const { isApproved } = messageRequestResponse;
|
||||
|
||||
if (!messageRequestResponse) {
|
||||
window?.log?.error('handleMessageRequestResponse: Invalid parameters -- dropping message.');
|
||||
|
@ -539,7 +539,7 @@ async function handleMessageRequestResponse(
|
|||
return;
|
||||
}
|
||||
|
||||
const convoId = toHex(publicKey);
|
||||
const convoId = envelope.source;
|
||||
|
||||
// TODO: commenting out, including in one larger function for now
|
||||
// await updateConversationDidApproveMe(toHex(publicKey), isApproved);
|
||||
|
@ -566,7 +566,6 @@ async function handleMessageRequestResponse(
|
|||
received_at: Date.now(),
|
||||
messageRequestResponse: {
|
||||
isApproved: 1,
|
||||
publicKey: convoId,
|
||||
},
|
||||
unread: 1, // 1 means unread
|
||||
expireTimer: 0,
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
import { SignalService } from '../../../../protobuf';
|
||||
import { fromHexToArray } from '../../../utils/String';
|
||||
import { ContentMessage } from '../ContentMessage';
|
||||
import { MessageParams } from '../Message';
|
||||
|
||||
interface MessageRequestResponseParams extends MessageParams {
|
||||
publicKey: string;
|
||||
isApproved: boolean;
|
||||
}
|
||||
|
||||
export class MessageRequestResponse extends ContentMessage {
|
||||
private readonly publicKey: Uint8Array;
|
||||
private readonly isApproved: boolean;
|
||||
|
||||
constructor(params: MessageRequestResponseParams) {
|
||||
super({
|
||||
timestamp: params.timestamp,
|
||||
publicKey: params.publicKey,
|
||||
isApproved: params.isApproved,
|
||||
} as MessageRequestResponseParams);
|
||||
this.publicKey = fromHexToArray(params.publicKey);
|
||||
this.isApproved = params.isApproved;
|
||||
}
|
||||
|
||||
|
@ -30,7 +25,6 @@ export class MessageRequestResponse extends ContentMessage {
|
|||
|
||||
public messageRequestResponseProto(): SignalService.MessageRequestResponse {
|
||||
return new SignalService.MessageRequestResponse({
|
||||
publicKey: this.publicKey,
|
||||
isApproved: this.isApproved,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue