From 87d24c6c6435ff03d9e1d11008ca3a05d35d5541 Mon Sep 17 00:00:00 2001 From: Maarten Wolzak Date: Thu, 17 Jan 2019 11:02:13 +0100 Subject: [PATCH 1/2] Fixed PHP-type for quipComment - "body" field --- core/components/quip/model/quip/mysql/quipcomment.map.inc.php | 2 +- core/components/quip/model/quip/sqlsrv/quipcomment.map.inc.php | 2 +- core/components/quip/model/schema/quip.mysql.schema.xml | 2 +- core/components/quip/model/schema/quip.sqlsrv.schema.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/components/quip/model/quip/mysql/quipcomment.map.inc.php b/core/components/quip/model/quip/mysql/quipcomment.map.inc.php index 2bc65f0..f9fa542 100644 --- a/core/components/quip/model/quip/mysql/quipcomment.map.inc.php +++ b/core/components/quip/model/quip/mysql/quipcomment.map.inc.php @@ -90,7 +90,7 @@ 'body' => array ( 'dbtype' => 'text', - 'phptype' => 'text', + 'phptype' => 'string', 'null' => false, 'default' => '', ), diff --git a/core/components/quip/model/quip/sqlsrv/quipcomment.map.inc.php b/core/components/quip/model/quip/sqlsrv/quipcomment.map.inc.php index 5f03f5f..ea36cf8 100644 --- a/core/components/quip/model/quip/sqlsrv/quipcomment.map.inc.php +++ b/core/components/quip/model/quip/sqlsrv/quipcomment.map.inc.php @@ -89,7 +89,7 @@ array ( 'dbtype' => 'nvarchar', 'precision' => 'max', - 'phptype' => 'text', + 'phptype' => 'string', 'null' => false, 'default' => '', ), diff --git a/core/components/quip/model/schema/quip.mysql.schema.xml b/core/components/quip/model/schema/quip.mysql.schema.xml index cdf7f7c..85de8cd 100644 --- a/core/components/quip/model/schema/quip.mysql.schema.xml +++ b/core/components/quip/model/schema/quip.mysql.schema.xml @@ -45,7 +45,7 @@ - + diff --git a/core/components/quip/model/schema/quip.sqlsrv.schema.xml b/core/components/quip/model/schema/quip.sqlsrv.schema.xml index 9b819c1..6edf5b3 100644 --- a/core/components/quip/model/schema/quip.sqlsrv.schema.xml +++ b/core/components/quip/model/schema/quip.sqlsrv.schema.xml @@ -48,7 +48,7 @@ - + From f01de70e4f7b89c7bd2699018cdfd8918934c6ac Mon Sep 17 00:00:00 2001 From: Maarten Wolzak Date: Tue, 5 Mar 2019 14:34:32 +0100 Subject: [PATCH 2/2] Commenter can remove their own comment when not in the moderator group Before this change, you had to be a moderator even if you only wanted to remove your own comment. --- core/components/quip/controllers/web/Thread.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/components/quip/controllers/web/Thread.php b/core/components/quip/controllers/web/Thread.php index a9c253d..dfde4f5 100644 --- a/core/components/quip/controllers/web/Thread.php +++ b/core/components/quip/controllers/web/Thread.php @@ -333,7 +333,12 @@ public function checkPermissions() { public function handleActions() { /* handle remove post */ $removeAction = $this->getProperty('removeAction','quip-remove'); - if (!empty($_REQUEST[$removeAction]) && $this->hasAuth && $this->isModerator) { + + /* handle author remove their own comment even when they are not moderator */ + $currentComment = $this->getComments()[(int)$_REQUEST['quip_comment']]; + + if (!empty($_REQUEST[$removeAction]) && $this->hasAuth && ($this->isModerator + || (!empty($currentComment) && $currentComment->get('author') == $this->modx->user->get('id')))) { $this->removeComment(); } /* handle report spam */ @@ -480,4 +485,4 @@ public function render(array $comments = array()) { return implode("\n",$list); } } -return 'QuipThreadController'; \ No newline at end of file +return 'QuipThreadController';