aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Models
diff options
context:
space:
mode:
Diffstat (limited to 'Timeline/Models')
-rw-r--r--Timeline/Models/Http/Timeline.cs12
-rw-r--r--Timeline/Models/Timeline.cs5
2 files changed, 12 insertions, 5 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
diff --git a/Timeline/Models/Timeline.cs b/Timeline/Models/Timeline.cs
index 3701ed35..7afb1984 100644
--- a/Timeline/Models/Timeline.cs
+++ b/Timeline/Models/Timeline.cs
@@ -48,7 +48,7 @@ namespace Timeline.Models
public class TimelinePost
{
- public TimelinePost(long id, ITimelinePostContent content, DateTime time, User author, DateTime lastUpdated, string timelineName)
+ public TimelinePost(long id, ITimelinePostContent? content, DateTime time, User author, DateTime lastUpdated, string timelineName)
{
Id = id;
Content = content;
@@ -59,7 +59,8 @@ namespace Timeline.Models
}
public long Id { get; set; }
- public ITimelinePostContent Content { get; set; }
+ public ITimelinePostContent? Content { get; set; }
+ public bool Deleted => Content == null;
public DateTime Time { get; set; }
public User Author { get; set; }
public DateTime LastUpdated { get; set; }