Added participation indicator to topics.

This commit is contained in:
flash 2019-01-18 16:55:48 +01:00
parent 0fcb7bc4dd
commit 79ea1303fe
3 changed files with 30 additions and 7 deletions

View file

@ -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 {

View file

@ -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`

View file

@ -130,7 +130,7 @@
<div class="forum__category__container">
<div class="forum__category__icon forum__category__icon--{{ forum_unread }}">
<i class="{{ forum_type }}"></i>
<i class="{{ forum_type }} fa-fw"></i>
</div>
<div class="forum__category__details">
@ -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 @@
<a href="/forum/topic.php?t={{ topic.topic_id }}" class="forum__topic__link"></a>
<div class="forum__topic__container">
<div class="forum__topic__icon forum__topic__icon--{{ topic_unread }}">
<i class="{{ topic_type }}"></i>
<div class="forum__topic__icon forum__topic__icon--{{ topic_unread ? 'unread' : 'read' }}">
<i class="{{ topic_type }} fa-fw"></i>
{% if topic.topic_participated %}
<div class="forum__topic__icon__participated" title="You have posted in this topic"></div>
{% endif %}
</div>
<div class="forum__topic__details">