Skip to content

Commit

Permalink
Fixed import markdown cased bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Jun 8, 2019
1 parent 3ff6e4e commit 8529510
Showing 1 changed file with 6 additions and 30 deletions.
36 changes: 6 additions & 30 deletions src/main/java/run/halo/app/service/impl/PostServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
import run.halo.app.event.post.PostVisitEvent;
import run.halo.app.model.dto.CategoryDTO;
import run.halo.app.model.dto.TagDTO;
import run.halo.app.model.entity.Category;
import run.halo.app.model.entity.Post;
import run.halo.app.model.entity.PostCategory;
import run.halo.app.model.entity.PostTag;
import run.halo.app.model.entity.Tag;
import run.halo.app.model.entity.*;
import run.halo.app.model.enums.LogType;
import run.halo.app.model.enums.PostStatus;
import run.halo.app.model.params.PostQuery;
Expand All @@ -32,33 +28,13 @@
import run.halo.app.model.vo.PostDetailVO;
import run.halo.app.model.vo.PostListVO;
import run.halo.app.repository.PostRepository;
import run.halo.app.service.CategoryService;
import run.halo.app.service.OptionService;
import run.halo.app.service.PostCategoryService;
import run.halo.app.service.PostCommentService;
import run.halo.app.service.PostService;
import run.halo.app.service.PostTagService;
import run.halo.app.service.TagService;
import run.halo.app.utils.DateUtils;
import run.halo.app.utils.HaloUtils;
import run.halo.app.utils.MarkdownUtils;
import run.halo.app.utils.ServiceUtils;
import run.halo.app.utils.SlugUtils;
import run.halo.app.service.*;
import run.halo.app.utils.*;

import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.Subquery;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.*;
import java.util.function.Supplier;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -347,7 +323,6 @@ public PostDetailVO importMarkdown(String markdown, String filename) {
if (null == tag) {
tag = new Tag();
tag.setName(ele);
tag.setSlugName(SlugUtils.slugify(ele));
String slugName = SlugUtils.slugify(ele);
tag.setSlugName(HaloUtils.initializeUrlIfBlank(slugName));
tag = tagService.create(tag);
Expand All @@ -359,7 +334,8 @@ public PostDetailVO importMarkdown(String markdown, String filename) {
if (null == category) {
category = new Category();
category.setName(ele);
category.setSlugName(SlugUtils.slugify(ele));
String slugName = SlugUtils.slugify(ele);
category.setSlugName(HaloUtils.initializeUrlIfBlank(slugName));
category.setDescription(ele);
category = categoryService.create(category);
}
Expand Down

0 comments on commit 8529510

Please sign in to comment.