Skip to content

Commit e52d819

Browse files
authored
Merge pull request #294 from WatWowMap/raid-only-permission
Support raid-only permission
2 parents 77ad374 + 86ffc42 commit e52d819

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/data/map.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ const getPokemon = async (minLat, maxLat, minLon, maxLon, showPVP, showIV, updat
220220
return pokemon;
221221
};
222222

223-
const getGyms = async (minLat, maxLat, minLon, maxLon, updated = 0, showRaids = false, showGyms = true, raidFilterExclude = null, gymFilterExclude = null) => {
223+
const getGyms = async (minLat, maxLat, minLon, maxLon, updated = 0, showRaids = false, showGyms = true, permGymDetails = true, raidFilterExclude = null, gymFilterExclude = null) => {
224224
let excludedLevels = []; //int
225225
let excludeAllButEx = false;
226226
let excludeAllButBattles = false;
@@ -419,7 +419,7 @@ const getGyms = async (minLat, maxLat, minLon, maxLon, updated = 0, showRaids =
419419
lon: result.lon,
420420
name: result.name,
421421
url: result.url,
422-
guarding_pokemon_id: result.guarding_pokemon_id,
422+
guarding_pokemon_id: permGymDetails ? result.guarding_pokemon_id : null,
423423
enabled: result.enabled,
424424
last_modified_timestamp: result.last_modified_timestamp,
425425
team_id: result.team_id,
@@ -431,15 +431,15 @@ const getGyms = async (minLat, maxLat, minLon, maxLon, updated = 0, showRaids =
431431
availble_slots: result.availble_slots,
432432
updated: result.updated,
433433
ex_raid_eligible: result.ex_raid_eligible,
434-
in_battle: result.in_battle,
434+
in_battle: permGymDetails ? result.in_battle : false,
435435
raid_pokemon_move_1: result.raid_pokemon_move_1,
436436
raid_pokemon_move_2: result.raid_pokemon_move_2,
437437
raid_pokemon_form: result.raid_pokemon_form,
438438
raid_pokemon_cp: result.raid_pokemon_cp,
439439
raid_pokemon_gender: result.raid_pokemon_gender,
440440
raid_is_exclusive: result.raid_is_exclusive,
441441
cell_id: result.cell_id,
442-
total_cp: result.total_cp,
442+
total_cp: permGymDetails ? result.total_cp : null,
443443
sponsor_id: result.sponsor_id,
444444
raid_pokemon_evolution: result.raid_pokemon_evolution,
445445
raid_pokemon_costume: result.raid_pokemon_costume,

src/routes/api.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ const getData = async (perms, filter) => {
271271

272272
let data = {};
273273
if ((permShowGyms && showGyms) || (permShowRaids && showRaids)) {
274-
data['gyms'] = await map.getGyms(minLat, maxLat, minLon, maxLon, lastUpdate, showRaids, showGyms, raidFilterExclude, gymFilterExclude);
274+
data['gyms'] = await map.getGyms(minLat, maxLat, minLon, maxLon, lastUpdate,
275+
permShowRaids && showRaids, permShowGyms && showGyms, permShowGyms, raidFilterExclude, gymFilterExclude);
275276
}
276277
if (
277278
(permShowPokestops && showPokestops) ||

0 commit comments

Comments
 (0)