diff options
author | Lev Lazinskiy <lev@levlaz.org> | 2017-01-22 09:39:30 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2017-01-22 12:39:30 -0500 |
commit | 8e18c39db9dbb0d91e28006b972dbe331e6500b4 (patch) | |
tree | 5a2f6bb37d355aafcf48f635b91b543d326d2686 /app/Model | |
parent | 67aca3c664dfe4a7616781216e868f9477f4963f (diff) |
Add date_modification to comments (PR #2950)
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/CommentModel.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/Model/CommentModel.php b/app/Model/CommentModel.php index a9e48bd3..e44a5ecd 100644 --- a/app/Model/CommentModel.php +++ b/app/Model/CommentModel.php @@ -60,6 +60,7 @@ class CommentModel extends Base ->columns( self::TABLE.'.id', self::TABLE.'.date_creation', + self::TABLE.'.date_modification', self::TABLE.'.task_id', self::TABLE.'.user_id', self::TABLE.'.comment', @@ -69,7 +70,7 @@ class CommentModel extends Base UserModel::TABLE.'.avatar_path' ) ->join(UserModel::TABLE, 'id', 'user_id') - ->orderBy(self::TABLE.'.date_creation', $sorting) + ->orderBy(self::TABLE.'.date_modification', $sorting) ->eq(self::TABLE.'.task_id', $task_id) ->findAll(); } @@ -90,6 +91,7 @@ class CommentModel extends Base self::TABLE.'.task_id', self::TABLE.'.user_id', self::TABLE.'.date_creation', + self::TABLE.'.date_modification', self::TABLE.'.comment', self::TABLE.'.reference', UserModel::TABLE.'.username', @@ -127,6 +129,7 @@ class CommentModel extends Base public function create(array $values) { $values['date_creation'] = time(); + $values['date_modification'] = time(); $comment_id = $this->db->table(self::TABLE)->persist($values); if ($comment_id !== false) { @@ -148,7 +151,7 @@ class CommentModel extends Base $result = $this->db ->table(self::TABLE) ->eq('id', $values['id']) - ->update(array('comment' => $values['comment'])); + ->update(array('comment' => $values['comment'], 'date_modification' => time())); if ($result) { $this->queueManager->push($this->commentEventJob->withParams($values['id'], self::EVENT_UPDATE)); |