diff options
author | crupest <crupest@outlook.com> | 2021-02-13 16:01:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-13 16:01:20 +0800 |
commit | 6a1495dc98f5ae5f89de58ed0ff0b500fc71ff5a (patch) | |
tree | 60cc46ed16a3d84b654cce4b3f364f5eccce52b0 | |
parent | c3d0a5f88de0fbdf6bc584548832017087ab1248 (diff) | |
parent | fd5f842e807ecf0d3a4c385fd0e5e3a52b0a79b2 (diff) | |
download | timeline-6a1495dc98f5ae5f89de58ed0ff0b500fc71ff5a.tar.gz timeline-6a1495dc98f5ae5f89de58ed0ff0b500fc71ff5a.tar.bz2 timeline-6a1495dc98f5ae5f89de58ed0ff0b500fc71ff5a.zip |
Merge pull request #273 from crupest/backend
User permission related field in http.
10 files changed, 196 insertions, 49 deletions
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs index c5ff507f..b91de6c2 100644 --- a/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs +++ b/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs @@ -566,5 +566,25 @@ namespace Timeline.Tests.IntegratedTests body.Should().Equal(imageData);
}
}
+
+ [Theory]
+ [MemberData(nameof(TimelineNameGeneratorTestData))]
+ public async Task Post_Editable(TimelineNameGenerator generator)
+ {
+ HttpTimelinePost post;
+
+ {
+ using var client = await CreateClientAsUser();
+ post = await client.TestPostAsync<HttpTimelinePost>($"timelines/{generator(1)}/posts", CreateTextPostRequest("a"));
+
+ post.Editable.Should().BeTrue();
+ }
+
+ {
+ using var client = await CreateClientAs(2);
+ var post2 = await client.TestGetAsync<HttpTimelinePost>($"timelines/{generator(1)}/posts/{post.Id}");
+ post2.Editable.Should().BeFalse();
+ }
+ }
}
}
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs index ec9a6d83..e2ce8875 100644 --- a/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs +++ b/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs @@ -75,15 +75,6 @@ namespace Timeline.Tests.IntegratedTests await client.TestGetAssertInvalidModelAsync("timelines?visibility=aaa");
}
- var testResultRelate = new List<HttpTimeline>();
- var testResultOwn = new List<HttpTimeline>();
- var testResultJoin = new List<HttpTimeline>();
- var testResultOwnPrivate = new List<HttpTimeline>();
- var testResultRelatePublic = new List<HttpTimeline>();
- var testResultRelateRegister = new List<HttpTimeline>();
- var testResultJoinPrivate = new List<HttpTimeline>();
- var testResultPublic = new List<HttpTimeline>();
-
{
using var client = await CreateClientAsUser();
@@ -91,6 +82,34 @@ namespace Timeline.Tests.IntegratedTests await client.PutTimelineMemberAsync("t1", "user3");
await client.PatchTimelineAsync("@user1", new() { Visibility = TimelineVisibility.Public });
await client.PatchTimelineAsync("t1", new() { Visibility = TimelineVisibility.Register });
+ }
+
+ {
+ using var client = await CreateClientAs(2);
+
+ await client.PutTimelineMemberAsync("@user2", "user3");
+ await client.PutTimelineMemberAsync("t2", "user3");
+ await client.PatchTimelineAsync("@user2", new() { Visibility = TimelineVisibility.Register });
+ await client.PatchTimelineAsync("t2", new() { Visibility = TimelineVisibility.Private });
+ }
+
+ {
+ using var client = await CreateClientAs(3);
+ await client.PatchTimelineAsync("@user3", new HttpTimelinePatchRequest { Visibility = TimelineVisibility.Private });
+ await client.PatchTimelineAsync("t3", new HttpTimelinePatchRequest { Visibility = TimelineVisibility.Register });
+ }
+
+ {
+ var testResultRelate = new List<HttpTimeline>();
+ var testResultOwn = new List<HttpTimeline>();
+ var testResultJoin = new List<HttpTimeline>();
+ var testResultOwnPrivate = new List<HttpTimeline>();
+ var testResultRelatePublic = new List<HttpTimeline>();
+ var testResultRelateRegister = new List<HttpTimeline>();
+ var testResultJoinPrivate = new List<HttpTimeline>();
+ var testResultPublic = new List<HttpTimeline>();
+
+ using var client = await CreateDefaultClient();
{
var timeline = await client.GetTimelineAsync("@user1");
@@ -106,15 +125,6 @@ namespace Timeline.Tests.IntegratedTests testResultJoin.Add(timeline);
testResultRelateRegister.Add(timeline);
}
- }
-
- {
- using var client = await CreateClientAs(2);
-
- await client.PutTimelineMemberAsync("@user2", "user3");
- await client.PutTimelineMemberAsync("t2", "user3");
- await client.PatchTimelineAsync("@user2", new() { Visibility = TimelineVisibility.Register });
- await client.PatchTimelineAsync("t2", new() { Visibility = TimelineVisibility.Private });
{
var timeline = await client.GetTimelineAsync("@user2");
@@ -129,12 +139,6 @@ namespace Timeline.Tests.IntegratedTests testResultJoin.Add(timeline);
testResultJoinPrivate.Add(timeline);
}
- }
-
- {
- using var client = await CreateClientAs(3);
- await client.PatchTimelineAsync("@user3", new HttpTimelinePatchRequest { Visibility = TimelineVisibility.Private });
- await client.PatchTimelineAsync("t3", new HttpTimelinePatchRequest { Visibility = TimelineVisibility.Register });
{
var timeline = await client.GetTimelineAsync("@user3");
@@ -149,10 +153,6 @@ namespace Timeline.Tests.IntegratedTests testResultOwn.Add(timeline);
testResultRelateRegister.Add(timeline);
}
- }
-
- {
- using var client = await CreateDefaultClient();
async Task TestAgainst(string url, List<HttpTimeline> against)
{
@@ -413,5 +413,24 @@ namespace Timeline.Tests.IntegratedTests timeline.Color.Should().Be("#112233");
}
}
+
+ [Theory]
+ [MemberData(nameof(TimelineNameGeneratorTestData))]
+ public async Task Get_Manageable_Postable(TimelineNameGenerator generator)
+ {
+ {
+ using var client = await CreateClientAsUser();
+ var timeline = await client.TestGetAsync<HttpTimeline>($"timelines/{generator(1)}");
+ timeline.Manageable.Should().Be(true);
+ timeline.Postable.Should().Be(true);
+ }
+
+ {
+ using var client = await CreateClientAs(2);
+ var timeline = await client.TestGetAsync<HttpTimeline>($"timelines/{generator(1)}");
+ timeline.Manageable.Should().Be(false);
+ timeline.Postable.Should().Be(false);
+ }
+ }
}
}
diff --git a/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs b/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs index 16793de6..e2a08dcb 100644 --- a/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs +++ b/BackEnd/Timeline/Controllers/BookmarkTimelineController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Timeline.Entities;
using Timeline.Models.Http;
using Timeline.Models.Mapper;
using Timeline.Models.Validation;
@@ -28,6 +29,11 @@ namespace Timeline.Controllers _timelineMapper = timelineMapper;
}
+ private Task<List<HttpTimeline>> Map(List<TimelineEntity> timelines)
+ {
+ return _timelineMapper.MapToHttp(timelines, Url, this.GetOptionalUserId(), this.UserHasPermission(UserPermission.AllTimelineManagement));
+ }
+
/// <summary>
/// Get bookmark list in order.
/// </summary>
@@ -40,7 +46,7 @@ namespace Timeline.Controllers {
var ids = await _service.GetBookmarks(this.GetUserId());
var timelines = await _timelineService.GetTimelineList(ids);
- return await _timelineMapper.MapToHttp(timelines, Url, this.GetOptionalUserId());
+ return await Map(timelines);
}
/// <summary>
diff --git a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs index ea012f76..f582e74b 100644 --- a/BackEnd/Timeline/Controllers/HighlightTimelineController.cs +++ b/BackEnd/Timeline/Controllers/HighlightTimelineController.cs @@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Timeline.Auth;
+using Timeline.Entities;
using Timeline.Models.Http;
using Timeline.Models.Mapper;
using Timeline.Models.Validation;
@@ -28,6 +29,11 @@ namespace Timeline.Controllers _timelineMapper = timelineMapper;
}
+ private Task<List<HttpTimeline>> Map(List<TimelineEntity> timelines)
+ {
+ return _timelineMapper.MapToHttp(timelines, Url, this.GetOptionalUserId(), this.UserHasPermission(UserPermission.AllTimelineManagement));
+ }
+
/// <summary>
/// Get all highlight timelines.
/// </summary>
@@ -38,7 +44,7 @@ namespace Timeline.Controllers {
var ids = await _service.GetHighlightTimelines();
var timelines = await _timelineService.GetTimelineList(ids);
- return await _timelineMapper.MapToHttp(timelines, Url, this.GetOptionalUserId());
+ return await Map(timelines);
}
/// <summary>
diff --git a/BackEnd/Timeline/Controllers/SearchController.cs b/BackEnd/Timeline/Controllers/SearchController.cs index dec876b6..b2266c18 100644 --- a/BackEnd/Timeline/Controllers/SearchController.cs +++ b/BackEnd/Timeline/Controllers/SearchController.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
+using Timeline.Entities;
using Timeline.Models.Http;
using Timeline.Models.Mapper;
using Timeline.Services;
@@ -28,6 +29,11 @@ namespace Timeline.Controllers _userMapper = userMapper;
}
+ private Task<List<HttpTimeline>> Map(List<TimelineEntity> timelines)
+ {
+ return _timelineMapper.MapToHttp(timelines, Url, this.GetOptionalUserId(), this.UserHasPermission(UserPermission.AllTimelineManagement));
+ }
+
/// <summary>
/// Search timelines whose name or title contains query string case-insensitively.
/// </summary>
@@ -40,7 +46,7 @@ namespace Timeline.Controllers {
var searchResult = await _service.SearchTimeline(query);
var timelines = searchResult.Items.Select(i => i.Item).ToList();
- return await _timelineMapper.MapToHttp(timelines, Url, this.GetOptionalUserId());
+ return await Map(timelines);
}
/// <summary>
diff --git a/BackEnd/Timeline/Controllers/TimelineController.cs b/BackEnd/Timeline/Controllers/TimelineController.cs index 8479ca83..b20ab227 100644 --- a/BackEnd/Timeline/Controllers/TimelineController.cs +++ b/BackEnd/Timeline/Controllers/TimelineController.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc; using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Timeline.Entities;
using Timeline.Filters;
using Timeline.Models;
using Timeline.Models.Http;
@@ -43,6 +44,16 @@ namespace Timeline.Controllers private bool UserHasAllTimelineManagementPermission => this.UserHasPermission(UserPermission.AllTimelineManagement);
+ private Task<HttpTimeline> Map(TimelineEntity timeline)
+ {
+ return _timelineMapper.MapToHttp(timeline, Url, this.GetOptionalUserId(), UserHasAllTimelineManagementPermission);
+ }
+
+ private Task<List<HttpTimeline>> Map(List<TimelineEntity> timelines)
+ {
+ return _timelineMapper.MapToHttp(timelines, Url, this.GetOptionalUserId(), UserHasAllTimelineManagementPermission);
+ }
+
/// <summary>
/// List all timelines.
/// </summary>
@@ -102,7 +113,7 @@ namespace Timeline.Controllers }
var timelines = await _service.GetTimelines(relationship, visibilityFilter);
- var result = await _timelineMapper.MapToHttp(timelines, Url, this.GetOptionalUserId());
+ var result = await Map(timelines);
return result;
}
@@ -118,7 +129,7 @@ namespace Timeline.Controllers {
var timelineId = await _service.GetTimelineIdByName(timeline);
var t = await _service.GetTimeline(timelineId);
- var result = await _timelineMapper.MapToHttp(t, Url, this.GetOptionalUserId());
+ var result = await Map(t);
return result;
}
@@ -147,7 +158,7 @@ namespace Timeline.Controllers {
await _service.ChangeProperty(timelineId, _mapper.Map<TimelineChangePropertyParams>(body));
var t = await _service.GetTimeline(timelineId);
- var result = await _timelineMapper.MapToHttp(t, Url, this.GetOptionalUserId());
+ var result = await Map(t);
return result;
}
catch (EntityAlreadyExistException)
@@ -237,7 +248,7 @@ namespace Timeline.Controllers try
{
var timeline = await _service.CreateTimeline(body.Name, userId);
- var result = await _timelineMapper.MapToHttp(timeline, Url, this.GetOptionalUserId());
+ var result = await Map(timeline);
return result;
}
catch (EntityAlreadyExistException e) when (e.EntityName == EntityNames.Timeline)
diff --git a/BackEnd/Timeline/Controllers/TimelinePostController.cs b/BackEnd/Timeline/Controllers/TimelinePostController.cs index 6904e28d..4026d551 100644 --- a/BackEnd/Timeline/Controllers/TimelinePostController.cs +++ b/BackEnd/Timeline/Controllers/TimelinePostController.cs @@ -12,6 +12,7 @@ using Timeline.Models.Http; using Timeline.Models.Mapper;
using Timeline.Models.Validation;
using Timeline.Services;
+using Timeline.Entities;
namespace Timeline.Controllers
{
@@ -43,6 +44,16 @@ namespace Timeline.Controllers private bool UserHasAllTimelineManagementPermission => this.UserHasPermission(UserPermission.AllTimelineManagement);
+ private Task<HttpTimelinePost> Map(TimelinePostEntity post, string timelineName)
+ {
+ return _timelineMapper.MapToHttp(post, timelineName, Url, this.GetOptionalUserId(), UserHasAllTimelineManagementPermission);
+ }
+
+ private Task<List<HttpTimelinePost>> Map(List<TimelinePostEntity> posts, string timelineName)
+ {
+ return _timelineMapper.MapToHttp(posts, timelineName, Url, this.GetOptionalUserId(), UserHasAllTimelineManagementPermission);
+ }
+
/// <summary>
/// Get posts of a timeline.
/// </summary>
@@ -65,7 +76,7 @@ namespace Timeline.Controllers var posts = await _postService.GetPosts(timelineId, modifiedSince, includeDeleted ?? false);
- var result = await _timelineMapper.MapToHttp(posts, timeline, Url);
+ var result = await Map(posts, timeline);
return result;
}
@@ -89,7 +100,7 @@ namespace Timeline.Controllers }
var post = await _postService.GetPost(timelineId, postId);
- var result = await _timelineMapper.MapToHttp(post, timeline, Url);
+ var result = await Map(post, timeline);
return result;
}
@@ -190,7 +201,7 @@ namespace Timeline.Controllers try
{
var post = await _postService.CreatePost(timelineId, userId, createRequest);
- var result = await _timelineMapper.MapToHttp(post, timeline, Url);
+ var result = await Map(post, timeline);
return result;
}
catch (TimelinePostCreateDataException e)
@@ -222,7 +233,7 @@ namespace Timeline.Controllers }
var entity = await _postService.PatchPost(timelineId, post, new TimelinePostPatchRequest { Time = body.Time, Color = body.Color });
- var result = await _timelineMapper.MapToHttp(entity, timeline, Url);
+ var result = await Map(entity, timeline);
return Ok(result);
}
diff --git a/BackEnd/Timeline/Models/Http/HttpTimeline.cs b/BackEnd/Timeline/Models/Http/HttpTimeline.cs index 87ebf0bb..e3e46bd5 100644 --- a/BackEnd/Timeline/Models/Http/HttpTimeline.cs +++ b/BackEnd/Timeline/Models/Http/HttpTimeline.cs @@ -10,7 +10,7 @@ namespace Timeline.Models.Http {
public HttpTimeline() { }
- public HttpTimeline(string uniqueId, string title, string name, DateTime nameLastModifed, string description, HttpUser owner, TimelineVisibility visibility, List<HttpUser> members, string? color, DateTime createTime, DateTime lastModified, bool isHighlight, bool isBookmark, HttpTimelineLinks links)
+ public HttpTimeline(string uniqueId, string title, string name, DateTime nameLastModifed, string description, HttpUser owner, TimelineVisibility visibility, List<HttpUser> members, string? color, DateTime createTime, DateTime lastModified, bool isHighlight, bool isBookmark, bool manageable, bool postable, HttpTimelineLinks links)
{
UniqueId = uniqueId;
Title = title;
@@ -25,6 +25,8 @@ namespace Timeline.Models.Http LastModified = lastModified;
IsHighlight = isHighlight;
IsBookmark = isBookmark;
+ Manageable = manageable;
+ Postable = postable;
_links = links;
}
@@ -78,6 +80,8 @@ namespace Timeline.Models.Http public bool IsHighlight { get; set; }
public bool IsBookmark { get; set; }
+ public bool Manageable { get; set; }
+ public bool Postable { get; set; }
#pragma warning disable CA1707 // Identifiers should not contain underscores
/// <summary>
diff --git a/BackEnd/Timeline/Models/Http/HttpTimelinePost.cs b/BackEnd/Timeline/Models/Http/HttpTimelinePost.cs index 26e1a92d..5e069821 100644 --- a/BackEnd/Timeline/Models/Http/HttpTimelinePost.cs +++ b/BackEnd/Timeline/Models/Http/HttpTimelinePost.cs @@ -11,7 +11,7 @@ namespace Timeline.Models.Http {
public HttpTimelinePost() { }
- public HttpTimelinePost(long id, List<HttpTimelinePostDataDigest> dataList, bool deleted, DateTime time, HttpUser? author, string? color, DateTime lastUpdated)
+ public HttpTimelinePost(long id, List<HttpTimelinePostDataDigest> dataList, bool deleted, DateTime time, HttpUser? author, string? color, DateTime lastUpdated, string timelineName, bool editable)
{
Id = id;
DataList = dataList;
@@ -20,6 +20,8 @@ namespace Timeline.Models.Http Author = author;
Color = color;
LastUpdated = lastUpdated;
+ TimelineName = timelineName;
+ Editable = editable;
}
/// <summary>
@@ -52,5 +54,13 @@ namespace Timeline.Models.Http /// Last updated time.
/// </summary>
public DateTime LastUpdated { get; set; } = default!;
+ /// <summary>
+ /// Timeline name.
+ /// </summary>
+ public string TimelineName { get; set; } = default!;
+ /// <summary>
+ /// True if you can edit this post.
+ /// </summary>
+ public bool Editable { get; set; }
}
}
diff --git a/BackEnd/Timeline/Models/Mapper/TimelineMapper.cs b/BackEnd/Timeline/Models/Mapper/TimelineMapper.cs index 5c46fa81..e4304311 100644 --- a/BackEnd/Timeline/Models/Mapper/TimelineMapper.cs +++ b/BackEnd/Timeline/Models/Mapper/TimelineMapper.cs @@ -16,22 +16,51 @@ namespace Timeline.Models.Mapper private readonly UserMapper _userMapper;
private readonly IHighlightTimelineService _highlightTimelineService;
private readonly IBookmarkTimelineService _bookmarkTimelineService;
+ private readonly ITimelineService _timelineService;
+ private readonly ITimelinePostService _timelinePostService;
- public TimelineMapper(DatabaseContext database, UserMapper userMapper, IHighlightTimelineService highlightTimelineService, IBookmarkTimelineService bookmarkTimelineService)
+ public TimelineMapper(DatabaseContext database, UserMapper userMapper, IHighlightTimelineService highlightTimelineService, IBookmarkTimelineService bookmarkTimelineService, ITimelineService timelineService, ITimelinePostService timelinePostService)
{
_database = database;
_userMapper = userMapper;
_highlightTimelineService = highlightTimelineService;
_bookmarkTimelineService = bookmarkTimelineService;
+ _timelineService = timelineService;
+ _timelinePostService = timelinePostService;
}
- public async Task<HttpTimeline> MapToHttp(TimelineEntity entity, IUrlHelper urlHelper, long? userId)
+ public async Task<HttpTimeline> MapToHttp(TimelineEntity entity, IUrlHelper urlHelper, long? userId, bool isAdministrator)
{
await _database.Entry(entity).Reference(e => e.Owner).LoadAsync();
await _database.Entry(entity).Collection(e => e.Members).Query().Include(m => m.User).LoadAsync();
var timelineName = entity.Name is null ? "@" + entity.Owner.Username : entity.Name;
+ bool manageable;
+
+ if (userId is null)
+ {
+ manageable = false;
+ }
+ else if (isAdministrator)
+ {
+ manageable = true;
+ }
+ else
+ {
+ 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,
@@ -46,6 +75,8 @@ namespace Timeline.Models.Mapper lastModified: entity.LastModified,
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 })
@@ -53,18 +84,18 @@ namespace Timeline.Models.Mapper );
}
- public async Task<List<HttpTimeline>> MapToHttp(List<TimelineEntity> entities, IUrlHelper urlHelper, long? userId)
+ public async Task<List<HttpTimeline>> MapToHttp(List<TimelineEntity> entities, IUrlHelper urlHelper, long? userId, bool isAdministrator)
{
var result = new List<HttpTimeline>();
foreach (var entity in entities)
{
- result.Add(await MapToHttp(entity, urlHelper, userId));
+ result.Add(await MapToHttp(entity, urlHelper, userId, isAdministrator));
}
return result;
}
- public async Task<HttpTimelinePost> MapToHttp(TimelinePostEntity entity, string timelineName, IUrlHelper urlHelper)
+ public async Task<HttpTimelinePost> MapToHttp(TimelinePostEntity entity, string timelineName, IUrlHelper urlHelper, long? userId, bool isAdministrator)
{
_ = timelineName;
@@ -79,6 +110,22 @@ namespace Timeline.Models.Mapper author = await _userMapper.MapToHttp(entity.Author, urlHelper);
}
+ bool editable;
+
+ if (userId is null)
+ {
+ editable = false;
+ }
+ else if (isAdministrator)
+ {
+ editable = true;
+ }
+ else
+ {
+ editable = await _timelinePostService.HasPostModifyPermission(entity.TimelineId, entity.LocalId, userId.Value);
+ }
+
+
return new HttpTimelinePost(
id: entity.LocalId,
dataList: dataDigestList,
@@ -86,18 +133,25 @@ namespace Timeline.Models.Mapper author: author,
color: entity.Color,
deleted: entity.Deleted,
- lastUpdated: entity.LastUpdated
+ lastUpdated: entity.LastUpdated,
+ timelineName: timelineName,
+ editable: editable
);
}
- public async Task<List<HttpTimelinePost>> MapToHttp(List<TimelinePostEntity> entities, string timelineName, IUrlHelper urlHelper)
+ public async Task<List<HttpTimelinePost>> MapToHttp(List<TimelinePostEntity> entities, string timelineName, IUrlHelper urlHelper, long? userId, bool isAdministrator)
{
var result = new List<HttpTimelinePost>();
foreach (var entity in entities)
{
- result.Add(await MapToHttp(entity, timelineName, urlHelper));
+ result.Add(await MapToHttp(entity, timelineName, urlHelper, userId, isAdministrator));
}
return result;
}
+
+ internal Task MapToHttp(TimelinePostEntity post, string timeline, IUrlHelper url)
+ {
+ throw new System.NotImplementedException();
+ }
}
}
|