From cd51228a127d3223bb5bb69094a3fbac1a6b6634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gaul?= Date: Fri, 25 May 2018 00:35:53 +0200 Subject: [PATCH 01/11] components: add account-delete-modal --- app/components/account-delete-modal.html | 45 ++++++++++++++++++++++++ app/components/account-delete-modal.ts | 38 ++++++++++++++++++++ app/components/index.ts | 2 ++ 3 files changed, 85 insertions(+) create mode 100644 app/components/account-delete-modal.html create mode 100644 app/components/account-delete-modal.ts diff --git a/app/components/account-delete-modal.html b/app/components/account-delete-modal.html new file mode 100644 index 00000000..647444c3 --- /dev/null +++ b/app/components/account-delete-modal.html @@ -0,0 +1,45 @@ +
+ + + +
diff --git a/app/components/account-delete-modal.ts b/app/components/account-delete-modal.ts new file mode 100644 index 00000000..5c7e00c2 --- /dev/null +++ b/app/components/account-delete-modal.ts @@ -0,0 +1,38 @@ +export default function(app) { + app.component('accountDeleteModal', { + bindings: { + close: '&', + dismiss: '&', + }, + controller: class DocumentItemMetadataModalCtrl { + close: () => void; + + public error: string; + public submitting = false; + public succeeded = false; + + static $inject = ['$http', '$scope', 'authService', 'config']; + constructor(public $http, public $scope, public authService, public config) {} + + public hasError(field) { + const form = this.$scope.accountDeleteForm; + return form && (form.$submitted || form[field].$touched) && + form[field].$invalid; + } + + public submit() { + this.submitting = true; + this.succeeded = false; + // TODO: fix URL + this.$http.delete(this.config.apiUrl) + .then(() => { + this.succeeded = true; + return this.close(); + }) + .catch(error => this.error = error) + .finally(() => this.submitting = false); + } + }, + template: require('./account-delete-modal.html'), + }); +} diff --git a/app/components/index.ts b/app/components/index.ts index 7ca41194..592f0810 100644 --- a/app/components/index.ts +++ b/app/components/index.ts @@ -1,4 +1,5 @@ import about from './about'; +import accountDeleteModal from './account-delete-modal'; import activity from './activity'; import analyticsConsent from './analytics-consent'; import attribution from './attribution'; @@ -105,6 +106,7 @@ import userProfile from './user-profile'; export default function(app) { about(app); + accountDeleteModal(app); activity(app); analyticsConsent(app); attribution(app); From 336c1130e68edefb2bacbfd3fd95e070745cd70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gaul?= Date: Fri, 25 May 2018 00:36:11 +0200 Subject: [PATCH 02/11] components: open account-delete-modal in settings-profile --- app/components/settings-profile.html | 23 ++++++++++++++++++++++- app/components/settings-profile.ts | 15 +++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/app/components/settings-profile.html b/app/components/settings-profile.html index c9807df2..eedb85be 100644 --- a/app/components/settings-profile.html +++ b/app/components/settings-profile.html @@ -93,7 +93,7 @@ -
+
@@ -122,6 +122,27 @@

+
+
+
+
+

+ Delete account +

+

+ + Deleting your account is irreversible. +

+ + +
+
+
+
+
-

- - {{$ctrl.discussion.author.displayName}} - · +

+ Contribution has been deleted. Reason: {{$ctrl.discussion.deletedReason}}.

-
-
- -
-
-

+

+

+ + {{$ctrl.discussion.author.displayName}} + · +

+
+
-

- +
+
+

+ +

+ +
@@ -58,7 +63,7 @@ >
-
+
- +

+ Contribution has been deleted. Reason: {{$ctrl.reply.deletedReason}}. +

+
From 424c34eba06813044cbb272154ab4fea635677b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gaul?= Date: Thu, 14 Jun 2018 18:26:18 +0200 Subject: [PATCH 11/11] discussion: render deleted discussions/replies --- app/components/avatar-list.ts | 8 ++- app/components/comment.html | 66 +++++++++++----------- app/components/discussion-list.html | 15 ++--- app/components/discussion-thread-view.html | 16 ++++-- 4 files changed, 60 insertions(+), 45 deletions(-) diff --git a/app/components/avatar-list.ts b/app/components/avatar-list.ts index bff9238d..9854528d 100644 --- a/app/components/avatar-list.ts +++ b/app/components/avatar-list.ts @@ -10,9 +10,13 @@ export default function(app) { $scope.$watchCollection('$ctrl.discussion.replies', () => { if (!$ctrl.discussion) return; - $scope.participants = map($ctrl.discussion.replies, 'author'); + $scope.participants = $ctrl.discussion.replies + .filter(reply => !reply.deleted) + .map(reply => reply.author); // prepend original annotation author - $scope.participants.unshift($ctrl.discussion.author); + if (!$ctrl.discussion.deleted) { + $scope.participants.unshift($ctrl.discussion.author); + } // make list unique w.r.t. id $scope.participants = uniqBy($scope.participants, 'id'); diff --git a/app/components/comment.html b/app/components/comment.html index 0ab9bc25..bac01371 100644 --- a/app/components/comment.html +++ b/app/components/comment.html @@ -6,36 +6,41 @@
- - {{comment.author.displayName}} - commented - - - (edited ) - - - -
+
+ + {{comment.author.displayName}} + commented + + + (edited ) + + - - - + + + +
-
+
- - No description provided. - + >
diff --git a/app/components/discussion-list.html b/app/components/discussion-list.html index ed5e2ba4..11915896 100644 --- a/app/components/discussion-list.html +++ b/app/components/discussion-list.html @@ -22,7 +22,13 @@

- Deleted discussion + uib-tooltip="{{$ctrl.channelService.channelsById[discussion.channel].name}}" > -

- + opened by diff --git a/app/components/discussion-thread-view.html b/app/components/discussion-thread-view.html index e644bd31..148f3e1c 100644 --- a/app/components/discussion-thread-view.html +++ b/app/components/discussion-thread-view.html @@ -2,17 +2,25 @@

+ Deleted discussion

-
- {{$ctrl.discussion.author.displayName}} - opened this discussion - + + The first contribution to this discussion has been deleted (reason: {{$ctrl.discussion.deletedReason}}) + + + {{$ctrl.discussion.author.displayName}} + opened this discussion + + · {{$ctrl.discussion.replies.length}} reply