API question - check if myself replied to a thread
Hi,
I have been researching this for a long time, and still cannot figure it out.
Is there a api to determine is myself(logged in) replied to a thread?
Cases:
1. If I create a topic, and there is no replies, this api should return false
2. If someone else creates a topic, and I reply to it, this api should return true
3. If I create a topic, and myself reply to it, this api should return true
Current workaround: I have to pull all messages out from a thread, and loop through them to find out if I did a reply. This works most of the time, but performance is bad. And if a thread has more than 100 messages, then very very bad.
I have also tried this API
But it is not working for my case #1.
Lithium has built-in components that get this working, eg. In the message list, the icon bubble image file name has "replied" in it. So I was wondering how Lithium is doing it.
Peter
peterlu wrote:Anyone knows how to make this query in v2?
Hey peterlu , I think you'll get what you need from
SELECT * FROM messages WHERE author.id='1' AND parent.id = '123' LIMIT 1
So if you get any data in that they've replied, if not it'll error out.
Catch the error and do nothing or run the alternate code block.
I've got big plans for what we can do with a thread if you've replied to it or not. :D