Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: minor bug fix #883

Merged
merged 1 commit into from
Nov 24, 2023
Merged

fix: minor bug fix #883

merged 1 commit into from
Nov 24, 2023

Conversation

mohammeds1992
Copy link
Collaborator

No description provided.

Copy link

File: packages/restapi/src/lib/pushapi/chat.ts

  1. In the decrypt function, there is a missing closing bracket after the await this.userInstance.info() line. Add a closing bracket before the async accept function.

Updated code:

async decrypt(messagePayloads: IMessageIPFS[]) {
  if (!this.signer) {
    throw new Error(PushAPI.ensureSignerMessage());
  }
  return await PUSH_CHAT.decryptConversation({
    pgpPrivateKey: this.decryptedPgpPvtKey,
    env: this.env,
    messages: messagePayloads,
    connectedUser: await this.userInstance.info(),
  });
} // Add a closing bracket here

async accept(target: string): Promise<string> {
  return await PUSH_CHAT.approve({
    senderAddress: target,
    account: this.account,
    signer: this.signer,
  });
}
  1. In the reject function, there is a missing closing bracket after the await PUSH_CHAT.reject({ line. Add a closing bracket before the block function.

Updated code:

async reject(target: string): Promise<void> {
  await PUSH_CHAT.reject({
    // Add a closing bracket here
  });
}

async block(users: Array<string>): Promise<IUser> {
  if (!this.signer || !this.decryptedPgpPvtKey) {
    const user = await PUSH_USER.get({
    // Rest of the code...
}
  1. In the block function, there is a missing closing bracket after the throw new Error('Invalid address in the users: ' + element); line. Add a closing bracket before the if (!user.profile.blockedUsersList) { line.

Updated code:

async block(users: Array<string>): Promise<IUser> {
  if (!this.signer || !this.decryptedPgpPvtKey) {
    const user = await PUSH_USER.get({
    for (const element of users) {
      if (!isValidETHAddress(element)) {
        throw new Error('Invalid address in the users: ' + element);
      }
    } // Add a closing bracket here

    if (!user.profile.blockedUsersList) {
      user.profile.blockedUsersList = [];
    }
    user.profile.blockedUsersList = [
      ...new Set([...user.profile.blockedUsersList, ...users]),
    ];
    return await PUSH_USER.profile.update({
      profile: {
        name: user.profile.name!,
        desc: user.profile.desc!,
        picture: user.profile.picture!,
        blockedUsersList: user.profile.blockedUsersList,
      },
      progressHook: this.progressHook,
    });
}
  1. In the unblock function, there is a missing closing bracket after the async unblock(users: Array<string>): Promise<IUser> { line. Add a closing bracket before the end of the file.

Updated code:

async unblock(users: Array<string>): Promise<IUser> {
  // Rest of the code...
}

@mohammeds1992 mohammeds1992 merged commit e5e7a45 into main Nov 24, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants