diff options
| author | crupest <crupest@outlook.com> | 2020-11-16 16:30:32 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2020-11-16 16:30:32 +0800 |
| commit | a687a23a641ca262dbffd383af129a0069fbc5ee (patch) | |
| tree | 04b9498a38c5b06bf8d5e1cd80f4620d0646a560 /FrontEnd/src/app/services/timeline.ts | |
| parent | ffa5d76316ccec4edc307d0432ef10fb18436c63 (diff) | |
| download | timeline-a687a23a641ca262dbffd383af129a0069fbc5ee.tar.gz timeline-a687a23a641ca262dbffd383af129a0069fbc5ee.tar.bz2 timeline-a687a23a641ca262dbffd383af129a0069fbc5ee.zip | |
...
Diffstat (limited to 'FrontEnd/src/app/services/timeline.ts')
| -rw-r--r-- | FrontEnd/src/app/services/timeline.ts | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/FrontEnd/src/app/services/timeline.ts b/FrontEnd/src/app/services/timeline.ts index 2cbbffab..c58516fc 100644 --- a/FrontEnd/src/app/services/timeline.ts +++ b/FrontEnd/src/app/services/timeline.ts @@ -29,11 +29,11 @@ export type { TimelineVisibility } from "@/http/timeline"; import { dataStorage, throwIfNotNetworkError, BlobOrStatus } from "./common"; import { DataHub, WithSyncStatus } from "./DataHub"; import { - UserAuthInfo, checkLogin, userService, userInfoService, User, + AuthUser, } from "./user"; export type TimelineInfo = HttpTimelineInfo; @@ -608,10 +608,11 @@ export class TimelineService { } hasReadPermission( - user: UserAuthInfo | null | undefined, + user: AuthUser | null | undefined, timeline: TimelineInfo ): boolean { - if (user != null && user.administrator) return true; + if (user != null && user.hasAllTimelineAdministrationPermission) + return true; const { visibility } = timeline; if (visibility === "Public") { @@ -631,10 +632,11 @@ export class TimelineService { } hasPostPermission( - user: UserAuthInfo | null | undefined, + user: AuthUser | null | undefined, timeline: TimelineInfo ): boolean { - if (user != null && user.administrator) return true; + if (user != null && user.hasAllTimelineAdministrationPermission) + return true; return ( user != null && @@ -644,20 +646,22 @@ export class TimelineService { } hasManagePermission( - user: UserAuthInfo | null | undefined, + user: AuthUser | null | undefined, timeline: TimelineInfo ): boolean { - if (user != null && user.administrator) return true; + if (user != null && user.hasAllTimelineAdministrationPermission) + return true; return user != null && user.username == timeline.owner.username; } hasModifyPostPermission( - user: UserAuthInfo | null | undefined, + user: AuthUser | null | undefined, timeline: TimelineInfo, post: TimelinePostInfo ): boolean { - if (user != null && user.administrator) return true; + if (user != null && user.hasAllTimelineAdministrationPermission) + return true; return ( user != null && |
