File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
tree-view-providers/models Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 1- import { parseISO } from 'date-fns' ;
1+ import { differenceInSeconds , parseISO } from 'date-fns' ;
22
33export class Post {
44 id = - 1 ;
@@ -63,6 +63,10 @@ export class Post {
6363 return '公开' ;
6464 }
6565 }
66+
67+ get hasUpdates ( ) : boolean {
68+ return this . dateUpdated != null && differenceInSeconds ( this . dateUpdated , this . datePublished ) > 0 ;
69+ }
6670}
6771
6872export enum PostType {
Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ export enum RootPostMetadataType {
1818
1919const rootMetadataMap = ( parsedPost : Post , postEditDto : PostEditDto | undefined ) =>
2020 [
21- [ RootPostMetadataType . updateDate , ( ) => new PostUpdatedDateMetadata ( parsedPost ) ] ,
21+ [
22+ RootPostMetadataType . updateDate ,
23+ ( ) => ( parsedPost . hasUpdates ? new PostUpdatedDateMetadata ( parsedPost ) : null ) ,
24+ ] ,
2225 [ RootPostMetadataType . createDate , ( ) => new PostCreatedDateMetadata ( parsedPost ) ] ,
2326 [
2427 RootPostMetadataType . categoryEntry ,
@@ -57,7 +60,7 @@ export abstract class PostMetadata extends BaseTreeItemSource {
5760 rootMetadataMap ( parsedPost , postEditDto )
5861 . filter ( ( [ type ] ) => ! exclude . includes ( type ) )
5962 . map ( ( [ , factory ] ) => factory ( ) )
60- . map ( x => ( x instanceof Promise ? x : Promise . resolve < PostMetadata > ( x ) ) )
63+ . map ( x => ( x instanceof Promise ? x : Promise . resolve ( x ) ) )
6164 ) . then ( v => v . filter ( ( x ) : x is PostMetadata => x instanceof PostMetadata ) ) ;
6265 }
6366
You can’t perform that action at this time.
0 commit comments