Enhance worship filtering logic: Introduce legacy neighborhood configuration handling in WorshipRender component, allowing for backward compatibility with existing location parameters while ensuring neighborInvitation is set correctly for neighborhood pages.
This commit is contained in:
@@ -95,12 +95,29 @@ export default {
|
||||
const params = { ...(this.config || {}) };
|
||||
const currentPath = String(this.$route?.path || '').toLowerCase();
|
||||
const isNeighborhoodPage = currentPath.includes('/worship/neighborhood') || currentPath.includes('/worship/neighbor');
|
||||
const isLegacyNeighborhoodConfig = (() => {
|
||||
if (!params.location) return false;
|
||||
try {
|
||||
const list = Array.isArray(params.location) ? params.location : JSON.parse(params.location);
|
||||
if (!Array.isArray(list)) return false;
|
||||
const normalized = list.map((x) => Number(x)).sort((a, b) => a - b);
|
||||
return normalized.length === 3 && normalized[0] === 13 && normalized[1] === 14 && normalized[2] === 15;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
})();
|
||||
if (isNeighborhoodPage) {
|
||||
// Für die Nachbarschaftsseite ist das Flag maßgeblich;
|
||||
// ein evtl. gesetzter Ortsfilter darf hier nicht blockieren.
|
||||
params.neighborInvitation = true;
|
||||
delete params.location;
|
||||
}
|
||||
if (isLegacyNeighborhoodConfig) {
|
||||
// Abwärtskompatibel für bestehende Seitenkonfigurationen in Inhalten/DB:
|
||||
// location [13,14,15] bedeutete historisch "Nachbarschaftsraum".
|
||||
params.neighborInvitation = true;
|
||||
delete params.location;
|
||||
}
|
||||
const response = await axios.get('/worships/filtered', {
|
||||
params
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user