👔 Make listing on the hosted page shows article only

This commit is contained in:
2025-11-22 17:50:19 +08:00
parent ec21a94921
commit 8ccf8100d4

View File

@@ -2,6 +2,7 @@ using DysonNetwork.Shared.Models;
using DysonNetwork.Shared.Proto; using DysonNetwork.Shared.Proto;
using DysonNetwork.Shared.Registry; using DysonNetwork.Shared.Registry;
using DysonNetwork.Zone.Publication; using DysonNetwork.Zone.Publication;
using Microsoft.AspNetCore.Mvc;
// Add this using statement // Add this using statement
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using PostType = DysonNetwork.Shared.Models.PostType; using PostType = DysonNetwork.Shared.Models.PostType;
@@ -14,6 +15,8 @@ public class PostsModel(
MarkdownConverter markdownConverter MarkdownConverter markdownConverter
) : PageModel ) : PageModel
{ {
[FromQuery] public bool ShowAll { get; set; } = false;
public SnPublicationSite? Site { get; set; } public SnPublicationSite? Site { get; set; }
public SnPublisher? Publisher { get; set; } public SnPublisher? Publisher { get; set; }
public List<SnPost> Posts { get; set; } = []; public List<SnPost> Posts { get; set; } = [];
@@ -39,6 +42,8 @@ public class PostsModel(
PublisherId = Site!.PublisherId.ToString() PublisherId = Site!.PublisherId.ToString()
}; };
if (!ShowAll) request.Types_.Add(DysonNetwork.Shared.Proto.PostType.Article);
var response = await postClient.ListPostsAsync(request); var response = await postClient.ListPostsAsync(request);
if (response?.Posts != null) if (response?.Posts != null)