0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-25 02:31:59 -05:00

Put everything behind a feature flag publishFlowEndScreen

This commit is contained in:
Sodbileg Gansukh 2024-08-13 12:33:07 +08:00
parent d9bc0156f8
commit fd330a1c08
8 changed files with 90 additions and 63 deletions

View file

@ -59,6 +59,10 @@ const features = [{
title: 'Content Visibility',
description: 'Enables content visibility in Emails',
flag: 'contentVisibility'
},{
title: 'Publish Flow — End Screen',
description: 'Enables improved publish flow',
flag: 'publishFlowEndScreen'
}];
const AlphaFeatures: React.FC = () => {

View file

@ -45,13 +45,14 @@
@close={{@close}}
/>
{{else if this.isComplete}}
{{!-- <Editor::Modals::PublishFlow::Confirm
@publishOptions={{@data.publishOptions}}
@recipientType={{this.recipientType}}
@saveTask={{this.saveTask}}
@cancel={{this.toggleConfirm}}
@close={{@close}}
/> --}}
{{#unless (feature "publishFlowEndScreen")}}
<Editor::Modals::PublishFlow::Complete
@publishOptions={{@data.publishOptions}}
@recipientType={{this.recipientType}}
@postCount={{this.postCount}}
@close={{@close}}
/>
{{/unless}}
{{else}}
<Editor::Modals::PublishFlow::Options
@publishOptions={{@data.publishOptions}}

View file

@ -13,6 +13,7 @@ function isString(str) {
export default class PublishFlowOptions extends Component {
@service settings;
@service feature;
@tracked errorMessage;
@ -91,12 +92,14 @@ export default class PublishFlowOptions extends Component {
try {
yield this.args.saveTask.perform();
if (this.args.publishOptions.isScheduled) {
localStorage.setItem('ghost-last-scheduled-post', this.args.publishOptions.post.id);
window.location.href = '/ghost/#/posts?type=scheduled';
} else {
localStorage.setItem('ghost-last-published-post', this.args.publishOptions.post.id);
window.location.href = `/ghost/#/posts/analytics/${this.args.publishOptions.post.id}`;
if (this.feature.publishFlowEndScreen) {
if (this.args.publishOptions.isScheduled) {
localStorage.setItem('ghost-last-scheduled-post', this.args.publishOptions.post.id);
window.location.href = '/ghost/#/posts?type=scheduled';
} else {
localStorage.setItem('ghost-last-published-post', this.args.publishOptions.post.id);
window.location.href = `/ghost/#/posts/analytics/${this.args.publishOptions.post.id}`;
}
}
} catch (e) {
if (e === undefined && this.args.publishOptions.post.errors.length !== 0) {

View file

@ -6,12 +6,15 @@ import {task} from 'ember-concurrency';
export default class PostsList extends Component {
@service store;
@service modals;
@service feature;
latestScheduledPost = null;
constructor() {
super(...arguments);
this.checkPublishFlowModal();
if (this.feature.publishFlowEndScreen) {
this.checkPublishFlowModal();
}
}
async checkPublishFlowModal() {

View file

@ -34,53 +34,61 @@
{{moment-format publishedAt "HH:mm"}}
{{/let}}
</div>
<div style="display: flex; gap: 4px;">
<button class="gh-post-list-cta edit" {{on "click" this.fetchPostTask.perform}}>
{{svg-jar "reload" title="Refresh post analytics"}}<span>Refresh</span>
</button>
{{#unless this.post.emailOnly}}
<button class="gh-post-list-cta edit" {{on "click" this.togglePublishFlowModal}}>
{{svg-jar "share" title="Share post"}}<span>Share</span>
</button>
{{/unless}}
{{#unless (feature "publishFlowEndScreen")}}
<LinkTo @route="lexical-editor.edit" @models={{array this.post.displayName this.post.id}} class="gh-post-list-cta edit" title="">
{{svg-jar "pen" title=""}}<span>Edit post</span>
</LinkTo>
{{else}}
<div style="display: flex; gap: 4px;">
{{#if (feature "publishFlowEndScreen")}}
<button class="gh-post-list-cta edit" {{on "click" this.fetchPostTask.perform}}>
{{svg-jar "reload" title="Refresh post analytics"}}<span>Refresh</span>
</button>
{{/if}}
{{#unless this.post.emailOnly}}
<button class="gh-post-list-cta edit" {{on "click" this.togglePublishFlowModal}}>
{{svg-jar "share" title="Share post"}}<span>Share</span>
</button>
{{/unless}}
<span class="dropdown">
<GhDropdownButton
@dropdownName="analytics-actions-menu"
@classNames="gh-post-list-cta edit gh-btn-icon icon-only gh-btn-action-icon"
@title="Analytics Actions"
data-test-button="analytics-actions"
>
<span>
{{svg-jar "dotdotdot"}}
<span class="hidden">Actions</span>
</span>
</GhDropdownButton>
<GhDropdown
@name="analytics-actions-menu"
@tagName="ul"
@classNames="gh-analytics-actions-menu dropdown-menu dropdown-triangle-top-right"
@closeOnClick={{true}}
>
<li>
<LinkTo @route="lexical-editor.edit" @models={{array this.post.displayName this.post.id}}>Edit post</LinkTo>
</li>
<li>
<a href="{{this.post.url}}" target="_blank" rel="noreferrer">View in browser</a>
</li>
<li>
<button
type="button"
class="mr2"
{{on "click" this.confirmDeleteMember}}
data-test-button="delete-post"
>
<span class="red">Delete post</span>
</button>
</li>
</GhDropdown>
</span>
</div>
<span class="dropdown">
<GhDropdownButton
@dropdownName="analytics-actions-menu"
@classNames="gh-post-list-cta edit gh-btn-icon icon-only gh-btn-action-icon"
@title="Analytics Actions"
data-test-button="analytics-actions"
>
<span>
{{svg-jar "dotdotdot"}}
<span class="hidden">Actions</span>
</span>
</GhDropdownButton>
<GhDropdown
@name="analytics-actions-menu"
@tagName="ul"
@classNames="gh-analytics-actions-menu dropdown-menu dropdown-triangle-top-right"
@closeOnClick={{true}}
>
<li>
<LinkTo @route="lexical-editor.edit" @models={{array this.post.displayName this.post.id}}>Edit post</LinkTo>
</li>
<li>
<a href="{{this.post.url}}" target="_blank" rel="noreferrer">View in browser</a>
</li>
<li>
<button
type="button"
class="mr2"
{{on "click" this.confirmDeleteMember}}
data-test-button="delete-post"
>
<span class="red">Delete post</span>
</button>
</li>
</GhDropdown>
</span>
</div>
{{/unless}}
</div>
</div>
</GhCanvasHeader>

View file

@ -43,7 +43,9 @@ export default class Analytics extends Component {
constructor() {
super(...arguments);
this.checkPublishFlowModal();
if (this.feature.publishFlowEndScreen) {
this.checkPublishFlowModal();
}
}
openPublishFlowModal() {
@ -64,7 +66,11 @@ export default class Analytics extends Component {
}
get post() {
return this._post ?? this.args.post;
if (this.feature.publishFlowEndScreen) {
return this._post ?? this.args.post;
}
return this.args.post;
}
set post(value) {

View file

@ -79,6 +79,7 @@ export default class FeatureService extends Service {
@feature('internalLinking') internalLinking;
@feature('editorExcerpt') editorExcerpt;
@feature('contentVisibility') contentVisibility;
@feature('publishFlowEndScreen') publishFlowEndScreen;
_user = null;

View file

@ -46,7 +46,8 @@ const ALPHA_FEATURES = [
'importMemberTier',
'lexicalIndicators',
'adminXDemo',
'contentVisibility'
'contentVisibility',
'publishFlowEndScreen'
];
module.exports.GA_KEYS = [...GA_FEATURES];