Skip to content

Commit

Permalink
Remove no-more used conversation fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati committed Nov 22, 2023
1 parent 00cefc1 commit 40cbef3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 34 deletions.
10 changes: 0 additions & 10 deletions concrete/blocks/core_conversation/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,6 @@ class Controller extends BlockController implements UsesFeatureInterface
*/
public $customDateFormat;

/**
* @var int|null
*/
public $maxFilesRegistered;

/**
* @var int|null
*/
public $maxFilesGuest;

/**
* @var int
*/
Expand Down
20 changes: 0 additions & 20 deletions concrete/config/install/packages/elemental_full/content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,6 @@
<addMessageLabel><![CDATA[Add Message]]></addMessageLabel>
<dateFormat><![CDATA[default]]></dateFormat>
<customDateFormat><![CDATA[]]></customDateFormat>
<maxFilesGuest><![CDATA[0]]></maxFilesGuest>
<maxFilesRegistered><![CDATA[0]]></maxFilesRegistered>
<maxFileSizeGuest><![CDATA[0]]></maxFileSizeGuest>
<maxFileSizeRegistered><![CDATA[0]]></maxFileSizeRegistered>
<fileExtensions><![CDATA[]]></fileExtensions>
</record>
</data>
</block>
Expand Down Expand Up @@ -2263,11 +2258,6 @@
<addMessageLabel><![CDATA[Add Message]]></addMessageLabel>
<dateFormat><![CDATA[default]]></dateFormat>
<customDateFormat><![CDATA[]]></customDateFormat>
<maxFilesGuest><![CDATA[0]]></maxFilesGuest>
<maxFilesRegistered><![CDATA[0]]></maxFilesRegistered>
<maxFileSizeGuest><![CDATA[0]]></maxFileSizeGuest>
<maxFileSizeRegistered><![CDATA[0]]></maxFileSizeRegistered>
<fileExtensions><![CDATA[]]></fileExtensions>
</record>
</data>
</block>
Expand Down Expand Up @@ -2334,11 +2324,6 @@
<addMessageLabel><![CDATA[Add Message]]></addMessageLabel>
<dateFormat><![CDATA[default]]></dateFormat>
<customDateFormat><![CDATA[]]></customDateFormat>
<maxFilesGuest><![CDATA[0]]></maxFilesGuest>
<maxFilesRegistered><![CDATA[0]]></maxFilesRegistered>
<maxFileSizeGuest><![CDATA[0]]></maxFileSizeGuest>
<maxFileSizeRegistered><![CDATA[0]]></maxFileSizeRegistered>
<fileExtensions><![CDATA[]]></fileExtensions>
</record>
</data>
</block>
Expand Down Expand Up @@ -2405,11 +2390,6 @@
<addMessageLabel><![CDATA[Add Message]]></addMessageLabel>
<dateFormat><![CDATA[default]]></dateFormat>
<customDateFormat><![CDATA[]]></customDateFormat>
<maxFilesGuest><![CDATA[0]]></maxFilesGuest>
<maxFilesRegistered><![CDATA[0]]></maxFilesRegistered>
<maxFileSizeGuest><![CDATA[0]]></maxFileSizeGuest>
<maxFileSizeRegistered><![CDATA[0]]></maxFileSizeRegistered>
<fileExtensions><![CDATA[]]></fileExtensions>
</record>
</data>
</block>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ protected function getAttachments(Message $message, ArrayAccess $errors): array
return [];
}
$attachments = [];
$pp = new Checker($message->getConversationObject());
if (!$pp->canAddConversationMessageAttachments()) {
$conversation = $message->getConversationObject();
$pp = new Checker($conversation);
if (!$conversation || !$pp->canAddConversationMessageAttachments()) {
$errors[] = t('You do not have permission to add attachments.');
} else {
$blockController = $this->getBlockController();
$u = $this->app->make(User::class);
$maxFiles = $u->isRegistered() ? $blockController->maxFilesRegistered : $blockController->maxFilesGuest;
$maxFiles = $u->isRegistered() ? $conversation->getConversationMaxFilesRegistered() : $conversation->getConversationMaxFilesGuest();
$messageAttachmentCount = count($message->getAttachments($message->getConversationMessageID()));
$totalCurrentAttachments = $messageAttachmentCount + count($attachmentIDs);
if ($maxFiles > 0 && $totalCurrentAttachments > $maxFiles) {
Expand Down

0 comments on commit 40cbef3

Please sign in to comment.