Commit c7063ef4 authored by Matija Obreza's avatar Matija Obreza
Browse files

CMS: Use now() if `Article.publishDate` not provided

parent 87f81ebd
...@@ -26,7 +26,6 @@ import java.util.List; ...@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.VelocityContext; import org.apache.velocity.VelocityContext;
...@@ -269,10 +268,10 @@ public class ContentServiceImpl implements ContentService { ...@@ -269,10 +268,10 @@ public class ContentServiceImpl implements ContentService {
article.setLang(locale.getLanguage()); article.setLang(locale.getLanguage());
} }
article.setPublishDate(publishDate); article.setPublishDate(publishDate == null ? new Date() : publishDate);
article.setExpirationDate(expirationDate); article.setExpirationDate(expirationDate);
updateArticleContent(article, slug, title, summary, body); updateArticleContent(article, slug, title, summary, body);
return articleRepository.save(article); return articleRepository.save(article);
} }
...@@ -294,7 +293,9 @@ public class ContentServiceImpl implements ContentService { ...@@ -294,7 +293,9 @@ public class ContentServiceImpl implements ContentService {
@CacheEvict(value = "contentcache", allEntries = true) @CacheEvict(value = "contentcache", allEntries = true)
public Article updateGlobalArticle(String slug, Locale locale, String title, String summary, String body, Date publishDate, Date expirationDate) throws CRMException { public Article updateGlobalArticle(String slug, Locale locale, String title, String summary, String body, Date publishDate, Date expirationDate) throws CRMException {
Article article = updateGlobalArticleInternal(slug, locale, title, summary, body); Article article = updateGlobalArticleInternal(slug, locale, title, summary, body);
article.setPublishDate(publishDate); if (publishDate != null) {
article.setPublishDate(publishDate);
}
article.setExpirationDate(expirationDate); article.setExpirationDate(expirationDate);
return articleRepository.save(article); return articleRepository.save(article);
} }
...@@ -793,7 +794,7 @@ public class ContentServiceImpl implements ContentService { ...@@ -793,7 +794,7 @@ public class ContentServiceImpl implements ContentService {
} }
article.setLang(locale.getLanguage()); article.setLang(locale.getLanguage());
article.setPublishDate(publishDate); article.setPublishDate(publishDate == null ? new Date() : publishDate);
article.setExpirationDate(expirationDate); article.setExpirationDate(expirationDate);
updateArticleContent(article, slug, title, summary, body); updateArticleContent(article, slug, title, summary, body);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment