diff --git a/src/BirdsiteLive/Component/NodeInfoViewComponent.cs b/src/BirdsiteLive/Component/NodeInfoViewComponent.cs index b51c319..51156c2 100644 --- a/src/BirdsiteLive/Component/NodeInfoViewComponent.cs +++ b/src/BirdsiteLive/Component/NodeInfoViewComponent.cs @@ -2,15 +2,50 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using BirdsiteLive.Domain.Repository; using Microsoft.AspNetCore.Mvc; namespace BirdsiteLive.Component { public class NodeInfoViewComponent : ViewComponent { + private readonly IModerationRepository _moderationRepository; + + #region Ctor + public NodeInfoViewComponent(IModerationRepository moderationRepository) + { + _moderationRepository = moderationRepository; + } + #endregion + public IViewComponentResult Invoke() { - return View(null); + var followerPolicy = _moderationRepository.GetModerationType(ModerationEntityTypeEnum.Follower); + var twitterAccountPolicy = _moderationRepository.GetModerationType(ModerationEntityTypeEnum.TwitterAccount); + + var viewModel = new NodeInfoViewModel + { + BlacklistingEnabled = followerPolicy == ModerationTypeEnum.BlackListing || + twitterAccountPolicy == ModerationTypeEnum.BlackListing, + WhitelistingEnabled = followerPolicy == ModerationTypeEnum.WhiteListing || + twitterAccountPolicy == ModerationTypeEnum.WhiteListing, + InstanceSaturation = 16, + }; + + viewModel = new NodeInfoViewModel + { + BlacklistingEnabled = false, + WhitelistingEnabled = false, + InstanceSaturation = 175 + }; + return View(viewModel); } } + + public class NodeInfoViewModel + { + public bool BlacklistingEnabled { get; set; } + public bool WhitelistingEnabled { get; set; } + public int InstanceSaturation { get; set; } + } } diff --git a/src/BirdsiteLive/Views/Shared/Components/NodeInfo/Default.cshtml b/src/BirdsiteLive/Views/Shared/Components/NodeInfo/Default.cshtml index 60a6be0..a878772 100644 --- a/src/BirdsiteLive/Views/Shared/Components/NodeInfo/Default.cshtml +++ b/src/BirdsiteLive/Views/Shared/Components/NodeInfo/Default.cshtml @@ -1,15 +1,22 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ +@model BirdsiteLive.Component.NodeInfoViewModel