aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Models/Mapper
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-02-13 15:57:29 +0800
committercrupest <crupest@outlook.com>2021-02-13 15:57:29 +0800
commitfd5f842e807ecf0d3a4c385fd0e5e3a52b0a79b2 (patch)
tree60cc46ed16a3d84b654cce4b3f364f5eccce52b0 /BackEnd/Timeline/Models/Mapper
parent4538aa0be40316a967d6fbcbc08bc9670b9bbcf0 (diff)
downloadtimeline-fd5f842e807ecf0d3a4c385fd0e5e3a52b0a79b2.tar.gz
timeline-fd5f842e807ecf0d3a4c385fd0e5e3a52b0a79b2.tar.bz2
timeline-fd5f842e807ecf0d3a4c385fd0e5e3a52b0a79b2.zip
feat: Timeline add postable.
Diffstat (limited to 'BackEnd/Timeline/Models/Mapper')
-rw-r--r--BackEnd/Timeline/Models/Mapper/TimelineMapper.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/BackEnd/Timeline/Models/Mapper/TimelineMapper.cs b/BackEnd/Timeline/Models/Mapper/TimelineMapper.cs
index 8dfd7b8d..e4304311 100644
--- a/BackEnd/Timeline/Models/Mapper/TimelineMapper.cs
+++ b/BackEnd/Timeline/Models/Mapper/TimelineMapper.cs
@@ -51,6 +51,16 @@ namespace Timeline.Models.Mapper
manageable = await _timelineService.HasManagePermission(entity.Id, userId.Value);
}
+ bool postable;
+ if (userId is null)
+ {
+ postable = false;
+ }
+ else
+ {
+ postable = await _timelineService.IsMemberOf(entity.Id, userId.Value);
+ }
+
return new HttpTimeline(
uniqueId: entity.UniqueId,
title: string.IsNullOrEmpty(entity.Title) ? timelineName : entity.Title,
@@ -66,6 +76,7 @@ namespace Timeline.Models.Mapper
isHighlight: await _highlightTimelineService.IsHighlightTimeline(entity.Id),
isBookmark: userId is not null && await _bookmarkTimelineService.IsBookmark(userId.Value, entity.Id, false, false),
manageable: manageable,
+ postable: postable,
links: new HttpTimelineLinks(
self: urlHelper.ActionLink(nameof(TimelineController.TimelineGet), nameof(TimelineController)[0..^nameof(Controller).Length], new { timeline = timelineName }),
posts: urlHelper.ActionLink(nameof(TimelinePostController.List), nameof(TimelinePostController)[0..^nameof(Controller).Length], new { timeline = timelineName })