From 4f225b40550d0000fe5cae9a924be4a0d88e5e77 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 17 Apr 2020 16:38:05 -0600 Subject: [PATCH] Update remote post and profile components --- resources/assets/js/components/RemotePost.vue | 13 ++- .../assets/js/components/RemoteProfile.vue | 108 +++++++++++++++--- 2 files changed, 101 insertions(+), 20 deletions(-) diff --git a/resources/assets/js/components/RemotePost.vue b/resources/assets/js/components/RemotePost.vue index 4e039afa7..daba8bec1 100644 --- a/resources/assets/js/components/RemotePost.vue +++ b/resources/assets/js/components/RemotePost.vue @@ -170,7 +170,7 @@

- + {{reply.favourites_count == 1 ? '1 like' : reply.favourites_count + ' likes'}} Reply

@@ -205,7 +205,6 @@ -
@@ -1013,6 +1012,16 @@ export default { window.location.href = url; }, + purl(profile, showOrigin = false) { + if(profile.local == true) { + return profile.url; + } else { + return showOrigin ? + profile.url : + '/i/web/profile/_/' + profile.id; + } + } + }, } \ No newline at end of file diff --git a/resources/assets/js/components/RemoteProfile.vue b/resources/assets/js/components/RemoteProfile.vue index 8bca17c0d..6ca1ea1d5 100644 --- a/resources/assets/js/components/RemoteProfile.vue +++ b/resources/assets/js/components/RemoteProfile.vue @@ -11,7 +11,7 @@
-
+
@@ -34,7 +34,7 @@

{{profile.display_name}}

{{profile.acct}}

-

+

{{profile.statuses_count}} @@ -54,20 +54,7 @@

-
-
- - - -
-
-
- - - -
- -
+
@@ -75,6 +62,11 @@ {{profile.username}}
+
+ +
@@ -142,6 +134,25 @@
+ +
+
Report inappropriate
+
Unfollow
+
Follow
+
Go to post
+
Copy Link
+
Moderation Tools
+
Delete
+
Cancel
+
+
@@ -161,9 +172,11 @@ max_id: null, loading: true, owner: false, - layoutType: false, + layoutType: true, relationship: null, warning: false, + ctxMenuStatus: false, + ctxMenuRelationship: false, } }, @@ -361,7 +374,66 @@ reportProfile() { window.location.href = '/l/i/report?type=profile&id=' + this.profileId; this.$refs.visitorContextMenu.hide(); - } + }, + + ctxMenu(status) { + this.ctxMenuStatus = status; + let self = this; + axios.get('/api/pixelfed/v1/accounts/relationships', { + params: { + 'id[]': self.profileId + } + }).then(res => { + self.ctxMenuRelationship = res.data[0]; + self.$refs.ctxModal.show(); + }); + }, + + closeCtxMenu() { + this.ctxMenuStatus = false; + this.ctxMenuRelationship = false; + this.$refs.ctxModal.hide(); + }, + + ctxMenuCopyLink() { + let status = this.ctxMenuStatus; + navigator.clipboard.writeText(status.url); + this.closeCtxMenu(); + return; + }, + + ctxMenuGoToPost() { + let status = this.ctxMenuStatus; + window.location.href = this.statusUrl(status); + this.closeCtxMenu(); + return; + }, + + statusUrl(status) { + return '/i/web/post/_/' + this.profile.id + '/' + status.id; + }, + + deletePost(status) { + if(this.user.is_admin == false) { + return; + } + + if(window.confirm('Are you sure you want to delete this post?') == false) { + return; + } + + axios.post('/i/delete', { + type: 'status', + item: status.id + }).then(res => { + this.feed = this.feed.filter(s => { + return s.id != status.id; + }); + this.$refs.ctxModal.hide(); + }).catch(err => { + swal('Error', 'Something went wrong. Please try again later.', 'error'); + }); + }, } }