aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Controllers/SearchController.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-02-13 21:24:33 +0800
committercrupest <crupest@outlook.com>2021-02-13 21:24:33 +0800
commit50dbdde46eed6f2ff4c9691eea4414c1712af8e5 (patch)
treeaa0ee1272aa3e27462289fce0b2d5466d5049f96 /BackEnd/Timeline/Controllers/SearchController.cs
parentc8bd19aacf9059f740df4f6fa9890127c20c1f6d (diff)
parent6a1495dc98f5ae5f89de58ed0ff0b500fc71ff5a (diff)
downloadtimeline-50dbdde46eed6f2ff4c9691eea4414c1712af8e5.tar.gz
timeline-50dbdde46eed6f2ff4c9691eea4414c1712af8e5.tar.bz2
timeline-50dbdde46eed6f2ff4c9691eea4414c1712af8e5.zip
Merge branch 'master' into frontend
Diffstat (limited to 'BackEnd/Timeline/Controllers/SearchController.cs')
-rw-r--r--BackEnd/Timeline/Controllers/SearchController.cs8
1 files changed, 7 insertions, 1 deletions
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>