diff options
author | crupest <crupest@outlook.com> | 2020-07-10 22:50:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-10 22:50:01 +0800 |
commit | 15e7467e6089537f0f3e2290f14a99b8a1fc2d76 (patch) | |
tree | a0ba363d1df5d1846f3a46bae4d0ffe7b72e1c89 /Timeline/Models/Http/Timeline.cs | |
parent | 838f9377514b03404afa1d6b6e42e981174178b5 (diff) | |
parent | 3735e7fecd2c9eaf525cedb55912f918aad20779 (diff) | |
download | timeline-15e7467e6089537f0f3e2290f14a99b8a1fc2d76.tar.gz timeline-15e7467e6089537f0f3e2290f14a99b8a1fc2d76.tar.bz2 timeline-15e7467e6089537f0f3e2290f14a99b8a1fc2d76.zip |
Merge pull request #115 from crupest/post-deleted
Add timeline post deleted field.
Diffstat (limited to 'Timeline/Models/Http/Timeline.cs')
-rw-r--r-- | Timeline/Models/Http/Timeline.cs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Timeline/Models/Http/Timeline.cs b/Timeline/Models/Http/Timeline.cs index 80e6e69d..5404d561 100644 --- a/Timeline/Models/Http/Timeline.cs +++ b/Timeline/Models/Http/Timeline.cs @@ -18,7 +18,8 @@ namespace Timeline.Models.Http public class TimelinePostInfo
{
public long Id { get; set; }
- public TimelinePostContentInfo Content { get; set; } = default!;
+ public TimelinePostContentInfo? Content { get; set; }
+ public bool Deleted { get; set; }
public DateTime Time { get; set; }
public UserInfo Author { get; set; } = default!;
public DateTime LastUpdated { get; set; } = default!;
@@ -73,7 +74,7 @@ namespace Timeline.Models.Http }
}
- public class TimelinePostContentResolver : IValueResolver<TimelinePost, TimelinePostInfo, TimelinePostContentInfo>
+ public class TimelinePostContentResolver : IValueResolver<TimelinePost, TimelinePostInfo, TimelinePostContentInfo?>
{
private readonly IActionContextAccessor _actionContextAccessor;
private readonly IUrlHelperFactory _urlHelperFactory;
@@ -84,13 +85,18 @@ namespace Timeline.Models.Http _urlHelperFactory = urlHelperFactory;
}
- public TimelinePostContentInfo Resolve(TimelinePost source, TimelinePostInfo destination, TimelinePostContentInfo destMember, ResolutionContext context)
+ public TimelinePostContentInfo? Resolve(TimelinePost source, TimelinePostInfo destination, TimelinePostContentInfo? destMember, ResolutionContext context)
{
var actionContext = _actionContextAccessor.AssertActionContextForUrlFill();
var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext);
var sourceContent = source.Content;
+ if (sourceContent == null)
+ {
+ return null;
+ }
+
if (sourceContent is TextTimelinePostContent textContent)
{
return new TimelinePostContentInfo
|