Browse Source

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

pull/121/head^2
Trent Larson 3 months ago
parent
commit
e9c5bd8e99
  1. 6
      src/views/ContactsView.vue
  2. 17
      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),
);
const message =
"To add contacts, paste this into the box on the 'People' screen.\n\n" +
JSON.stringify(selectedContacts, null, 2);
"To add contacts, paste this into the box on the 'Contacts' screen.\n\n" +
JSON.stringify(selectedContacts);
useClipboard()
.copy(message)
.then(() => {
@ -1138,7 +1138,7 @@ export default class ContactsView extends Vue {
group: "alert",
type: "info",
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,
);

17
src/views/ShareMyContactInfoView.vue

@ -30,11 +30,13 @@
Copy to Clipboard
</button>
</div>
<div class="ml-12">
<div class="mt-8">Click to copy your info, then send it to them.</div>
<div>
They will paste it in the input box on the Contacts
<fa icon="users" /> screen.
</div>
</div>
</section>
</template>
@ -69,6 +71,8 @@ export default class ShareMyContactInfoView extends Vue {
const accounts = await accountsDB.accounts.toArray();
const account = R.find((acc) => acc.did === activeDid, accounts);
const numContacts = await db.contacts.count();
if (account) {
const message = await generateEndorserJwtForAccount(
account,
@ -88,6 +92,19 @@ export default class ShareMyContactInfoView extends Vue {
},
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" });
} 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.locator('button > svg.fa-plus').click();
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 page.locator('div[role="alert"] button:has-text("Cancel")').click();
// Verify added contact
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.locator('button > svg.fa-plus').click();
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 > svg.fa-xmark').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(); // dismiss info alert
// wait for the alert to disappear
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.locator('button > svg.fa-plus').click();
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 > svg.fa-xmark').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(); // dismiss info alert
await expect(page.locator('div[role="alert"]')).toBeHidden();
await expect(page.getByTestId('contactListItem')).toHaveCount(2);

Loading…
Cancel
Save