Forum Discussion
I don't see any direct API to do this, but this is all buildable indirectly using, for example, the User and Messages APIs. For example, let's say you want to determine if a thread is "hot". First, get the value of the layout.messages_per_thread_hot setting using the REST Settings API. Then, if the number of messages in a given thread are greater or equal to that number, then you know the thread is hot.
<#assign hot_threshold = restadmin("/settings/name/layout.messages_per_thread_hot").value /> <#assign thread = rest("/threads/id/${myId}").thread /> <#if (thread.messages.count >= hot_threshold)> <font style="color: #FF0000;">HOT!</font> </#if>
For new content, you want to use the "read" count method of the Messages API. Compare that to the total number of messages in the thread. You know there is unread content if the two numbers are not the same.
<#assign thread = rest("/threads/id/${myId}").thread /> <#assign read_count = rest("/threads/id/${myId}/messages/read/count").value /> <#if (thread.messages.count > read_count)> <p>Thread has ${thread.messages.count - read_count} unread messages.</p> </#if>
For replies, it's a bit more involved, but you can get a list of replies the user has made using the /users/id/${user.id?c}/replies/get/messages API. Then, for each message in the thread, see if that message ID is found in the list of user replies. There may be an easier way here, but I haven't found a way to do an O(1) lookup of a message ID in the list of user replies.
For locked, I'm not sure. Maybe the read_only property of the thread message is reflective of that state? We don't use the locked state, so I cannot comment.
Related Content
- 6 months ago
- 23 days ago
- 2 years ago
- 8 years ago