Skip to content

Simplify PgpPubkeyView.addContactHandler #4025

@rrrooommmaaa

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)

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