diff --git a/app/components/account-delete-modal.html b/app/components/account-delete-modal.html new file mode 100644 index 00000000..b79c60e7 --- /dev/null +++ b/app/components/account-delete-modal.html @@ -0,0 +1,115 @@ +
+ + + +
diff --git a/app/components/account-delete-modal.ts b/app/components/account-delete-modal.ts new file mode 100644 index 00000000..edafd676 --- /dev/null +++ b/app/components/account-delete-modal.ts @@ -0,0 +1,57 @@ +import {localStorageAvailable} from '../utils/local-storage'; + +export default function(app) { + app.component('accountDeleteModal', { + bindings: { + close: '&', + dismiss: '&', + }, + controller: class DocumentItemMetadataModalCtrl { + close: () => void; + + public deleteExternalIds = false; + public error: string; + public submitting = false; + public succeeded = false; + + static $inject = [ + '$http', '$location', '$scope', '$window', + 'authService', 'notificationService', 'peopleApi', + ]; + constructor( + public $http, public $location, public $scope, public $window, + public authService, public notificationService, public peopleApi, + ) {} + + 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; + + this.peopleApi.deleteAccount( + this.authService.user.id, + {deleteExternalIds: this.deleteExternalIds}, + ) + .then(() => { + this.succeeded = true; + this.authService.logout(); + if (localStorageAvailable) this.$window.localStorage.clear(); + this.notificationService.notifications.push({ + type: 'info', + message: 'Your account has been successfully deleted.', + }); + this.$location.url('/'); + return this.close(); + }) + .catch(error => this.error = error) + .finally(() => this.submitting = false); + } + }, + template: require('./account-delete-modal.html'), + }); +} 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 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); diff --git a/app/components/margin-cluster.html b/app/components/margin-cluster.html index 81fa14dd..cd82a1eb 100644 --- a/app/components/margin-cluster.html +++ b/app/components/margin-cluster.html @@ -34,23 +34,28 @@
-

- - {{$ctrl.cluster.discussions[0].author.displayName}} - · -

-
-
- -
-
-

+

+ Contribution has been deleted. Reason: {{$ctrl.cluster.discussions[0].deletedReason}}. +

+
diff --git a/app/components/margin-discussion.html b/app/components/margin-discussion.html index 4d284c62..0bfa29a0 100644 --- a/app/components/margin-discussion.html +++ b/app/components/margin-discussion.html @@ -32,20 +32,25 @@
-

- - {{$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}}. +

+
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. +

+ + +
+
+
+
+