From 1d4f628cb9e0a908332c45fd126679914735c25c Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 06:38:55 +0200 Subject: [PATCH 01/20] add locales required for new link copy use case --- frontend/src/locales/de.json | 6 +++++- frontend/src/locales/en.json | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 6be44f30d..4db32e369 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -125,7 +125,9 @@ "gdd_per_link": { "choose-amount": "Wähle einen Betrag aus, welchen du per Link versenden möchtest. Du kannst auch noch eine Nachricht eintragen. Beim Klick „Jetzt generieren“ wird ein Link erstellt, den du versenden kannst.", "copy": "kopieren", + "copy-with-text": "Link und Text kopieren", "created": "Der Link wurde erstellt!", + "credit-your-gradido": "Um deine Gradido gutzuschreiben, klicke auf den Link!", "decay-14-day": "Vergänglichkeit für 14 Tage", "delete-the-link": "Den Link löschen?", "deleted": "Der Link wurde gelöscht!", @@ -134,6 +136,7 @@ "header": "Gradidos versenden per Link", "isFree": "Gradido ist weltweit kostenfrei.", "link-copied": "Link wurde in die Zwischenablage kopiert. Du kannst ihn jetzt in eine E-Mail oder Nachricht einfügen.", + "link-and-text-copied": "Der Link und deine Nachricht wurden in die Zwischenablage kopiert. Du kannst ihn jetzt in eine E-Mail oder Nachricht einfügen.", "link-deleted": "Der Link wurde am {date} gelöscht.", "link-expired": "Der Link ist nicht mehr gültig. Die Gültigkeit ist am {date} abgelaufen.", "link-overview": "Linkübersicht", @@ -149,7 +152,8 @@ "redeemed-title": "eingelöst", "to-login": "Log dich ein", "to-register": "Registriere ein neues Konto.", - "validUntil": "Gültig bis" + "validUntil": "Gültig bis", + "validUntilDate": "Sie sind bis zum {date} gültig." }, "gdt": { "calculation": "Berechnung der Gradido Transform", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 5a89bb7bb..db409ff54 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -125,7 +125,9 @@ "gdd_per_link": { "choose-amount": "Select an amount that you would like to send via link. You can also enter a message. Click 'Generate now' to create a link that you can share.", "copy": "copy", + "copy-with-text": "copy link and text", "created": "Link was created!", + "credit-your-gradido": "To credit your Gradido, click on the link!", "decay-14-day": "Decay for 14 days", "delete-the-link": "Delete the link?", "deleted": "The link was deleted!", @@ -134,6 +136,7 @@ "header": "Send Gradidos via link", "isFree": "Gradido is free of charge worldwide.", "link-copied": "Link has been copied to the clipboard. You can now paste it into an email or message.", + "link-and-text-copied": "The link and your message have been copied to the clipboard. You can now include it in an email or message.", "link-deleted": "The link was deleted on {date}.", "link-expired": "The link is no longer valid. The validity expired on {date}.", "link-overview": "Link overview", @@ -149,7 +152,8 @@ "redeemed-title": "redeemed", "to-login": "Log in", "to-register": "Register a new account.", - "validUntil": "Valid until" + "validUntil": "Valid until", + "validUntilDate": "They are valid until {date}." }, "gdt": { "calculation": "Calculation of Gradido Transform", From b7fb51887f6afc11f8fe3b935a110e8e3f2f6058 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 06:42:39 +0200 Subject: [PATCH 02/20] add dropdown item and method for new link copy use case --- .../TransactionLinks/TransactionLink.vue | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.vue b/frontend/src/components/TransactionLinks/TransactionLink.vue index c7b7682ec..be512abcb 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.vue +++ b/frontend/src/components/TransactionLinks/TransactionLink.vue @@ -22,6 +22,10 @@ {{ $t('gdd_per_link.copy') }} + + + {{ $t('gdd_per_link.copy-with-text') }} + { + this.$bvModal.show('modalPopoverCopyError' + this.id) + this.toastError(this.$t('gdd_per_link.not-copied')) + }) + }, deleteLink() { this.$bvModal.msgBoxConfirm(this.$t('gdd_per_link.delete-the-link')).then(async (value) => { if (value) From 92eb144faa3d04a52ed903248c969d8a07225628 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 07:27:46 +0200 Subject: [PATCH 03/20] fix linting --- .../TransactionLinks/TransactionLink.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.vue b/frontend/src/components/TransactionLinks/TransactionLink.vue index be512abcb..75c57a160 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.vue +++ b/frontend/src/components/TransactionLinks/TransactionLink.vue @@ -107,13 +107,17 @@ export default { navigator.clipboard .writeText( `${this.link}\n` + - `${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${this.amount} Gradido.\n` + - `\"${this.memo}\"\n` + - `${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t('gdd_per_link.validUntilDate', {date: this.$d(new Date(this.validUntil), 'short')})}` - ) - .then( + `${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${ + this.amount + } Gradido.\n` + + `"${this.memo}"\n` + + `${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t( + 'gdd_per_link.validUntilDate', { + date: this.$d(new Date(this.validUntil), 'short')}) + }`) + .then(() => { this.toastSuccess(this.$t('gdd_per_link.link-and-text-copied')) - ) + }) .catch(() => { this.$bvModal.show('modalPopoverCopyError' + this.id) this.toastError(this.$t('gdd_per_link.not-copied')) From 5019a7c48f0c6b9ce8c47fb29b9891c5633d4349 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 07:40:50 +0200 Subject: [PATCH 04/20] sort locales --- frontend/src/locales/de.json | 2 +- frontend/src/locales/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 4db32e369..2c97d71aa 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -135,8 +135,8 @@ "has-account": "Du besitzt bereits ein Gradido Konto?", "header": "Gradidos versenden per Link", "isFree": "Gradido ist weltweit kostenfrei.", - "link-copied": "Link wurde in die Zwischenablage kopiert. Du kannst ihn jetzt in eine E-Mail oder Nachricht einfügen.", "link-and-text-copied": "Der Link und deine Nachricht wurden in die Zwischenablage kopiert. Du kannst ihn jetzt in eine E-Mail oder Nachricht einfügen.", + "link-copied": "Link wurde in die Zwischenablage kopiert. Du kannst ihn jetzt in eine E-Mail oder Nachricht einfügen.", "link-deleted": "Der Link wurde am {date} gelöscht.", "link-expired": "Der Link ist nicht mehr gültig. Die Gültigkeit ist am {date} abgelaufen.", "link-overview": "Linkübersicht", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index db409ff54..163bbd091 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -135,8 +135,8 @@ "has-account": "You already have a Gradido account?", "header": "Send Gradidos via link", "isFree": "Gradido is free of charge worldwide.", - "link-copied": "Link has been copied to the clipboard. You can now paste it into an email or message.", "link-and-text-copied": "The link and your message have been copied to the clipboard. You can now include it in an email or message.", + "link-copied": "Link has been copied to the clipboard. You can now paste it into an email or message.", "link-deleted": "The link was deleted on {date}.", "link-expired": "The link is no longer valid. The validity expired on {date}.", "link-overview": "Link overview", From 20e2e0edea4993cfa633e4f29b6db0ff042b5a69 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 09:01:28 +0200 Subject: [PATCH 05/20] Update frontend/src/components/TransactionLinks/TransactionLink.vue Co-authored-by: Alexander Friedland --- .../TransactionLinks/TransactionLink.vue | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.vue b/frontend/src/components/TransactionLinks/TransactionLink.vue index 75c57a160..f0836aa2a 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.vue +++ b/frontend/src/components/TransactionLinks/TransactionLink.vue @@ -106,15 +106,15 @@ export default { copyLinkWithText() { navigator.clipboard .writeText( - `${this.link}\n` + - `${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${ - this.amount - } Gradido.\n` + - `"${this.memo}"\n` + - `${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t( - 'gdd_per_link.validUntilDate', { - date: this.$d(new Date(this.validUntil), 'short')}) - }`) + ``${this.link} + ${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${ + this.amount + }. Gradido + "${this.memo}" + ${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t( + 'gdd_per_link.validUntilDate', + { date: this.$d(new Date(this.validUntil), 'short') }, + )}`) .then(() => { this.toastSuccess(this.$t('gdd_per_link.link-and-text-copied')) }) From fe4a95e32de278ec45cd9626175f3d03ff6117e4 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 09:05:24 +0200 Subject: [PATCH 06/20] Update frontend/src/locales/de.json Co-authored-by: Alexander Friedland --- frontend/src/locales/de.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 2c97d71aa..dbe029082 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -127,7 +127,7 @@ "copy": "kopieren", "copy-with-text": "Link und Text kopieren", "created": "Der Link wurde erstellt!", - "credit-your-gradido": "Um deine Gradido gutzuschreiben, klicke auf den Link!", + "credit-your-gradido": "Damit die Gradido gutgeschrieben werden können, klicke auf den Link!", "decay-14-day": "Vergänglichkeit für 14 Tage", "delete-the-link": "Den Link löschen?", "deleted": "Der Link wurde gelöscht!", From b8ba6af90615a3af65aed906e53ffa333d7a9bba Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 09:05:59 +0200 Subject: [PATCH 07/20] Update frontend/src/components/TransactionLinks/TransactionLink.vue Co-authored-by: Alexander Friedland --- frontend/src/components/TransactionLinks/TransactionLink.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.vue b/frontend/src/components/TransactionLinks/TransactionLink.vue index f0836aa2a..1cebf697d 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.vue +++ b/frontend/src/components/TransactionLinks/TransactionLink.vue @@ -22,7 +22,7 @@ {{ $t('gdd_per_link.copy') }} - + {{ $t('gdd_per_link.copy-with-text') }} From 74a6c22f6faffb879097ccf076363e8a20bae90e Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 09:06:32 +0200 Subject: [PATCH 08/20] Update frontend/src/locales/de.json Co-authored-by: Alexander Friedland --- frontend/src/locales/de.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index dbe029082..62160ec9d 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -153,7 +153,7 @@ "to-login": "Log dich ein", "to-register": "Registriere ein neues Konto.", "validUntil": "Gültig bis", - "validUntilDate": "Sie sind bis zum {date} gültig." + "validUntilDate": "Der Link ist bis zum {date} gültig." }, "gdt": { "calculation": "Berechnung der Gradido Transform", From 38d9e276acd6b58386de4d9f0e3613c81dc9dd37 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 09:06:52 +0200 Subject: [PATCH 09/20] Update frontend/src/locales/en.json Co-authored-by: Alexander Friedland --- frontend/src/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 163bbd091..36a695e86 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -153,7 +153,7 @@ "to-login": "Log in", "to-register": "Register a new account.", "validUntil": "Valid until", - "validUntilDate": "They are valid until {date}." + "validUntilDate": "The link is valid until {date}." }, "gdt": { "calculation": "Calculation of Gradido Transform", From 6c856c8a92898d5e34c7f4df93b9d250c8ea2fc4 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 09:12:37 +0200 Subject: [PATCH 10/20] Update frontend/src/locales/en.json Co-authored-by: Alexander Friedland --- frontend/src/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 36a695e86..735ae28bd 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -127,7 +127,7 @@ "copy": "copy", "copy-with-text": "copy link and text", "created": "Link was created!", - "credit-your-gradido": "To credit your Gradido, click on the link!", + "credit-your-gradido": "For the Gradido to be credited, click on the link!", "decay-14-day": "Decay for 14 days", "delete-the-link": "Delete the link?", "deleted": "The link was deleted!", From e8b70608e90e52eb619db4756595cbc1ff82d114 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 5 Jul 2022 09:34:32 +0200 Subject: [PATCH 11/20] double apostrophe removed, fix yarn lint --- .../TransactionLinks/TransactionLink.vue | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.vue b/frontend/src/components/TransactionLinks/TransactionLink.vue index 1cebf697d..1476c3be6 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.vue +++ b/frontend/src/components/TransactionLinks/TransactionLink.vue @@ -22,7 +22,11 @@ {{ $t('gdd_per_link.copy') }} - + {{ $t('gdd_per_link.copy-with-text') }} @@ -106,7 +110,7 @@ export default { copyLinkWithText() { navigator.clipboard .writeText( - ``${this.link} + `${this.link} ${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${ this.amount }. Gradido @@ -114,11 +118,12 @@ export default { ${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t( 'gdd_per_link.validUntilDate', { date: this.$d(new Date(this.validUntil), 'short') }, - )}`) - .then(() => { - this.toastSuccess(this.$t('gdd_per_link.link-and-text-copied')) - }) - .catch(() => { + )}`, + ) + .then(() => { + this.toastSuccess(this.$t('gdd_per_link.link-and-text-copied')) + }) + .catch(() => { this.$bvModal.show('modalPopoverCopyError' + this.id) this.toastError(this.$t('gdd_per_link.not-copied')) }) From 4274974207a4c61640be98414e1d3edf3d8d60a2 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 10:36:44 +0200 Subject: [PATCH 12/20] reformat string to avoid unwanted indents --- .../components/TransactionLinks/TransactionLink.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.vue b/frontend/src/components/TransactionLinks/TransactionLink.vue index 1476c3be6..b9256331e 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.vue +++ b/frontend/src/components/TransactionLinks/TransactionLink.vue @@ -110,12 +110,12 @@ export default { copyLinkWithText() { navigator.clipboard .writeText( - `${this.link} - ${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${ + `${this.link}\n` + + `${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${ this.amount - }. Gradido - "${this.memo}" - ${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t( + } Gradido.\n` + + `"${this.memo}"\n`+ + `${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t( 'gdd_per_link.validUntilDate', { date: this.$d(new Date(this.validUntil), 'short') }, )}`, From a61df84a398728995bb3315cc786d7d3add8cada Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 10:37:17 +0200 Subject: [PATCH 13/20] add unit tests for new feature --- .../TransactionLinks/TransactionLink.spec.js | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.spec.js b/frontend/src/components/TransactionLinks/TransactionLink.spec.js index 13aaea900..2f9c91337 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.spec.js +++ b/frontend/src/components/TransactionLinks/TransactionLink.spec.js @@ -25,6 +25,7 @@ const propsData = { link: 'http://localhost/redeem/c00000000c000000c0000', holdAvailableAmount: '5.13109484759482747111', id: 12, + firstname: 'Testy' memo: 'Katzenauge, Eulenschrei, was verschwunden komm herbei!', validUntil: '2022-03-30T14:22:40.000Z', } @@ -77,7 +78,7 @@ describe('TransactionLink', () => { navigator.clipboard = navigatorClipboard }) - describe('copy with success', () => { + describe('copy link with success', () => { beforeEach(async () => { navigatorClipboardMock.mockResolvedValue() await wrapper.find('.test-copy-link .dropdown-item').trigger('click') @@ -93,7 +94,26 @@ describe('TransactionLink', () => { }) }) - describe('copy with error', () => { + describe('copy link and text with success', () => { + beforeEach(async () => { + navigatorClipboardMock.mockResolvedValue() + await wrapper.find('.test-copy-text .dropdown-item').trigger('click') + }) + + it('should call clipboard.writeText', () => { + expect(navigator.clipboard.writeText).toHaveBeenCalledWith( + `http://localhost/redeem/c00000000c000000c0000\n + Testy wants to send you 75 Gradido.\n + "Katzenauge, Eulenschrei, was verschwunden komm herbei!"\n + For the Gradido to be credited, click on the link! The link is valid until 3/30/2022.`, + ) + }) + it('toasts success message', () => { + expect(toastSuccessSpy).toBeCalledWith('gdd_per_link.link-copied') + }) + }) + + describe('copy link with error', () => { beforeEach(async () => { navigatorClipboardMock.mockRejectedValue() await wrapper.find('.test-copy-link .dropdown-item').trigger('click') @@ -103,6 +123,17 @@ describe('TransactionLink', () => { expect(toastErrorSpy).toBeCalledWith('gdd_per_link.not-copied') }) }) + + describe('copy link and text with error', () => { + beforeEach(async () => { + navigatorClipboardMock.mockRejectedValue() + await wrapper.find('.test-copy-text .dropdown-item').trigger('click') + }) + + it('toasts an error', () => { + expect(toastErrorSpy).toBeCalledWith('gdd_per_link.not-copied') + }) + }) }) describe('qr code modal', () => { From 45e7fecd3979774c2c19a02e03217a4ece328838 Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 10:47:16 +0200 Subject: [PATCH 14/20] fix unit test --- .../src/components/TransactionLinks/TransactionLink.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.spec.js b/frontend/src/components/TransactionLinks/TransactionLink.spec.js index 2f9c91337..d0abe462d 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.spec.js +++ b/frontend/src/components/TransactionLinks/TransactionLink.spec.js @@ -25,7 +25,7 @@ const propsData = { link: 'http://localhost/redeem/c00000000c000000c0000', holdAvailableAmount: '5.13109484759482747111', id: 12, - firstname: 'Testy' + firstname: 'Testy', memo: 'Katzenauge, Eulenschrei, was verschwunden komm herbei!', validUntil: '2022-03-30T14:22:40.000Z', } From 794bcbdfa37e831c4872ed4bc0e6e9088f33623e Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 11:20:48 +0200 Subject: [PATCH 15/20] update unit test --- .../TransactionLinks/TransactionLink.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.spec.js b/frontend/src/components/TransactionLinks/TransactionLink.spec.js index d0abe462d..469a8377e 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.spec.js +++ b/frontend/src/components/TransactionLinks/TransactionLink.spec.js @@ -102,14 +102,14 @@ describe('TransactionLink', () => { it('should call clipboard.writeText', () => { expect(navigator.clipboard.writeText).toHaveBeenCalledWith( - `http://localhost/redeem/c00000000c000000c0000\n - Testy wants to send you 75 Gradido.\n - "Katzenauge, Eulenschrei, was verschwunden komm herbei!"\n - For the Gradido to be credited, click on the link! The link is valid until 3/30/2022.`, + 'http://localhost/redeem/c00000000c000000c0000\n' + + 'Testy wants to send you 75 Gradido.\n' + + '"Katzenauge, Eulenschrei, was verschwunden komm herbei!"\n' + + 'For the Gradido to be credited, click on the link! The link is valid until 3/30/2022.', ) }) it('toasts success message', () => { - expect(toastSuccessSpy).toBeCalledWith('gdd_per_link.link-copied') + expect(toastSuccessSpy).toBeCalledWith('gdd_per_link.link-and-text-copied') }) }) From 7d9253e4c7ae00ea058660ba8f6be277437db68e Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 11:49:52 +0200 Subject: [PATCH 16/20] Update frontend/src/components/TransactionLinks/TransactionLink.vue Co-authored-by: Moriz Wahl --- .../components/TransactionLinks/TransactionLink.vue | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.vue b/frontend/src/components/TransactionLinks/TransactionLink.vue index b9256331e..b7dc03db5 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.vue +++ b/frontend/src/components/TransactionLinks/TransactionLink.vue @@ -110,15 +110,10 @@ export default { copyLinkWithText() { navigator.clipboard .writeText( - `${this.link}\n` + - `${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${ - this.amount - } Gradido.\n` + - `"${this.memo}"\n`+ - `${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t( - 'gdd_per_link.validUntilDate', - { date: this.$d(new Date(this.validUntil), 'short') }, - )}`, + `${this.link}\n +${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${this.amount} Gradido. +"${this.memo}" +${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t('gdd_per_link.validUntilDate', { date: this.$d(new Date(this.validUntil), 'short') })}`, ) .then(() => { this.toastSuccess(this.$t('gdd_per_link.link-and-text-copied')) From ca8732bd750317fe853c29a5530f89d58d6c42ff Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 11:50:52 +0200 Subject: [PATCH 17/20] Update frontend/src/locales/en.json Co-authored-by: Moriz Wahl --- frontend/src/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 735ae28bd..088a006a7 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -125,7 +125,7 @@ "gdd_per_link": { "choose-amount": "Select an amount that you would like to send via link. You can also enter a message. Click 'Generate now' to create a link that you can share.", "copy": "copy", - "copy-with-text": "copy link and text", + "copy-with-text": "Copy link and text", "created": "Link was created!", "credit-your-gradido": "For the Gradido to be credited, click on the link!", "decay-14-day": "Decay for 14 days", From a9a518c9bbbe2fe882f8f87f48085227d3d5d48d Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 5 Jul 2022 11:59:32 +0200 Subject: [PATCH 18/20] fix linting errors --- frontend/src/components/TransactionLinks/TransactionLink.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.vue b/frontend/src/components/TransactionLinks/TransactionLink.vue index b7dc03db5..d5491835c 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.vue +++ b/frontend/src/components/TransactionLinks/TransactionLink.vue @@ -113,7 +113,9 @@ export default { `${this.link}\n ${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${this.amount} Gradido. "${this.memo}" -${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t('gdd_per_link.validUntilDate', { date: this.$d(new Date(this.validUntil), 'short') })}`, +${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t('gdd_per_link.validUntilDate', { + date: this.$d(new Date(this.validUntil), 'short'), + })}`, ) .then(() => { this.toastSuccess(this.$t('gdd_per_link.link-and-text-copied')) From e4a4744f4e4be78367ed5128410709be95ad1ef0 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 5 Jul 2022 12:30:46 +0200 Subject: [PATCH 19/20] fix unit tests --- .../TransactionLinks/TransactionLink.spec.js | 15 ++++++++------- .../TransactionLinks/TransactionLink.vue | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.spec.js b/frontend/src/components/TransactionLinks/TransactionLink.spec.js index 469a8377e..50f1588d7 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.spec.js +++ b/frontend/src/components/TransactionLinks/TransactionLink.spec.js @@ -9,15 +9,16 @@ const mockAPIcall = jest.fn() const navigatorClipboardMock = jest.fn() const mocks = { - $i18n: { - locale: 'en', - }, $t: jest.fn((t) => t), $d: jest.fn((d) => d), - $tc: jest.fn((tc) => tc), $apollo: { mutate: mockAPIcall, }, + $store: { + state: { + firstName: 'Testy', + }, + }, } const propsData = { @@ -103,9 +104,9 @@ describe('TransactionLink', () => { it('should call clipboard.writeText', () => { expect(navigator.clipboard.writeText).toHaveBeenCalledWith( 'http://localhost/redeem/c00000000c000000c0000\n' + - 'Testy wants to send you 75 Gradido.\n' + - '"Katzenauge, Eulenschrei, was verschwunden komm herbei!"\n' + - 'For the Gradido to be credited, click on the link! The link is valid until 3/30/2022.', + 'Testy transaction-link.send_you 75 Gradido.\n' + + '"Katzenauge, Eulenschrei, was verschwunden komm herbei!"\n' + + 'gdd_per_link.credit-your-gradido gdd_per_link.validUntilDate', ) }) it('toasts success message', () => { diff --git a/frontend/src/components/TransactionLinks/TransactionLink.vue b/frontend/src/components/TransactionLinks/TransactionLink.vue index d5491835c..5618c8696 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.vue +++ b/frontend/src/components/TransactionLinks/TransactionLink.vue @@ -110,7 +110,7 @@ export default { copyLinkWithText() { navigator.clipboard .writeText( - `${this.link}\n + `${this.link} ${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${this.amount} Gradido. "${this.memo}" ${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t('gdd_per_link.validUntilDate', { From 9272ca87cd92218e694eea032cef1d24b18c9375 Mon Sep 17 00:00:00 2001 From: mahula Date: Wed, 6 Jul 2022 11:39:59 +0200 Subject: [PATCH 20/20] fix unit test --- frontend/src/components/TransactionLinks/TransactionLink.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.spec.js b/frontend/src/components/TransactionLinks/TransactionLink.spec.js index 50f1588d7..d06f0f726 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.spec.js +++ b/frontend/src/components/TransactionLinks/TransactionLink.spec.js @@ -26,7 +26,6 @@ const propsData = { link: 'http://localhost/redeem/c00000000c000000c0000', holdAvailableAmount: '5.13109484759482747111', id: 12, - firstname: 'Testy', memo: 'Katzenauge, Eulenschrei, was verschwunden komm herbei!', validUntil: '2022-03-30T14:22:40.000Z', }