Fix activation and deactivation of articles. See also #21.

Strange that the same code has worked before, as the logic for handling the first and last articles of a group/thread was definitely flawed.