Skip to content
Snippets Groups Projects
Commit 4ba3ba3c authored by Seb Barnard's avatar Seb Barnard :speech_balloon:
Browse files

Added text limit to description and JS fetching of description, prevents error on sql execution

parent d5be8541
No related branches found
No related tags found
5 merge requests!114LoggingService service class, new method to add a log to the "Logs" table when...,!74User is now authenticated on post request, all fields functional on client...,!64Issue twentyone,!60Branch Update,!58Added text limit to description and JS fetching of description, prevents error on sql execution
...@@ -32,7 +32,12 @@ public class BusinessFavouriter { ...@@ -32,7 +32,12 @@ public class BusinessFavouriter {
*/ */
@PostMapping("/favouriteBusiness") @PostMapping("/favouriteBusiness")
public String favouriteBusiness(UserFavouriteForm uff, HttpSession session){ public String favouriteBusiness(UserFavouriteForm uff, HttpSession session){
UserFavouriteDTO ufDTO = new UserFavouriteDTO(uff, jwtUtils.getLoggedInUserId(session).get()); UserFavouriteDTO ufDTO;
try{
ufDTO = new UserFavouriteDTO(uff, jwtUtils.getLoggedInUserId(session).get());
}catch(Exception e){
return "BAD SESSION";
}
try{ try{
if(toggleFavourite.alreadyInDb(ufDTO)){ if(toggleFavourite.alreadyInDb(ufDTO)){
deleteFavourite.delete(ufDTO); deleteFavourite.delete(ufDTO);
...@@ -45,5 +50,8 @@ public class BusinessFavouriter { ...@@ -45,5 +50,8 @@ public class BusinessFavouriter {
return "ERROR"; return "ERROR";
} }
} }
} }
...@@ -172,7 +172,13 @@ function handleInfo(data){ ...@@ -172,7 +172,13 @@ function handleInfo(data){
let name = data.site_name; let name = data.site_name;
let url = data.url; let url = data.url;
let description = data.description; let tempDescription = data.description;
let description = ""
for(let i=0; i<250; i++){
description+=tempDescription[i]
}
if(description !== undefined){ if(description !== undefined){
description = htmlDecode(unescape(description)); description = htmlDecode(unescape(description));
} }
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</p> </p>
<h5 class="title is-5" style="text-align:center; margin-bottom:5%; margin-top:5%">Description</h5> <h5 class="title is-5" style="text-align:center; margin-bottom:5%; margin-top:5%">Description</h5>
<p class="control has-icons-left" style="min-width:50%; width:70%; margin:auto"> <p class="control has-icons-left" style="min-width:50%; width:70%; margin:auto">
<textarea class="textarea" name="business_register_desc" id="business_register_desc"></textarea> <textarea class="textarea" name="business_register_desc" id="business_register_desc" maxlength="250"></textarea>
</p> </p>
<p class="is-danger help" style="text-align: center" id="business_register_desc_help"></p> <p class="is-danger help" style="text-align: center" id="business_register_desc_help"></p>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment