Merge pull request #6259 from Ocelot-Social-Community/default-categories-of-group

feat(webapp): default categories of group for posts in group
This commit is contained in:
Hannes Heine 2023-04-25 22:11:52 +02:00 committed by GitHub
commit 58b59051ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -43,6 +43,14 @@ export default {
selectedCategoryIds: this.existingCategoryIds,
}
},
watch: {
existingCategoryIds() {
if (!this.selectedCategoryIds.length && this.existingCategoryIds.length) {
this.selectedCategoryIds = this.existingCategoryIds
this.$forceUpdate()
}
},
},
computed: {
selectedCount() {
return this.selectedCategoryIds.length

View File

@ -177,6 +177,15 @@ export default {
groupName() {
return this.group && this.group.name
},
groupCategories() {
return this.group && this.group.categories
},
},
watch: {
groupCategories() {
if (!this.formData.categoryIds.length && this.groupCategories)
this.formData.categoryIds = this.groupCategories.map((cat) => cat.id)
},
},
methods: {
submit() {