-
-
-
-
-
-
-
-
+
+
+
+
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');
+ });
+ },
}
}