Skip to content

Commit

Permalink
feat: Allow space member to schedule post - EXO-75098 - Meeds-io/MIPs…
Browse files Browse the repository at this point in the history
…#161  (#1194)

Allow space member to schedule post
  • Loading branch information
hakermi authored and azayati committed Oct 31, 2024
1 parent 0e96136 commit a8a559a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
</div>
</div>
<note-publish-option
v-if="allowedTargets?.length"
v-if="publishAllowed"
:allowed-targets="allowedTargets"
:is-publishing="isPublishing"
:edit-mode="editMode"
Expand Down Expand Up @@ -231,11 +231,14 @@ export default {
}
},
computed: {
publishAllowed() {
return this.canPublish && this.allowedTargets?.length;
},
scheduleAllowed() {
return !this.editMode || (this.publicationSettings?.publish || !!this.noteObject?.schedulePostDate);
return this.canSchedule && (!this.editMode || (this.publicationSettings?.publish || !!this.noteObject?.schedulePostDate));
},
saveEnabled() {
return (!this.editMode || this.publicationSettingsUpdated) && this.validPublishSettings;
return (!this.editMode || this.publicationSettingsUpdated) && (this.canPublish && this.validPublishSettings || true);
},
validPublishSettings() {
return !this.publicationSettings?.publish || (this.publicationSettings?.publish && this.publicationSettings?.selectedTargets?.length);
Expand All @@ -260,6 +263,12 @@ export default {
allowedTargets() {
return this.params?.allowedTargets;
},
canPublish() {
return this.params?.canPublish;
},
canSchedule() {
return this.params?.canSchedule;
},
isUnpublishScheduled() {
return this.scheduleSettings?.schedule && !this.scheduleSettings?.postDate;
},
Expand Down Expand Up @@ -288,9 +297,11 @@ export default {
this.publicationSettings.selectedAudience = settings?.selectedAudience;
},
updatedScheduleSettings(settings) {
console.log(settings);
this.scheduleSettings = structuredClone(settings);
this.publicationSettings.scheduleSettings = this.scheduleSettings;
if (!this.canPublish) {
this.updatedPublicationSettings(this.publicationSettings);
}
},
propertiesUpdated(properties) {
if (!this.noteObject?.properties || !Object.keys(this.noteObject?.properties).length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
:label="cancelOption.label"
:value="cancelOption.value" />
<v-tooltip
v-if="canPublish"
:disabled="!isMultipleSelectionOption"
bottom>
<template #activator="{ on, attrs }">
Expand Down Expand Up @@ -252,6 +253,10 @@ export default {
editMode: {
type: Boolean,
default: false
},
canPublish: {
type: Boolean,
default: false
}
},
watch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
:note="noteObject"
:has-featured-image="hasFeaturedImage" />
<note-publication-drawer
v-if="canPublish"
v-if="publicationParams"
ref="editorPublicationDrawer"
:has-featured-image="hasFeaturedImage"
:is-publishing="isPublishing"
Expand Down Expand Up @@ -250,9 +250,6 @@ export default {
}
},
computed: {
canPublish() {
return this.publicationParams?.canPublish;
},
newEmptyTranslation() {
return !!this.note?.lang && !this.note?.title?.length && !this.note?.content?.length;
},
Expand Down Expand Up @@ -398,7 +395,7 @@ export default {
}
},
postNote() {
if (this.newPublicationDrawerEnabled && this.canPublish
if (this.newPublicationDrawerEnabled && this.publicationParams
&& !this.isTranslation && !this.editMode) {
this.openPublicationDrawer(this.noteObject);
return;
Expand Down

0 comments on commit a8a559a

Please sign in to comment.