Skip to content

Commit

Permalink
fix(rss): update item URLs for English feed
Browse files Browse the repository at this point in the history
  • Loading branch information
RafDevX committed Aug 7, 2024
1 parent dd9061e commit c2d6e72
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package se.datasektionen.calypso.controllers.admin;

import java.time.format.DateTimeFormatter;
import java.util.Optional;

import javax.validation.Valid;

Expand Down
1 change: 0 additions & 1 deletion src/main/java/se/datasektionen/calypso/feeds/IcalFeed.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static se.datasektionen.calypso.feeds.DateUtils.ldtToDate;

import java.time.LocalDateTime;
import java.util.Optional;
import java.util.TimeZone;

@Service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package se.datasektionen.calypso.feeds.rss;

import java.util.function.Function;

public class RssConstants {

public static class Swedish {
public static final String TITLE = "Datasektionen.se - RSS";
public static final String DESCRIPTION = "Nyheter och event från Datasektionen.se";
public static final String LINK_BASE_URL = "https://datasektionen.se/nyheter/";
public static final Function<Long, String> LINKER = id -> "https://datasektionen.se/nyheter/" + id;
public static final String FEED_URL = "/feed/rss";
}

public static class English {
public static final String TITLE = "Datasektionen.se - RSS (English)";
public static final String DESCRIPTION = "News and events from Datasektionen.se";
public static final String LINK_BASE_URL = "https://datasektionen.se/en/news/";
public static final Function<Long, String> LINKER = id -> "https://datasektionen.se/nyheter/"
+ id + "?lang=en";
public static final String FEED_URL = "/feed/rss_en";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ private List<com.rometools.rome.feed.rss.Item> fetchAndConvertSwedishItems() {
return fetchAndConvertItems(Item::getTitleSwedish,
Item::getAuthorDisplay,
Item::getContentSwedishProcessed,
i -> RssConstants.Swedish.LINK_BASE_URL + i.getId());
i -> RssConstants.Swedish.LINKER.apply(i.getId()));
}

private List<com.rometools.rome.feed.rss.Item> fetchAndConvertEnglishItems() {
return fetchAndConvertItems(Item::getTitleEnglish,
Item::getAuthorDisplay,
Item::getContentEnglishProcessed,
i -> RssConstants.English.LINK_BASE_URL + i.getId());
i -> RssConstants.English.LINKER.apply(i.getId()));
}

private List<com.rometools.rome.feed.rss.Item> fetchAndConvertItems(Function<Item, String> titleMapper,
Expand Down

0 comments on commit c2d6e72

Please sign in to comment.