From e253fe5573ea1f2c242a196503e1aab7dd1d44bd Mon Sep 17 00:00:00 2001 From: Matteo Bronkhorst <32799956+DrumsnChocolate@users.noreply.github.com> Date: Tue, 5 Sep 2023 23:16:21 +0200 Subject: [PATCH] Fix: do not copy own username if no completed response (#799) * exclude our own response that has not yet been completed * lint --- app/components/form/responses-table-card.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/components/form/responses-table-card.js b/app/components/form/responses-table-card.js index 28d63026c..2cf9777f4 100644 --- a/app/components/form/responses-table-card.js +++ b/app/components/form/responses-table-card.js @@ -1,13 +1,19 @@ import Component from '@ember/component'; +import { inject as service } from '@ember/service'; const FormResponsesTableCardComponent = Component.extend({ + session: service('session'), actions: { copyUsernames() { - const usernames = this.form + let usernames = this.form .get('responses') - .map((response) => response.get('user.username')) - .join('\n'); - + .map((response) => response.get('user.username')); + if (!this.form.currentUserResponseCompleted) { + usernames = usernames.filter( + (name) => name !== this.session.currentUser.username + ); + } + usernames = usernames.join('\n'); navigator.clipboard.writeText(usernames); }, },