public async Task <IActionResult> GetPublicTimeline() { await CheckSessionForUser(); return(new ContentResult { ContentType = "text/html", StatusCode = Status200OK, Content = BasicTemplater.GenerateTimeline(messages: await MessageRepo.ReadAllAsync(MessageLimit), timelineType.PUBLIC, user: user) }); }
public async Task <ActionResult> GetUserAsync([FromRoute] string username) { await CheckSessionForUser(); var searchedUser = await UserRepo.ReadAsync(username, MessageLimit); if (searchedUser is null) { return((ActionResult) await Get404Page()); } return(new ContentResult { ContentType = "text/html", StatusCode = Status200OK, Content = BasicTemplater.GenerateTimeline(searchedUser.messages, timelineType.OTHER, user: user, otherPersonUsername: searchedUser.username) }); }
public async Task <IActionResult> GetTimeline() { await CheckSessionForUser(); if (user is null) { return(Redirect("/public")); } List <MessageReadDTO> messages = user.messages; foreach (string follow in user.following) { messages.AddRange((await UserRepo.ReadAsync(follow)).messages); } return(new ContentResult { ContentType = "text/html", StatusCode = Status200OK, Content = BasicTemplater.GenerateTimeline(messages, timelineType.SELF, user) }); }