Skip to content

Commit cd55865

Browse files
committed
Fixed not selecting and deselecting comics in collections [#2326]
1 parent 769592d commit cd55865

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

comixed-rest/src/main/java/org/comixedproject/rest/comicbooks/ComicBookSelectionController.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public void selectComicBooksByFilter(
151151
* Adds selections by tag type and value
152152
*
153153
* @param session the session
154-
* @param tagTypeString the tag type string
154+
* @param tagType the tag type
155155
* @param tagValue the tag value
156156
* @throws ComicBookSelectionException if an error occurs
157157
*/
@@ -160,10 +160,9 @@ public void selectComicBooksByFilter(
160160
@Timed(value = "comixed.comic-book.selections.add-by-tag-type-and-value")
161161
public void addComicBooksByTagTypeAndValue(
162162
final HttpSession session,
163-
@PathVariable("tagType") final String tagTypeString,
163+
@PathVariable("tagType") final ComicTagType tagType,
164164
@PathVariable("tagValue") final String tagValue)
165165
throws ComicBookSelectionException {
166-
final ComicTagType tagType = ComicTagType.forValue(tagTypeString);
167166
final String decodedTagValue = this.opdsUtils.urlDecodeString(tagValue);
168167
log.info(
169168
"Adding multiple comic books by tag type and value: type={} value={}",
@@ -181,7 +180,7 @@ public void addComicBooksByTagTypeAndValue(
181180
* Removes selections using filters.
182181
*
183182
* @param session the session
184-
* @param tagTypeString the tag type string
183+
* @param tagType the tag type
185184
* @param tagValue the tag value
186185
* @throws ComicBookSelectionException if an error occurs
187186
*/
@@ -190,10 +189,9 @@ public void addComicBooksByTagTypeAndValue(
190189
@Timed(value = "comixed.comic-book.selections.remove-by-tag-type-and-value")
191190
public void removeComicBooksByTagTypeAndValue(
192191
final HttpSession session,
193-
@PathVariable("tagType") final String tagTypeString,
192+
@PathVariable("tagType") final ComicTagType tagType,
194193
@PathVariable("tagValue") final String tagValue)
195194
throws ComicBookSelectionException {
196-
final ComicTagType tagType = ComicTagType.forValue(tagTypeString);
197195
final String decodedTagValue = this.opdsUtils.urlDecodeString(tagValue);
198196

199197
log.info(

comixed-rest/src/test/java/org/comixedproject/rest/comicbooks/ComicBookSelectionControllerTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ public void testSelectComicBooksByFilter_deselecting() throws ComicBookSelection
138138
public void testAddComicBooksByTagTypeAndValue() throws ComicBookSelectionException {
139139
Mockito.when(opdsUtils.urlDecodeString(TEST_TAG_VALUE)).thenReturn(TEST_TAG_VALUE);
140140

141-
controller.addComicBooksByTagTypeAndValue(
142-
httpSession, TEST_TAG_TYPE.getValue(), TEST_TAG_VALUE);
141+
controller.addComicBooksByTagTypeAndValue(httpSession, TEST_TAG_TYPE, TEST_TAG_VALUE);
143142

144143
Mockito.verify(httpSession, Mockito.times(1)).getAttribute(LIBRARY_SELECTIONS);
145144
Mockito.verify(comicSelectionService, Mockito.times(1))
@@ -153,8 +152,7 @@ public void testAddComicBooksByTagTypeAndValue() throws ComicBookSelectionExcept
153152
public void testRemoveComicBooksByTagTypeAndValue() throws ComicBookSelectionException {
154153
Mockito.when(opdsUtils.urlDecodeString(TEST_TAG_VALUE)).thenReturn(TEST_TAG_VALUE);
155154

156-
controller.removeComicBooksByTagTypeAndValue(
157-
httpSession, TEST_TAG_TYPE.getValue(), TEST_TAG_VALUE);
155+
controller.removeComicBooksByTagTypeAndValue(httpSession, TEST_TAG_TYPE, TEST_TAG_VALUE);
158156

159157
Mockito.verify(httpSession, Mockito.times(1)).getAttribute(LIBRARY_SELECTIONS);
160158
Mockito.verify(comicSelectionService, Mockito.times(1))

0 commit comments

Comments
 (0)