Skip to content

Commit

Permalink
Check Team edition instead of Pro
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Aug 12, 2024
1 parent a5e2f81 commit ebb8af6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
9 changes: 5 additions & 4 deletions src/Campaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use craft\console\controllers\ResaveController;
use craft\controllers\PreviewController;
use craft\elements\User;
use craft\enums\CmsEdition;
use craft\events\DefineConsoleActionsEvent;
use craft\events\DefineFieldLayoutFieldsEvent;
use craft\events\PluginEvent;
Expand Down Expand Up @@ -236,8 +237,8 @@ public function init(): void
$this->registerWidgets();
}

// If Craft edition is pro
if (Craft::$app->getEdition() === Craft::Pro) {
// If Craft edition is at least Team
if (Craft::$app->edition >= CmsEdition::Team) {

Check failure on line 241 in src/Campaign.php

View workflow job for this annotation

GitHub Actions / PHPStan

Comparison operation ">=" between craft\enums\CmsEdition and craft\enums\CmsEdition::Team is always false.
$this->registerUserPermissions();
$this->sync->registerUserEvents();
}
Expand Down Expand Up @@ -297,15 +298,15 @@ public function getSettingsResponse(): Response
}

/**
* Returns true if pro version.
* Returns true if Pro version.
*/
public function getIsPro(): bool
{
return $this->is(self::EDITION_PRO);
}

/**
* Throws an exception if the plugin edition is not pro.
* Throws an exception if the plugin edition is not Pro.
*/
public function requirePro(): void
{
Expand Down
1 change: 0 additions & 1 deletion src/controllers/SegmentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class SegmentsController extends Controller
*/
public function beforeAction($action): bool
{
// Require pro
Campaign::$plugin->requirePro();

return parent::beforeAction($action);
Expand Down
1 change: 0 additions & 1 deletion src/controllers/SyncController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class SyncController extends Controller
*/
public function beforeAction($action): bool
{
// Require pro
Campaign::$plugin->requirePro();

// Require permission
Expand Down
4 changes: 2 additions & 2 deletions src/elements/SendoutElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ protected static function defineTableAttributes(): array
'lastSent' => ['label' => Craft::t('campaign', 'Last Sent')],
]);

// Hide sender if not Craft Pro edition
if (Craft::$app->edition !== CmsEdition::Pro) {
// Hide sender if not at least Craft Team edition
if (Craft::$app->edition < CmsEdition::Team) {
unset($attributes['sender']);
}

Expand Down
2 changes: 1 addition & 1 deletion src/services/ReportsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ private function getActivity(array $models, string $interaction = null, int $lim
$contactActivityModel->sourceUrl = UrlHelper::cpUrl('campaign/contacts/import/' . $model->source);
break;
case 'user':
$path = (Craft::$app->edition !== CmsEdition::Solo && $model->source) ? 'users/' . $model->source : 'myaccount';
$path = (Craft::$app->edition >= CmsEdition::Team && $model->source) ? 'users/' . $model->source : 'myaccount';

Check failure on line 741 in src/services/ReportsService.php

View workflow job for this annotation

GitHub Actions / PHPStan

Comparison operation ">=" between craft\enums\CmsEdition and craft\enums\CmsEdition::Team is always false.

Check failure on line 741 in src/services/ReportsService.php

View workflow job for this annotation

GitHub Actions / PHPStan

Result of && is always false.
$contactActivityModel->sourceUrl = UrlHelper::cpUrl($path);
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion src/variables/CampaignVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getIsPro(): bool
}

/**
* Throws an exception if the plugin edition is not pro.
* Throws an exception if the plugin edition is not Pro.
*/
public function requirePro(): void
{
Expand Down

0 comments on commit ebb8af6

Please sign in to comment.