Skip to content

Commit

Permalink
chore: Rename to Blocks
Browse files Browse the repository at this point in the history
Makes more semantic sense to what you’re actually managing
  • Loading branch information
hellopablo committed Aug 1, 2024
1 parent 1e11e34 commit 94f8c8f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* This class manages email subscriptions
* This class manages email blocks
*
* @package Nails
* @subpackage module-email
Expand All @@ -21,16 +21,16 @@
use Nails\Factory;

/**
* Class Subscriptions
* Class Blocks
*
* @package Nails\Admin\Email
*/
class Subscriptions extends DefaultController
class Blocks extends DefaultController
{
const CONFIG_MODEL_NAME = 'UserEmailBlocker';
const CONFIG_MODEL_PROVIDER = Auth\Constants::MODULE_SLUG;
const CONFIG_SIDEBAR_GROUP = 'Email';
const CONFIG_TITLE_SINGLE = 'Subscription';
const CONFIG_TITLE_SINGLE = 'Block';
const CONFIG_INDEX_FIELDS = [
'User' => 'user_id',
'Type' => null,
Expand All @@ -42,7 +42,7 @@ class Subscriptions extends DefaultController
];
const CONFIG_SORT_DIRECTION = self::SORT_DESCENDING;
const CONFIG_CAN_EDIT = false;
const CONFIG_PERMISSION = 'email:subscriptions';
const CONFIG_PERMISSION = 'email:blocks';
const CHANGELOG_ENABLED = false;

// --------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions admin/views/User/tabs/subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
: 'danger';

$actions = array_filter([
userHasPermission('admin:email:subscriptions:delete')
userHasPermission('admin:email:blocks:delete')
? '<span class="js-subscribe-action btn btn-xs btn-success ' . ($subscribed ? 'hidden' : '') . '" data-action="subscribe">Subscribe</span>'
: null,
userHasPermission('admin:email:subscriptions:create')
userHasPermission('admin:email:blocks:create')
? '<span class="js-subscribe-action btn btn-xs btn-danger ' . ($subscribed ? '' : 'hidden') . '" data-action="unsubscribe" style="margin-top:0;">Unsubscribe</span>'
: null,
]);
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Controller/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Admin extends Base
*/
public function putSubscribe(): ApiResponse
{
if (!userHasPermission('admin:email:subscriptions:delete')) {
if (!userHasPermission('admin:email:blocks:delete')) {

Check failure on line 31 in src/Api/Controller/Admin.php

View workflow job for this annotation

GitHub Actions / build_and_test

Function userHasPermission not found.
throw new Api\Exception\ApiException(
'Ypu do not have permission to subscribe a user',
HttpCodes::STATUS_UNAUTHORIZED
Expand Down Expand Up @@ -62,7 +62,7 @@ public function putSubscribe(): ApiResponse
*/
public function putUnsubscribe(): ApiResponse
{
if (!userHasPermission('admin:email:subscriptions:create')) {
if (!userHasPermission('admin:email:blocks:create')) {

Check failure on line 65 in src/Api/Controller/Admin.php

View workflow job for this annotation

GitHub Actions / build_and_test

Function userHasPermission not found.
throw new Api\Exception\ApiException(
'Ypu do not have permission to unsubscribe a user',
HttpCodes::STATUS_UNAUTHORIZED
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/Admin/User/Tab/Subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getLabel(): string

public static function isEnabled(User $user): bool
{
return userHasPermission('admin:email:subscriptions:browse');
return userHasPermission('admin:email:blocks:browse');

Check failure on line 36 in src/Auth/Admin/User/Tab/Subscriptions.php

View workflow job for this annotation

GitHub Actions / build_and_test

Function userHasPermission not found.
}

// --------------------------------------------------------------------------
Expand Down

0 comments on commit 94f8c8f

Please sign in to comment.