diff --git a/assets/less/classes/forum/topic.less b/assets/less/classes/forum/topic.less index 78889872..afc26a16 100644 --- a/assets/less/classes/forum/topic.less +++ b/assets/less/classes/forum/topic.less @@ -71,11 +71,23 @@ display: flex; justify-content: center; align-items: center; - padding-bottom: 1px; // fixes centering + padding: 1px 1px 0 2px; &--unread { background-color: var(--accent-colour); } + + &__participated { + position: absolute; + bottom: 2px; + right: 2px; + width: 4px; + height: 4px; + background-color: #fff; + border-radius: 100%; + box-shadow: 0 1px 2px #111; + pointer-events: initial; + } } &__details { diff --git a/src/Forum/topic.php b/src/Forum/topic.php index 93efa105..3528e788 100644 --- a/src/Forum/topic.php +++ b/src/Forum/topic.php @@ -184,7 +184,14 @@ function forum_topic_listing(int $forumId, int $userId, int $offset = 0, int $ta AND tt.`user_id` = `target_user_id` AND `track_last_read` >= `topic_bumped` ) - ) AS `topic_unread` + ) AS `topic_unread`, + ( + SELECT COUNT(`post_id`) > 0 + FROM `msz_forum_posts` + WHERE `topic_id` = t.`topic_id` + AND `user_id` = `target_user_id` + LIMIT 1 + ) AS `topic_participated` FROM `msz_forum_topics` AS t LEFT JOIN `msz_users` AS au ON t.`user_id` = au.`user_id` diff --git a/templates/forum/macros.twig b/templates/forum/macros.twig index 5e16c44f..739147e1 100644 --- a/templates/forum/macros.twig +++ b/templates/forum/macros.twig @@ -130,7 +130,7 @@
- +
@@ -252,7 +252,7 @@ {% macro forum_topic_entry(topic, topic_type, topic_unread) %} {% set topic_type = topic_type|default(null) %} - {% set topic_unread = topic_unread|default(topic.topic_unread|default(false)) ? 'unread' : 'read' %} + {% set topic_unread = topic_unread|default(topic.topic_unread|default(false)) %} {% set topic_important = topic.topic_type == constant('MSZ_TOPIC_TYPE_STICKY') or topic.topic_type == constant('MSZ_TOPIC_TYPE_ANNOUNCEMENT') or topic.topic_type == constant('MSZ_TOPIC_TYPE_GLOBAL_ANNOUNCEMENT') %} {% if topic_type is null %} @@ -267,7 +267,7 @@ {% elseif topic.topic_locked is defined and topic.topic_locked is not null %} {% set topic_type = 'fas fa-lock' %} {% else %} - {% set topic_type = 'fas fa-comment' %} + {% set topic_type = (topic_unread ? 'fas' : 'far') ~ ' fa-comment' %} {% endif %} {% endif %} @@ -275,8 +275,12 @@
-
- +
+ + + {% if topic.topic_participated %} +
+ {% endif %}