MDL-50993 forum: Display timed posts/discussions in a logical order
authorAdam Olley <adam.olley@netspot.com.au>
Wed, 16 Sep 2015 06:42:21 +0000 (16:12 +0930)
committerRyan Wyllie <ryan@moodle.com>
Mon, 19 Oct 2015 04:04:58 +0000 (04:04 +0000)
commit1e36665719ccd28e214f39fda2c4a7c3967e49b8
treefa9a0eee66a5623958c7924d4b3a0cb62a509c30
parent1b7bf435625a81a78e2904a86d3bcaa0dc80a193
MDL-50993 forum: Display timed posts/discussions in a logical order

Users that don't have permission to view timed posts outside of the release
time frame will have discussions that have entered the visible frame appear
in an odd order from their point of view on the discussion list.

Example:
Discussion 1, modified 2015-01-01, hidden till 2015-01-03
Discussion 2, modified 2015-01-02, not hidden

The standard 'modified descending' order means that D2 is listed at the top
even after D1 becomes visible. When scanning the list of discussions for new
posts, the user could be tricked into thinking they'd already read it.

This fix instead takes into account the release time of the discussion when
timed forum posts are enabled.

I opted to use CASE statements to handle this instead of GREATEST as the
latter is not supported by MSSQL.
blocks/news_items/block_news_items.php
mod/forum/lib.php
mod/forum/tests/lib_test.php