mirror of
https://github.com/fsolla/teqo.git
synced 2026-12-01 12:03:06 +00:00
refactor(C96): flatten advisor scope intersection in buildFeedWhere
Simplify reviewer: the duplicated scope fragment push after the filter branch is flattened into a single standalone guard, preserving exact semantics across all four corners (filter set/unset × scope null/non-null).
This commit is contained in:
parent
5b342146d5
commit
313e0ed0c8
1 changed files with 7 additions and 9 deletions
|
|
@ -107,15 +107,13 @@ const buildFeedWhere = (
|
||||||
? feed.filterMunicipality
|
? feed.filterMunicipality
|
||||||
: feed.filterMunicipality.id
|
: feed.filterMunicipality.id
|
||||||
filters.push({ municipality: { equals: municipalityId } })
|
filters.push({ municipality: { equals: municipalityId } })
|
||||||
// Defense in depth (C96): an advisor's feed is intersected with the
|
}
|
||||||
// municipality ids the creator currently administers, so a feed pinned to a
|
// Defense in depth (C96): an advisor's feed is intersected with the
|
||||||
// municipality the advisor was removed from stops serving it — the creator's
|
// municipality ids the creator currently administers, so a feed (pinned or
|
||||||
// read scope is re-derived on every request (resolveFeedCreatorAccess), never
|
// not) stops serving a municipality the advisor was removed from. The creator's
|
||||||
// trusted from write time. `null` = coordinator/candidate/admin (unrestricted).
|
// read scope is re-derived on every request — never trusted from write time.
|
||||||
if (accessibleMunicipalityIds) {
|
// `null` = coordinator/candidate/admin (unrestricted).
|
||||||
filters.push(advisorMunicipalityScopeWhere('municipality', accessibleMunicipalityIds))
|
if (accessibleMunicipalityIds) {
|
||||||
}
|
|
||||||
} else if (accessibleMunicipalityIds) {
|
|
||||||
filters.push(advisorMunicipalityScopeWhere('municipality', accessibleMunicipalityIds))
|
filters.push(advisorMunicipalityScopeWhere('municipality', accessibleMunicipalityIds))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue