Skip to content

Commit

Permalink
Merge pull request #369 from kagemomiji/issue368-fix-playlist-update-…
Browse files Browse the repository at this point in the history
…issue

#368 Fix updating playlist with null name failed via API
  • Loading branch information
kagemomiji authored Feb 12, 2024
2 parents 8bf96ef + fed3d73 commit f03ee90
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion airsonic-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>org.airsonic.player</groupId>
<artifactId>airsonic</artifactId>
<version>11.1.3-SNAPSHOT</version>
<version>11.1.4-SNAPSHOT</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public void updatePlaylist(Integer id, String name) {
@Transactional
public void updatePlaylist(Integer id, String name, String comment, Boolean shared) {
playlistRepository.findById(id).ifPresentOrElse(p -> {
p.setName(name);
if (name != null) p.setName(name);
if (comment != null) p.setComment(comment);
if (shared != null) p.setShared(shared);
p.setChanged(Instant.now());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.annotation.Transactional;

import java.nio.file.Path;
Expand Down Expand Up @@ -68,6 +69,9 @@ public class AlbumRepositoryTest {
@Autowired
private MusicFolderRepository musicFolderRepository;

@Autowired
private JdbcTemplate jdbcTemplate;

@TempDir
private static Path tempDir;

Expand All @@ -88,6 +92,7 @@ public void setupFolder() {
testFolders.add(musicFolder2);
testFolders.add(musicFolder3);
musicFolderRepository.saveAll(testFolders);
jdbcTemplate.execute("DELETE FROM album WHERE present = false");
}

@AfterEach
Expand All @@ -113,7 +118,6 @@ public void testFindByArtistAndName() {
assertTrue(result.isPresent());
assertEquals(album, result.get());
assertFalse(notFound.isPresent());

}

@Test
Expand Down Expand Up @@ -145,7 +149,6 @@ public void testFindByArtistAndFolderIdInAndPresentTrue() {
public void testMarkNonPresent() {

// given

long count = albumRepository.findByPresentFalse().size();
Instant now = Instant.now().minusSeconds(3600);
Album album1 = new Album("path1", "name1", "artist1", Instant.now(), now, true, testFolders.get(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.annotation.Transactional;

import java.nio.file.Path;
Expand Down Expand Up @@ -66,6 +67,9 @@ public class ArtistRepositoryTest {
@Autowired
private MusicFolderRepository musicFolderRepository;

@Autowired
private JdbcTemplate jdbcTemplate;

@TempDir
private static Path tempDir;

Expand All @@ -83,6 +87,7 @@ public void init() {
testFolders.add(musicFolder);
testFolders.add(musicFolder2);
musicFolderRepository.saveAll(testFolders);
jdbcTemplate.execute("DELETE FROM artist WHERE present = false");
}

@AfterEach
Expand Down
2 changes: 1 addition & 1 deletion airsonic-sonos-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.airsonic.player</groupId>
<artifactId>airsonic</artifactId>
<version>11.1.3-SNAPSHOT</version>
<version>11.1.4-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions install/docker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<relativePath>../../pom.xml</relativePath>
<artifactId>airsonic</artifactId>
<version>11.1.3-SNAPSHOT</version>
<version>11.1.4-SNAPSHOT</version>
<groupId>org.airsonic.player</groupId>
</parent>
<packaging>pom</packaging>
Expand All @@ -16,7 +16,7 @@
<dependency>
<groupId>org.airsonic.player</groupId>
<artifactId>airsonic-main</artifactId>
<version>11.1.3-SNAPSHOT</version>
<version>11.1.4-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion integration-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.airsonic.player</groupId>
<artifactId>airsonic</artifactId>
<version>11.1.3-SNAPSHOT</version>
<version>11.1.4-SNAPSHOT</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.airsonic.player</groupId>
<artifactId>airsonic</artifactId>
<version>11.1.3-SNAPSHOT</version>
<version>11.1.4-SNAPSHOT</version>
<name>Airsonic</name>
<packaging>pom</packaging>
<organization>
Expand Down
2 changes: 1 addition & 1 deletion subsonic-rest-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.airsonic.player</groupId>
<artifactId>airsonic</artifactId>
<version>11.1.3-SNAPSHOT</version>
<version>11.1.4-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down

0 comments on commit f03ee90

Please sign in to comment.