Skip to content

Commit e253fe5

Browse files
Fix: do not copy own username if no completed response (#799)
* exclude our own response that has not yet been completed * lint
1 parent edc2fbc commit e253fe5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

app/components/form/responses-table-card.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import Component from '@ember/component';
2+
import { inject as service } from '@ember/service';
23

34
const FormResponsesTableCardComponent = Component.extend({
5+
session: service('session'),
46
actions: {
57
copyUsernames() {
6-
const usernames = this.form
8+
let usernames = this.form
79
.get('responses')
8-
.map((response) => response.get('user.username'))
9-
.join('\n');
10-
10+
.map((response) => response.get('user.username'));
11+
if (!this.form.currentUserResponseCompleted) {
12+
usernames = usernames.filter(
13+
(name) => name !== this.session.currentUser.username
14+
);
15+
}
16+
usernames = usernames.join('\n');
1117
navigator.clipboard.writeText(usernames);
1218
},
1319
},

0 commit comments

Comments
 (0)