Skip to content

Simplify PgpPubkeyView.addContactHandler #4025

Description

@rrrooommmaaa

This method doesn't have to use Contact type. It can be simplified by calling ContactStore.update and collecting a unique list of emails.
Also refactor reRenderRecipient to accept only email parameter


from comment:
So here is the next question:
I have refactored function reRenderRecipientFor() to use newly introduced PubKeyInfo instead of Contact. It has 2 uses over code entire code. I've refactored one of them, but I absolutely don't get how to refactor the remaining one. It is used in a sort of hook:

// in extension/chrome/elements/compose-modules/compose-recipients-module.ts
    BrowserMsg.addListener('reRenderRecipient', async ({ contact }: Bm.ReRenderRecipient) => await this.reRenderRecipientFor(contact));

So how to refactor this one? Or maybe you can do it?
Accoriding to Git, This code was written by @limonte

UPDATE I think I have one idea, but I'm not sure it is correct. So something like this can be done:
Take email from contact, query ContactStore with it, then pass returned keys to the reRenderRecipientFor(). I will implement this, but what do you think? Is it right thing to do?

Originally posted by @IvanPizhenko in #3985 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions