diff options
author | crupest <crupest@outlook.com> | 2022-04-12 15:18:47 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-04-12 15:18:47 +0800 |
commit | 175223fc3be512db4a939584c989d7e5d7b6832e (patch) | |
tree | 0b07536ba2815bd43da0f14d055dce1a4d8fcedd | |
parent | ca1df3734b825cd0ee5bb1964a544371fb49e7a5 (diff) | |
download | timeline-175223fc3be512db4a939584c989d7e5d7b6832e.tar.gz timeline-175223fc3be512db4a939584c989d7e5d7b6832e.tar.bz2 timeline-175223fc3be512db4a939584c989d7e5d7b6832e.zip |
...
-rw-r--r-- | BackEnd/Timeline/Services/Token/SecureRandomUserTokenService.cs | 2 | ||||
-rw-r--r-- | FrontEnd/src/http/timeline.ts | 24 | ||||
-rw-r--r-- | FrontEnd/src/views/timeline/Timeline.tsx | 6 |
3 files changed, 27 insertions, 5 deletions
diff --git a/BackEnd/Timeline/Services/Token/SecureRandomUserTokenService.cs b/BackEnd/Timeline/Services/Token/SecureRandomUserTokenService.cs index 404862d4..2ab263de 100644 --- a/BackEnd/Timeline/Services/Token/SecureRandomUserTokenService.cs +++ b/BackEnd/Timeline/Services/Token/SecureRandomUserTokenService.cs @@ -81,7 +81,7 @@ namespace Timeline.Services.Token var currentTime = _clock.GetCurrentTime(); - if (entity.ExpireAt.HasValue && entity.ExpireAt > currentTime) + if (entity.ExpireAt.HasValue && entity.ExpireAt.Value <= currentTime) { throw new UserTokenExpiredException(token, entity.ExpireAt.Value, currentTime); } diff --git a/FrontEnd/src/http/timeline.ts b/FrontEnd/src/http/timeline.ts index 65717a83..0e1ceb81 100644 --- a/FrontEnd/src/http/timeline.ts +++ b/FrontEnd/src/http/timeline.ts @@ -50,6 +50,7 @@ export interface HttpTimelinePostDataDigest { export interface HttpTimelinePostInfo { id: number; + deleted: false; time: string; author: HttpUser; dataList: HttpTimelinePostDataDigest[]; @@ -60,6 +61,23 @@ export interface HttpTimelinePostInfo { editable: boolean; } +export interface HttpTimelineDeletedPostInfo { + id: number; + deleted: true; + time: string; + author?: HttpUser; + dataList: HttpTimelinePostDataDigest[]; + color?: string; + lastUpdated: string; + timelineOwnerV2: string; + timelineNameV2: string; + editable: boolean; +} + +export type HttpTimelineGenericPostInfo = + | HttpTimelinePostInfo + | HttpTimelineDeletedPostInfo; + export interface HttpTimelinePostPostRequestData { contentType: string; data: string; @@ -116,7 +134,7 @@ export interface IHttpTimelineClient { listPost( ownerUsername: string, timelineName: string - ): Promise<Page<HttpTimelinePostInfo>>; + ): Promise<Page<HttpTimelineGenericPostInfo>>; generatePostDataUrl( ownerUsername: string, timelineName: string, @@ -218,9 +236,9 @@ export class HttpTimelineClient implements IHttpTimelineClient { listPost( ownerUsername: string, timelineName: string - ): Promise<Page<HttpTimelinePostInfo>> { + ): Promise<Page<HttpTimelineGenericPostInfo>> { return axios - .get<Page<HttpTimelinePostInfo>>( + .get<Page<HttpTimelineGenericPostInfo>>( `${apiBaseUrl}/v2/timelines/${ownerUsername}/${timelineName}/posts` ) .then(extractResponseData); diff --git a/FrontEnd/src/views/timeline/Timeline.tsx b/FrontEnd/src/views/timeline/Timeline.tsx index a2047651..7fb58e0c 100644 --- a/FrontEnd/src/views/timeline/Timeline.tsx +++ b/FrontEnd/src/views/timeline/Timeline.tsx @@ -89,7 +89,11 @@ const Timeline: React.FC<TimelineProps> = (props) => { ([t, p]) => { if (subscribe) { setTimeline(t); - setPosts(p.items); + setPosts( + p.items.filter( + (p): p is HttpTimelinePostInfo => p.deleted === false + ) + ); setState("loaded"); onTimelineLoaded.current?.(t); } |