File tree Expand file tree Collapse file tree 3 files changed +6
-24
lines changed Expand file tree Collapse file tree 3 files changed +6
-24
lines changed Original file line number Diff line number Diff line change @@ -43,8 +43,7 @@ export const DefaultPublishButton: React.FC<{ label?: string }> = ({ label: labe
43
43
const { code } = useLocale ( )
44
44
const label = labelProp || t ( 'version:publishChanges' )
45
45
46
- const hasNewerVersions =
47
- unpublishedVersions ?. totalDocs > 0 && unpublishedVersions ?. docs [ 0 ] ?. version ?. _status === 'draft'
46
+ const hasNewerVersions = unpublishedVersions ?. totalDocs > 0
48
47
const canPublish = hasPublishPermission && ( modified || hasNewerVersions || ! publishedDoc )
49
48
const operation = useOperation ( )
50
49
Original file line number Diff line number Diff line change @@ -41,22 +41,14 @@ export const Status: React.FC = () => {
41
41
42
42
let statusToRender : 'changed' | 'draft' | 'published'
43
43
44
- const isChangedFromPublished = unpublishedVersions ?. docs ?. [ 0 ] ?. version ?. _status === 'draft'
45
-
46
- if ( unpublishedVersions ?. docs ?. length > 0 && isChangedFromPublished && publishedDoc ) {
44
+ if ( unpublishedVersions ?. docs ?. length > 0 && publishedDoc ) {
47
45
statusToRender = 'changed'
48
46
} else if ( ! publishedDoc ) {
49
47
statusToRender = 'draft'
50
- } else if ( publishedDoc && unpublishedVersions ?. docs ?. length <= 2 ) {
48
+ } else if ( publishedDoc && unpublishedVersions ?. docs ?. length <= 0 ) {
51
49
statusToRender = 'published'
52
50
}
53
51
54
- const lastVersion = unpublishedVersions ?. docs ?. [ 0 ]
55
-
56
- if ( lastVersion && lastVersion . publishedLocale ) {
57
- statusToRender = locale === lastVersion . publishedLocale ? 'published' : 'draft'
58
- }
59
-
60
52
const performAction = useCallback (
61
53
async ( action : 'revert' | 'unpublish' ) => {
62
54
let url
Original file line number Diff line number Diff line change @@ -340,18 +340,9 @@ const DocumentInfo: React.FC<
340
340
and : [
341
341
...versionParams . where . and ,
342
342
{
343
- or : [
344
- {
345
- updatedAt : {
346
- greater_than : publishedJSON . updatedAt ,
347
- } ,
348
- } ,
349
- {
350
- latest : {
351
- equals : true ,
352
- } ,
353
- } ,
354
- ] ,
343
+ updatedAt : {
344
+ greater_than : publishedJSON . updatedAt ,
345
+ } ,
355
346
} ,
356
347
] ,
357
348
} ,
You can’t perform that action at this time.
0 commit comments