Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions core/components/quip/controllers/web/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -480,4 +485,4 @@ public function render(array $comments = array()) {
return implode("\n",$list);
}
}
return 'QuipThreadController';
return 'QuipThreadController';
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
'body' =>
array (
'dbtype' => 'text',
'phptype' => 'text',
'phptype' => 'string',
'null' => false,
'default' => '',
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
array (
'dbtype' => 'nvarchar',
'precision' => 'max',
'phptype' => 'text',
'phptype' => 'string',
'null' => false,
'default' => '',
),
Expand Down
2 changes: 1 addition & 1 deletion core/components/quip/model/schema/quip.mysql.schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<field key="rank" dbtype="tinytext" phptype="string" />

<field key="author" dbtype="integer" precision="10" phptype="integer" attributes="unsigned" null="false" default="0" index="index" />
<field key="body" dbtype="text" phptype="text" null="false" default="" />
<field key="body" dbtype="text" phptype="string" null="false" default="" />
<field key="createdon" dbtype="datetime" phptype="datetime" null="true" />
<field key="editedon" dbtype="datetime" phptype="datetime" null="true" />
<field key="approved" dbtype="tinyint" precision="1" phptype="boolean" attributes="unsigned" null="false" default="1" index="index" />
Expand Down
2 changes: 1 addition & 1 deletion core/components/quip/model/schema/quip.sqlsrv.schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<field key="rank" dbtype="nvarchar" precision="512" phptype="string" />

<field key="author" dbtype="integer" phptype="integer" null="false" default="0" index="index" />
<field key="body" dbtype="nvarchar" precision="max" phptype="text" null="false" default="" />
<field key="body" dbtype="nvarchar" precision="max" phptype="string" null="false" default="" />
<field key="createdon" dbtype="datetime" phptype="datetime" null="true" />
<field key="editedon" dbtype="datetime" phptype="datetime" null="true" />
<field key="approved" dbtype="bit" phptype="boolean" null="false" default="1" index="index" />
Expand Down