Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* feat: halo-dev#1036

* revert: BaseCommentRepository.
  • Loading branch information
ruibaby authored Mar 28, 2021
1 parent f0ba0fa commit f9a629c
Show file tree
Hide file tree
Showing 20 changed files with 150 additions and 446 deletions.

This file was deleted.

1 change: 1 addition & 0 deletions src/main/java/run/halo/app/model/dto/BaseCommentDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ public class BaseCommentDTO implements OutputConverter<BaseCommentDTO, BaseComme

private Date createTime;

private String avatar;
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public enum CommentProperties implements PropertyEnum {
INTERNAL_PLUGIN_JS("comment_internal_plugin_js", String.class,
"//cdn.jsdelivr.net/npm/halo-comment@latest/dist/halo-comment.min.js"),

/**
* Gravatar mirror source base url.
*/
GRAVATAR_SOURCE("gravatar_source", String.class, "//gravatar.com/avatar/"),

COMMENT_BAN_TIME("comment_ban_time", Integer.class, "10"),

COMMENT_RANGE("comment_range", Integer.class, "30");
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/run/halo/app/service/AttachmentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,4 @@ public interface AttachmentService extends CrudService<Attachment, Integer> {
* @return list of type.
*/
List<AttachmentType> listAllType();

/**
* Replace attachment url in batch.
*
* @param oldUrl old blog url.
* @param newUrl new blog url.
* @return replaced attachments.
*/
List<Attachment> replaceUrl(@NonNull String oldUrl, @NonNull String newUrl);
}
20 changes: 0 additions & 20 deletions src/main/java/run/halo/app/service/DataProcessService.java

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/java/run/halo/app/service/OptionService.java
Original file line number Diff line number Diff line change
Expand Up @@ -468,15 +468,6 @@ <V, E extends Enum<E> & ValueEnum<V>> E getValueEnumByPropertyOrDefault(
*/
Boolean isEnabledAbsolutePath();

/**
* Replace option url in batch.
*
* @param oldUrl old blog url.
* @param newUrl new blog url.
* @return replaced options.
*/
List<OptionDTO> replaceUrl(@NonNull String oldUrl, @NonNull String newUrl);

/**
* Converts to option output dto.
*
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/run/halo/app/service/PhotoService.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,4 @@ public interface PhotoService extends CrudService<Photo, Integer> {
* @return list of teams
*/
List<String> listAllTeams();

/**
* Replace photo url in batch.
*
* @param oldUrl old blog url.
* @param newUrl new blog url.
* @return replaced photos.
*/
List<PhotoDTO> replaceUrl(@NonNull String oldUrl, @NonNull String newUrl);
}
9 changes: 0 additions & 9 deletions src/main/java/run/halo/app/service/ThemeSettingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@ public interface ThemeSettingService extends CrudService<ThemeSetting, Integer>
@NonNull
Map<String, Object> listAsMapBy(@NonNull String themeId);

/**
* Replace theme setting url in batch.
*
* @param oldUrl old blog url.
* @param newUrl new blog url.
* @return replaced theme settings.
*/
List<ThemeSetting> replaceUrl(@NonNull String oldUrl, @NonNull String newUrl);

/**
* Delete unused theme setting.
*/
Expand Down
34 changes: 0 additions & 34 deletions src/main/java/run/halo/app/service/base/BaseCommentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,38 +296,4 @@ List<COMMENT> listChildrenBy(@NonNull Integer targetId, @NonNull Long commentPar
@NonNull
List<COMMENT> listChildrenBy(@NonNull Integer targetId, @NonNull Long commentParentId,
@NonNull Sort sort);

/**
* Filters comment ip address.
*
* @param comment comment dto must not be null
*/
@Deprecated
<T extends BaseCommentDTO> T filterIpAddress(@NonNull T comment);

/**
* Filters comment ip address.
*
* @param comments comment dto list
*/
@Deprecated
<T extends BaseCommentDTO> List<T> filterIpAddress(@Nullable List<T> comments);

/**
* Filters comment ip address.
*
* @param commentPage comment page
*/
@Deprecated
<T extends BaseCommentDTO> Page<T> filterIpAddress(@NonNull Page<T> commentPage);

/**
* Replace comment url in batch.
*
* @param oldUrl old blog url.
* @param newUrl new blog url.
* @return replaced comments.
*/
List<BaseCommentDTO> replaceUrl(@NonNull String oldUrl, @NonNull String newUrl);

}
10 changes: 0 additions & 10 deletions src/main/java/run/halo/app/service/base/BasePostService.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,6 @@ public interface BasePostService<POST extends BasePost> extends CrudService<POST
@NonNull
List<POST> updateStatusByIds(@NonNull List<Integer> ids, @NonNull PostStatus status);

/**
* Replace post blog url in batch.
*
* @param oldUrl old blog url.
* @param newUrl new blog url.
* @return replaced posts.
*/
@NonNull
List<BasePostDetailDTO> replaceUrl(@NonNull String oldUrl, @NonNull String newUrl);

/**
* Generate description.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package run.halo.app.service.impl;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
Expand Down Expand Up @@ -77,7 +76,7 @@ public Page<AttachmentDTO> pageDtosBy(@NonNull Pageable pageable,
private Specification<Attachment> buildSpecByQuery(@NonNull AttachmentQuery attachmentQuery) {
Assert.notNull(attachmentQuery, "Attachment query must not be null");

return (Specification<Attachment>) (root, query, criteriaBuilder) -> {
return (root, query, criteriaBuilder) -> {
List<Predicate> predicates = new LinkedList<>();

if (attachmentQuery.getMediaType() != null) {
Expand Down Expand Up @@ -198,22 +197,6 @@ public List<AttachmentType> listAllType() {
return attachmentRepository.findAllType();
}

@Override
public List<Attachment> replaceUrl(String oldUrl, String newUrl) {
List<Attachment> attachments = listAll();
List<Attachment> replaced = new ArrayList<>();
attachments.forEach(attachment -> {
if (StringUtils.isNotEmpty(attachment.getPath())) {
attachment.setPath(attachment.getPath().replaceAll(oldUrl, newUrl));
}
if (StringUtils.isNotEmpty(attachment.getThumbPath())) {
attachment.setThumbPath(attachment.getThumbPath().replaceAll(oldUrl, newUrl));
}
replaced.add(attachment);
});
return updateInBatch(replaced);
}

@Override
public Attachment create(Attachment attachment) {
Assert.notNull(attachment, "Attachment must not be null");
Expand Down
Loading

0 comments on commit f9a629c

Please sign in to comment.