From e07588c33a3b1783166e37df4b40cf1e2a817cb8 Mon Sep 17 00:00:00 2001 From: Julia Damerow Date: Tue, 10 Aug 2021 14:31:33 -0600 Subject: [PATCH] Bug/vspc 177 (#234) * [VSPC-177] fixed registration issue; attempt to fix space not found fixed issue when no exhibition mode has been set yet * [VSPC-177] removed commented out code * [VSPC-177] fixed test cases --- .../vspace/core/data/SpaceLinkRepository.java | 5 ++--- .../core/services/impl/SpaceManager.java | 18 ++++++++++++++---- .../webapp/WEB-INF/views/exhibition/space.html | 2 +- .../WEB-INF/views/layouts/navbar_staff.html | 4 ++-- .../src/main/webapp/WEB-INF/views/login.html | 2 +- .../main/webapp/WEB-INF/views/register.html | 2 +- .../src/main/webapp/resources/extra/Home.css | 2 +- .../core/services/impl/SpaceManagerTest.java | 10 +++++++--- 8 files changed, 29 insertions(+), 16 deletions(-) diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/data/SpaceLinkRepository.java b/vspace/src/main/java/edu/asu/diging/vspace/core/data/SpaceLinkRepository.java index a443f7620..70076d8e8 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/data/SpaceLinkRepository.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/data/SpaceLinkRepository.java @@ -27,7 +27,6 @@ public interface SpaceLinkRepository extends PagingAndSortingRepository getLinkedSpaces(String id); - - @Query("select d from SpaceLink d where d.targetSpace.id = ?1") - List getLinkedFromSpaces(String id); + + List findByTargetSpace(ISpace space); } diff --git a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceManager.java b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceManager.java index 10439f1df..084793d0c 100644 --- a/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceManager.java +++ b/vspace/src/main/java/edu/asu/diging/vspace/core/services/impl/SpaceManager.java @@ -219,7 +219,13 @@ public List getSpacesWithStatus(SpaceStatus status) { public void deleteSpaceById(String id) { if(id != null) { List spaceLinks = spaceLinkRepo.getLinkedSpaces(id); - List fromSpaceLinks = spaceLinkRepo.getLinkedFromSpaces(id); + + List fromSpaceLinks = new ArrayList<>(); + Optional space = spaceRepo.findById(id); + if (space.isPresent()) { + fromSpaceLinks = spaceLinkRepo.findByTargetSpace(space.get()); + } + Exhibition exhibition = (Exhibition) exhibitionManager.getStartExhibition(); // When space has other links attached to it // To delete links that access to the space getting deleted and replacing it as null @@ -252,8 +258,12 @@ public List getOutgoingLinks(String id) { @Override public List getIncomingLinks(String id) { - - return spaceLinkRepo.getLinkedFromSpaces(id); + Optional space = spaceRepo.findById(id); + if (space.isPresent()) { + return spaceLinkRepo.findByTargetSpace(space.get()); + } else { + return new ArrayList<>(); + } } @Override @@ -276,7 +286,7 @@ public Iterable addIncomingLinkInfoToSpaces(Iterable spaces) { Iterator iterator = spaces.iterator(); while(iterator.hasNext()) { Space space = iterator.next(); - space.setIncomingLinks( (spaceLinkRepo.getLinkedFromSpaces(space.getId())).size() > 0 ? true : false ); + space.setIncomingLinks( (spaceLinkRepo.findByTargetSpace(space)).size() > 0 ? true : false ); } return spaces; } diff --git a/vspace/src/main/webapp/WEB-INF/views/exhibition/space.html b/vspace/src/main/webapp/WEB-INF/views/exhibition/space.html index 5d7ae3a96..70f6f857c 100644 --- a/vspace/src/main/webapp/WEB-INF/views/exhibition/space.html +++ b/vspace/src/main/webapp/WEB-INF/views/exhibition/space.html @@ -406,7 +406,7 @@
[[${exhibitionConfig.customMessage}]]
[[${exhibitionConfig.mode.value}]]
+ th:unless="${exhibitionConfig.customMessage != '' && exhibitionConfig.mode == 'OFFLINE'}">[[${exhibitionConfig.mode?.value}]]
diff --git a/vspace/src/main/webapp/WEB-INF/views/layouts/navbar_staff.html b/vspace/src/main/webapp/WEB-INF/views/layouts/navbar_staff.html index d8eb73adc..da30515cf 100644 --- a/vspace/src/main/webapp/WEB-INF/views/layouts/navbar_staff.html +++ b/vspace/src/main/webapp/WEB-INF/views/layouts/navbar_staff.html @@ -4,14 +4,14 @@ -
+