ElkArte Community

Elk Development => Feature Discussion => Topic started by: Jorin on March 21, 2017, 08:23:29 am

Title: Add a first post to a topic
Post by: Jorin on March 21, 2017, 08:23:29 am
Oh, and another request! Sometimes it is neccessary to post a post (lol) at the first position of a thread, for example when splitting a topic. As Admin or Mod it would be great to have the chance to create a post as first post of a topic anytime.  O:-)
Title: Re: Add a first post to a topic
Post by: emanuele on March 21, 2017, 03:13:43 pm
With the current way sorting posts is implemented, this is rather tricky without rely on... tricks.
The posts (and messages) are sorted by default based on the message/topic id, and these ids are automatically and sequentially assigned by mysql/postgresql when the message/topic is created. So the only way to achieve that would be the way I used for the sticky first message (i.e. another query), but in that case it would likely require at least another column, maybe another table...
Title: Re: Add a first post to a topic
Post by: Jorin on March 21, 2017, 04:13:07 pm
Hm... Does this mean "sorry, much to complicated"?
Title: Re: Add a first post to a topic
Post by: Jorin on August 15, 2017, 05:56:25 am
Second thoughts on this? It seems other software can do this. It would be really helpful when splitting, moving and bring threads together.

Maybe we can use a trick? Give the (new) first post of the thread a date and time before the following? Give it a negative ID (if even possible)? Make it sticky like threads can be?
Title: Re: Add a first post to a topic
Post by: live627 on August 15, 2017, 04:28:40 pm
IDs are signed, so negative is a no go. Not sure what @emanuele has in mind.

One solution I had in mind is to modify id_first_msg to the new message that the moderator made while splitting the topic. I have no idea how this will work. The board and message indexes will be fine I think, but message order (in portal, display template) will get that message appended to the topic.

Or we could duplicate the split topic, delete the first split, and steal one of those for the moderator's note. This will unfortunately leave many gaps in the database ID increment order. But the final display is probably going to be fine... I think messages are sorted by ID and not date...  @Spuds can correct me on this.
Title: Re: Add a first post to a topic
Post by: emanuele on August 15, 2017, 05:08:47 pm
My idea there was very simply not to use tricks with ids/dates and really just have another table with the "first messages" that would go on top of everything else.