optimize logic

这个提交包含在:
WaitSpring 2024-04-17 20:22:36 +08:00
父节点 92187a26ac
当前提交 bdb6cc028d
共有 1 个文件被更改,包括 34 次插入14 次删除

查看文件

@ -219,15 +219,25 @@ class PermissionsHook implements
// Adjust user groups // Adjust user groups
if ($rnrsHashVerified) { if ($rnrsHashVerified) {
// If hash verified, and not in the confirmed group, add to confirmed group // If hash verified, and not in the confirmed group,
if ($rnrsEnabledConfirmedGroup && !$rnrsInConfirmedGroup) { // add to confirmed group
$this->addGroup($user, $this->config->get('RNRSConfirmedGroup')); if (!$rnrsInConfirmedGroup) {
$rnrsInConfirmedGroup = true; if ($rnrsEnabledConfirmedGroup) {
$this->addGroup($user, $this->config->get('RNRSConfirmedGroup'));
$rnrsInConfirmedGroup = true;
} else if ($rnrsEnabledExemptGroup) {
$this->addGroup($user, $this->config->get('RNRSConfirmedGroup'));
$rnrsInConfirmedGroup = true;
}
} }
} else if ($rnrsInExemptGroup || $rnrsInOtherExemptedGroups) { } else if ($rnrsInExemptGroup || $rnrsInOtherExemptedGroups) {
if ($rnrsEnabledConfirmedGroup && !$rnrsInConfirmedGroup) { // If verify exempted, hash not verified, but in the confirmed group,
$this->removeGroup($user, $this->config->get('RNRSConfirmedGroup')); // remove from confirmed group
$rnrsInConfirmedGroup = false; if ($rnrsInConfirmedGroup) {
if ($rnrsEnabledConfirmedGroup) {
$this->removeGroup($user, $this->config->get('RNRSConfirmedGroup'));
$rnrsInConfirmedGroup = false;
}
} }
} }
@ -291,15 +301,25 @@ class PermissionsHook implements
// Adjust user groups // Adjust user groups
if ($rnrsHashVerified) { if ($rnrsHashVerified) {
// If hash verified, and not in the confirmed group, add to confirmed group // If hash verified, and not in the confirmed group,
if ($rnrsEnabledConfirmedGroup && !$rnrsInConfirmedGroup) { // add to confirmed group
$this->addGroup($user, $this->config->get('RNRSConfirmedGroup')); if (!$rnrsInConfirmedGroup) {
$rnrsInConfirmedGroup = true; if ($rnrsEnabledConfirmedGroup) {
$this->addGroup($user, $this->config->get('RNRSConfirmedGroup'));
$rnrsInConfirmedGroup = true;
} else if ($rnrsEnabledExemptGroup) {
$this->addGroup($user, $this->config->get('RNRSConfirmedGroup'));
$rnrsInConfirmedGroup = true;
}
} }
} else if ($rnrsInExemptGroup || $rnrsInOtherExemptedGroups) { } else if ($rnrsInExemptGroup || $rnrsInOtherExemptedGroups) {
if ($rnrsEnabledConfirmedGroup && !$rnrsInConfirmedGroup) { // If verify exempted, hash not verified, but in the confirmed group,
$this->removeGroup($user, $this->config->get('RNRSConfirmedGroup')); // remove from confirmed group
$rnrsInConfirmedGroup = false; if ($rnrsInConfirmedGroup) {
if ($rnrsEnabledConfirmedGroup) {
$this->removeGroup($user, $this->config->get('RNRSConfirmedGroup'));
$rnrsInConfirmedGroup = false;
}
} }
} }