diff --git a/components/ContentMenu.vue b/components/ContentMenu.vue
index 5eb1647fb..48dbd025a 100644
--- a/components/ContentMenu.vue
+++ b/components/ContentMenu.vue
@@ -54,7 +54,7 @@ export default {
placement: { type: String, default: 'top-end' },
itemId: { type: String, required: true },
name: { type: String, required: true },
- isAuthor: { type: Boolean, default: false },
+ isOwner: { type: Boolean, default: false },
context: {
type: String,
required: true,
@@ -67,16 +67,15 @@ export default {
routes() {
let routes = []
- if (this.isAuthor && this.context === 'contribution') {
- const link = this.$router.resolve({
- name: 'post-edit-id',
- params: {
- id: this.itemId
- }
- }).href
+ if (this.isOwner && this.context === 'contribution') {
+ // const link = this.$router.resolve({
+ // name: 'post-edit-id',
+ // params: {
+ // id: this.itemId
+ // }
+ // }).href
routes.push({
name: this.$t(`contribution.edit`),
- path: link,
callback: () => {
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
return this.$router.push('/post/edit/p1')
@@ -85,8 +84,17 @@ export default {
icon: 'edit'
})
}
+ if (this.isOwner && this.context === 'comment') {
+ routes.push({
+ name: this.$t(`comment.edit`),
+ callback: () => {
+ console.log('EDIT COMMENT')
+ },
+ icon: 'edit'
+ })
+ }
- if (!this.isAuthor) {
+ if (!this.isOwner) {
routes.push({
name: this.$t(`report.${this.context}.title`),
callback: this.openReportDialog,
@@ -94,13 +102,22 @@ export default {
})
}
- if (this.isModerator) {
+ if (!this.isOwner && this.isModerator) {
routes.push({
name: this.$t(`disable.${this.context}.title`),
callback: () => {},
icon: 'eye-slash'
})
}
+
+ if (this.isOwner && this.context === 'user') {
+ routes.push({
+ name: this.$t(`settings.data.name`),
+ // eslint-disable-next-line vue/no-side-effects-in-computed-properties
+ callback: () => this.$router.push('/settings'),
+ icon: 'edit'
+ })
+ }
return routes
},
isModerator() {
diff --git a/components/PostCard.vue b/components/PostCard.vue
index 25b410257..d2bd19012 100644
--- a/components/PostCard.vue
+++ b/components/PostCard.vue
@@ -55,6 +55,7 @@
context="contribution"
:item-id="post.id"
:name="post.title"
+ :is-owner="isAuthor"
/>
@@ -93,6 +94,9 @@ export default {
}
return excerpt
+ },
+ isAuthor() {
+ return this.$store.getters['auth/user'].id === this.post.author.id
}
},
methods: {
diff --git a/locales/de.json b/locales/de.json
index 82fecfcc2..6d0843cb5 100644
--- a/locales/de.json
+++ b/locales/de.json
@@ -104,6 +104,10 @@
"edit": "Beitrag bearbeiten",
"delete": "Beitrag löschen"
},
+ "comment": {
+ "edit": "Kommentar bearbeiten",
+ "delete": "Kommentar löschen"
+ },
"disable": {
"user": {
"title": "Nutzer sperren",
diff --git a/locales/en.json b/locales/en.json
index 72e3f3380..8663ae800 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -104,6 +104,10 @@
"edit": "Edit Contribution",
"delete": "Delete Contribution"
},
+ "comment": {
+ "edit": "Edit Comment",
+ "delete": "Delete Comment"
+ },
"disable": {
"user": {
"title": "Disable User",
diff --git a/pages/post/_slug/index.vue b/pages/post/_slug/index.vue
index 34bfce077..68655a31f 100644
--- a/pages/post/_slug/index.vue
+++ b/pages/post/_slug/index.vue
@@ -12,7 +12,7 @@
context="contribution"
:item-id="post.id"
:name="post.title"
- :is-author="isAuthor"
+ :is-owner="isAuthor(post.author.id)"
/>
@@ -98,6 +98,7 @@
style="float-right"
:item-id="comment.id"
:name="comment.author.name"
+ :is-owner="isAuthor(comment.author.id)"
/>
@@ -155,17 +156,17 @@ export default {
title: 'loading'
}
},
- computed: {
- isAuthor() {
- return this.$store.getters['auth/user'].id === this.post.author.id
- }
- },
watch: {
Post(post) {
this.post = post[0]
this.title = this.post.title
}
},
+ methods: {
+ isAuthor(id) {
+ return this.$store.getters['auth/user'].id === id
+ }
+ },
apollo: {
Post: {
query() {
diff --git a/pages/post/_slug/more-info.vue b/pages/post/_slug/more-info.vue
index 05135b891..9dd6a2143 100644
--- a/pages/post/_slug/more-info.vue
+++ b/pages/post/_slug/more-info.vue
@@ -70,7 +70,7 @@ export default {
},
computed: {
post() {
- return this.Post ? this.Post[0] : {}
+ return this.Post ? this.Post[0] || {} : {}
}
},
apollo: {
diff --git a/pages/profile/_slug.vue b/pages/profile/_slug.vue
index ad99402c7..8bee37185 100644
--- a/pages/profile/_slug.vue
+++ b/pages/profile/_slug.vue
@@ -23,6 +23,7 @@
context="user"
:item-id="user.id"
:name="user.name"
+ :is-owner="myProfile"
/>