Browse Source

after copying personal data, add a message to copy contacts for them

Trent Larson 3 months ago
parent
commit
e9c5bd8e99
  1. 6
      src/views/ContactsView.vue
  2. 25
      src/views/ShareMyContactInfoView.vue
  3. 13
      test-playwright/40-add-contact.spec.ts

6
src/views/ContactsView.vue

@ -1128,8 +1128,8 @@ export default class ContactsView extends Vue {
this.contactsSelected.includes(c.did), this.contactsSelected.includes(c.did),
); );
const message = const message =
"To add contacts, paste this into the box on the 'People' screen.\n\n" + "To add contacts, paste this into the box on the 'Contacts' screen.\n\n" +
JSON.stringify(selectedContacts, null, 2); JSON.stringify(selectedContacts);
useClipboard() useClipboard()
.copy(message) .copy(message)
.then(() => { .then(() => {
@ -1138,7 +1138,7 @@ export default class ContactsView extends Vue {
group: "alert", group: "alert",
type: "info", type: "info",
title: "Copied", title: "Copied",
text: "Those contacts were copied to the clipboard. Have them paste it in the box on their 'People' screen.", text: "Those contacts were copied to the clipboard. Have them paste it in the box on their 'Contacts' screen.",
}, },
5000, 5000,
); );

25
src/views/ShareMyContactInfoView.vue

@ -30,10 +30,12 @@
Copy to Clipboard Copy to Clipboard
</button> </button>
</div> </div>
<div class="mt-8">Click to copy your info, then send it to them.</div> <div class="ml-12">
<div> <div class="mt-8">Click to copy your info, then send it to them.</div>
They will paste it in the input box on the Contacts <div>
<fa icon="users" /> screen. They will paste it in the input box on the Contacts
<fa icon="users" /> screen.
</div>
</div> </div>
</section> </section>
</template> </template>
@ -69,6 +71,8 @@ export default class ShareMyContactInfoView extends Vue {
const accounts = await accountsDB.accounts.toArray(); const accounts = await accountsDB.accounts.toArray();
const account = R.find((acc) => acc.did === activeDid, accounts); const account = R.find((acc) => acc.did === activeDid, accounts);
const numContacts = await db.contacts.count();
if (account) { if (account) {
const message = await generateEndorserJwtForAccount( const message = await generateEndorserJwtForAccount(
account, account,
@ -88,6 +92,19 @@ export default class ShareMyContactInfoView extends Vue {
}, },
5000, 5000,
); );
if (numContacts > 0) {
setTimeout(() => {
this.$notify(
{
group: "alert",
type: "success",
title: "Share Other Contacts",
text: "You may want to share some of your contacts with them. Select them below to copy and send.",
},
10000,
);
}, 3000);
}
}); });
(this.$router as Router).push({ name: "contacts" }); (this.$router as Router).push({ name: "contacts" });
} else { } else {

13
test-playwright/40-add-contact.spec.ts

@ -32,11 +32,10 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F, User #000'); await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x0000694B58C2cC69658993A90D3840C560f2F51F, User #000');
await page.locator('button > svg.fa-plus').click(); await page.locator('button > svg.fa-plus').click();
await expect(page.locator('div[role="alert"]')).toBeVisible(); await expect(page.locator('div[role="alert"]')).toBeVisible();
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss alert await page.locator('div[role="alert"] button:has-text("No")').click(); // don't register
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone await expect(page.locator('div[role="alert"] button > svg.fa-xmark')).toBeHidden(); // ensure alert is gone
await page.locator('div[role="alert"] button:has-text("Cancel")').click();
// Verify added contact // Verify added contact
await expect(page.locator('li.border-b')).toContainText('User #000'); await expect(page.locator('li.border-b')).toContainText('User #000');
@ -97,8 +96,8 @@ test('Add contact, copy details, delete, and import various ways', async ({ page
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39, User #111'); await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x111d15564f824D56C7a07b913aA7aDd03382aA39, User #111');
await page.locator('button > svg.fa-plus').click(); await page.locator('button > svg.fa-plus').click();
await expect(page.locator('div[role="alert"]')).toBeVisible(); await expect(page.locator('div[role="alert"]')).toBeVisible();
await page.locator('div[role="alert"] button:has-text("No")').click(); await page.locator('div[role="alert"] button:has-text("No")').click(); // don't register
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
// wait for the alert to disappear // wait for the alert to disappear
await expect(page.locator('div[role="alert"]')).toBeHidden(); await expect(page.locator('div[role="alert"]')).toBeHidden();
@ -106,8 +105,8 @@ test('Add contact, copy details, delete, and import various ways', async ({ page
await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x222BB77E6Ff3774d34c751f3c1260866357B677b, User #222, asdf1234'); await page.getByPlaceholder('URL or DID, Name, Public Key').fill('did:ethr:0x222BB77E6Ff3774d34c751f3c1260866357B677b, User #222, asdf1234');
await page.locator('button > svg.fa-plus').click(); await page.locator('button > svg.fa-plus').click();
await expect(page.locator('div[role="alert"]')).toBeVisible(); await expect(page.locator('div[role="alert"]')).toBeVisible();
await page.locator('div[role="alert"] button:has-text("No")').click(); await page.locator('div[role="alert"] button:has-text("No")').click(); // don't register
await page.locator('div[role="alert"] button > svg.fa-xmark').click(); await page.locator('div[role="alert"] button > svg.fa-xmark').click(); // dismiss info alert
await expect(page.locator('div[role="alert"]')).toBeHidden(); await expect(page.locator('div[role="alert"]')).toBeHidden();
await expect(page.getByTestId('contactListItem')).toHaveCount(2); await expect(page.getByTestId('contactListItem')).toHaveCount(2);

Loading…
Cancel
Save