Skip to content

Commit

Permalink
reduce activity topic dictionary lookups (#1800)
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterjun3 authored Mar 24, 2024
1 parent f735db8 commit b97c5d5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions TASVideos/Pages/Forum/Subforum/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@
<span condition="@(topic.Type == ForumTopicType.Announcement)" class="fw-bold text-warning"><i class="fa fa-bullhorn"></i> Announcement: </span>
<span condition="@(topic.Type == ForumTopicType.Sticky)" class="fw-bold text-info"><i class="fa fa-sticky-note"></i> Sticky: </span>
<span condition="@topic.IsLocked" class="text-danger"><i class="fa fa-lock"></i></span>
<a condition="@(Model.ActivityTopics.ContainsKey(topic.Id))" class="text-decoration-none">
<i class="fa fa-file activity-topic d-none"
data-topic-id="@topic.Id"
data-activity-posts-created="@Model.ActivityTopics[topic.Id].PostsCreated"
data-activity-posts-edited="@Model.ActivityTopics[topic.Id].PostsEdited"></i>
</a>
@if (Model.ActivityTopics.TryGetValue(topic.Id, out var activityTopics))
{
<a class="text-decoration-none">
<i class="fa fa-file activity-topic d-none"
data-topic-id="@topic.Id"
data-activity-posts-created="@activityTopics.PostsCreated"
data-activity-posts-edited="@activityTopics.PostsEdited"></i>
</a>
}
<a asp-page="/Forum/Topics/Index" asp-route-id="@topic.Id" class="fw-bold">@topic.Title</a>
<div class="ms-2">
@{
Expand Down

0 comments on commit b97c5d5

Please sign in to comment.