Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ilestis committed Jul 15, 2024
2 parents 98a1a19 + 9e8bd34 commit b6b2c6f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions app/Models/Character.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,11 @@ public function scopeMember(Builder $query, string|null $value, FilterOption $fi
if (auth()->guest() || !auth()->user()->isAdmin()) {
$query->where('memb.is_private', 0);
}

return $query;
} elseif ($filter === FilterOption::EXCLUDE) {
return $query
->whereRaw('(select count(*) from organisation_member as memb where memb.character_id = ' .
$this->getTable() . '.id and memb.character_id = ' . ((int) $value) . ' and ' . $this->subPrivacy('memb.is_private') . ') = 0');
$this->getTable() . '.id and memb.character_id = ' . ((int) $value) . ' ' . $this->subPrivacy('and memb.is_private') . ') = 0');
}

$ids = [$value];
Expand Down
4 changes: 2 additions & 2 deletions app/Models/Concerns/HasFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ protected function filterFamily(Builder $query, string $value = null): void
if ($this->filterOption('exclude')) {
$query->whereRaw('(select count(*) from character_family as cf where cf.character_id = ' .
$this->getTable() . '.id and cf.family_id = ' . ((int) $value)
. ' and ' . $this->subPrivacy('cf.is_private') . ') = 0');
. ' ' . $this->subPrivacy('and cf.is_private') . ') = 0');
return;

} elseif ($this->filterOption('children')) {
Expand Down Expand Up @@ -704,6 +704,6 @@ protected function subPrivacy(string $field): string|null
return null;
}

return $field . ' = 0';
return ' ' . $field . ' = 0';
}
}
2 changes: 1 addition & 1 deletion app/Models/Family.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function scopeMember(Builder $query, string|null $value, FilterOption $fi
} elseif ($filter === FilterOption::EXCLUDE) {
return $query
->whereRaw('(select count(*) from character_family as memb where memb.family_id = ' .
$this->getTable() . '.id and memb.family_id = ' . ((int) $value) . ' and ' . $this->subPrivacy('memb.is_private') . ') = 0');
$this->getTable() . '.id and memb.family_id = ' . ((int) $value) . ' ' . $this->subPrivacy('and memb.is_private') . ') = 0');
}

$ids = [$value];
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Organisation.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function scopeMember(Builder $query, string|null $value, FilterOption $fi
} elseif ($filter === FilterOption::EXCLUDE) {
return $query
->whereRaw('(select count(*) from organisation_member as memb where memb.organisation_id = ' .
$this->getTable() . '.id and memb.character_id = ' . ((int) $value) . ' and ' . $this->subPrivacy('memb.is_private') . ') = 0');
$this->getTable() . '.id and memb.character_id = ' . ((int) $value) . ' ' . $this->subPrivacy('and memb.is_private') . ') = 0');
}
$ids = [$value];

Expand Down

0 comments on commit b6b2c6f

Please sign in to comment.