Skip to content

Commit

Permalink
Merge pull request #10114 from bozana/9736-1
Browse files Browse the repository at this point in the history
#9736 do not consider reviewers for JM setting for masthea…
  • Loading branch information
bozana authored Jun 28, 2024
2 parents bc0e02e + efe83af commit b66865f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
namespace PKP\components\forms\context;

use APP\facades\Repo;
use PKP\components\forms\FieldHTML;
use PKP\components\forms\FieldOptions;
use PKP\components\forms\FormComponent;
use PKP\security\Role;

define('FORM_APPEARANCE_MASTHEAD', 'appearanceMasthead');

Expand Down Expand Up @@ -48,6 +50,7 @@ public function __construct($action, $locales, $context)
$allMastheadUserGroups = $collector
->filterByContextIds([$context->getId()])
->filterByMasthead(true)
->filterExcludeRoles([Role::ROLE_ID_REVIEWER])
->orderBy($collector::ORDERBY_ROLE_ID)
->getMany()
->toArray();
Expand All @@ -69,6 +72,10 @@ public function __construct($action, $locales, $context)
'value' => array_column($mastheadOptions, 'value'),
'options' => $mastheadOptions,
'allowOnlySorting' => true
]));
]))
->addField(new FieldHTML('reviewer', [
'label' => __('user.role.reviewers'),
'description' => __('manager.setup.editorialMasthead.order.reviewers.description')
]));
}
}
15 changes: 15 additions & 0 deletions classes/userGroup/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class Collector implements CollectorInterface

public ?array $roleIds = null;

public ?array $excludeRoles = null;

public ?array $stageIds = null; // getUserGroupsByStage

public ?array $publicationIds = null;
Expand Down Expand Up @@ -131,6 +133,15 @@ public function filterByRoleIds(?array $roleIds): self
return $this;
}

/**
* Exclude roles
*/
public function filterExcludeRoles(?array $excludedRoles): self
{
$this->excludeRoles = $excludedRoles;
return $this;
}

/**
* Filter by contexts
*/
Expand Down Expand Up @@ -301,6 +312,10 @@ public function getQueryBuilder(): Builder
$q->whereIn('ug.role_id', $this->roleIds);
}

if (isset($this->excludeRoles)) {
$q->whereNotIn('ug.role_id', $this->excludeRoles);
}

$q->when($this->isRecommendOnly !== null, function (Builder $q) {
$q->whereIn('ug.user_group_id', function (Builder $q) {
$q->select('user_group_id')
Expand Down
3 changes: 3 additions & 0 deletions locale/en/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -3555,5 +3555,8 @@ msgstr "Require submitting Authors to file a Competing Interest (CI) statement w
msgid "manager.setup.masthead"
msgstr "Masthead"

msgid "manager.setup.editorialMasthead.order.reviewers.description"
msgstr "Reviewers will be displayed in a standardized format to maintain uniformity and ensure easy discoverability in this section."

msgid "mailable.changeProfileEmailInvitationNotify.name"
msgstr "Change Email Address Invitation"
8 changes: 2 additions & 6 deletions pages/about/AboutContextHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function editorialMasthead($args, $request)
$allMastheadUserGroups = $collector
->filterByContextIds([$context->getId()])
->filterByMasthead(true)
->filterExcludeRoles([Role::ROLE_ID_REVIEWER])
->orderBy($collector::ORDERBY_ROLE_ID)
->getMany()
->toArray();
Expand All @@ -87,9 +88,6 @@ public function editorialMasthead($args, $request)

$mastheadUsers = [];
foreach ($mastheadRoles as $mastheadUserGroup) {
if ($mastheadUserGroup->getRoleId() == Role::ROLE_ID_REVIEWER) {
continue;
}
foreach ($allUsersIdsGroupedByUserGroupId[$mastheadUserGroup->getId()] ?? [] as $userId) {
$user = Repo::user()->get($userId);
$userUserGroup = UserUserGroup::withUserId($user->getId())
Expand Down Expand Up @@ -151,6 +149,7 @@ public function editorialHistory($args, $request)
$allMastheadUserGroups = $collector
->filterByContextIds([$context->getId()])
->filterByMasthead(true)
->filterExcludeRoles([Role::ROLE_ID_REVIEWER])
->orderBy($collector::ORDERBY_ROLE_ID)
->getMany()
->toArray();
Expand All @@ -162,9 +161,6 @@ public function editorialHistory($args, $request)

$mastheadUsers = [];
foreach ($mastheadRoles as $mastheadUserGroup) {
if ($mastheadUserGroup->getRoleId() == Role::ROLE_ID_REVIEWER) {
continue;
}
foreach ($allUsersIdsGroupedByUserGroupId[$mastheadUserGroup->getId()] ?? [] as $userId) {
$user = Repo::user()->get($userId);
$userUserGroups = UserUserGroup::withUserId($user->getId())
Expand Down

0 comments on commit b66865f

Please sign in to comment.