summaryrefslogtreecommitdiff
path: root/app/Helper/CommentHelper.php
blob: d6426d1a57aedd4199724c3bf3ebdc3c6a060223 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

namespace Kanboard\Helper;

use Kanboard\Core\Base;
use Kanboard\Model\UserMetadataModel;

/**
 * Class CommentHelper
 *
 * @package Kanboard\Helper
 * @author  Frederic Guillot
 */
class CommentHelper extends Base
{
    public function toggleSorting()
    {
        $oldDirection = $this->userMetadataCacheDecorator->get(UserMetadataModel::KEY_COMMENT_SORTING_DIRECTION, 'ASC');
        $newDirection = $oldDirection === 'ASC' ? 'DESC' : 'ASC';

        $this->userMetadataCacheDecorator->set(UserMetadataModel::KEY_COMMENT_SORTING_DIRECTION, $newDirection);
    }
}