Skip to content

Commit

Permalink
fixed user coordinates not updated when profile location is set
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Jan 26, 2020
1 parent 16427f4 commit d558c3c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ public String mods(@PathVariable String id, @RequestParam Boolean makemod, HttpS

@PostMapping("/{id}")
public String edit(@PathVariable(required = false) String id, @RequestParam(required = false) String name,
@RequestParam(required = false) String location, @RequestParam(required = false) String website,
@RequestParam(required = false) String aboutme, @RequestParam(required = false) String picture, HttpServletRequest req) {
@RequestParam(required = false) String location, @RequestParam(required = false) String latlng,
@RequestParam(required = false) String website, @RequestParam(required = false) String aboutme,
@RequestParam(required = false) String picture, HttpServletRequest req) {
Profile authUser = utils.getAuthUser(req);
if (canEditProfile(authUser, id)) {
Profile showUser = authUser;
Expand All @@ -147,6 +148,7 @@ public String edit(@PathVariable(required = false) String id, @RequestParam(requ
showUser = utils.getParaClient().read(Profile.id(id));
}
if (!StringUtils.equals(showUser.getLocation(), location)) {
showUser.setLatlng(latlng);
showUser.setLocation(location);
updateProfile = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/scripts/scoold.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ $(function () {
mapMarker = new google.maps.Marker({position: latlng, visible: true});
mapMarker.setMap(map);
map.setCenter(latlng);
map.setZoom(7);
map.setZoom(mapZoom);
}
});
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/templates/profile.vm
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@

<div class="input-field">
<i class="fa fa-map-marker prefix"></i>
<input type="hidden" name="latlng" value="$!{authUser.latlng}">
<input id="location_text" name="location" class="locationbox validate" type="text" value="$!{showUser.location}"
placeholder="$!{lang.get('profile.about.location')}">
</div>
Expand Down

0 comments on commit d558c3c

Please sign in to comment.