Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support sorting posts by views and comment count #5614

Merged
merged 15 commits into from
Apr 11, 2024
Prev Previous commit
Next Next commit
Reformatted code to follow Checkstyle
Signed-off-by: ZJamss <zjamss@qq.com>
  • Loading branch information
ZJamss committed Apr 1, 2024
commit 9d7b267e525c879b8ffe4283d5f1d5156c09176d
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package run.halo.app.core.extension.reconciler;

import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.data.domain.Sort;
@@ -17,9 +20,7 @@
import run.halo.app.extension.index.Indexer;
import run.halo.app.extension.index.IndexerFactoryImpl;
import run.halo.app.metrics.MeterUtils;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;


@Component
public class PostCounterReconciler implements Reconciler<Reconciler.Request> {
@@ -81,7 +82,9 @@ public void updateIndexByPost(Post post) {

@Override
public Controller setupWith(ControllerBuilder builder) {
return builder.extension(new Counter()).syncAllOnStart(false).build();
return builder
.extension(new Counter())
.syncAllOnStart(false).build();
}

@EventListener(ApplicationStartedEvent.class)
Original file line number Diff line number Diff line change
@@ -2,10 +2,7 @@

import org.springframework.context.ApplicationEvent;

/**
* @author ZJamss
*/
public class PostChangeEvent extends ApplicationEvent implements PostEvent{
public class PostChangeEvent extends ApplicationEvent implements PostEvent {
ZJamss marked this conversation as resolved.
Show resolved Hide resolved
private final String name;

public PostChangeEvent(Object source, String post) {