mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-08-10 21:31:00 +00:00
Merge branch 'main' of github.com:nagisa77/OpenIsle
This commit is contained in:
@@ -15,6 +15,7 @@ import io.swagger.v3.oas.annotations.media.Content;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -131,6 +132,7 @@ public class CommentController {
|
|||||||
c.getId(),
|
c.getId(),
|
||||||
"comment",
|
"comment",
|
||||||
c.getCreatedAt(),
|
c.getCreatedAt(),
|
||||||
|
c.getPinnedAt(),
|
||||||
c // payload 是 CommentDto
|
c // payload 是 CommentDto
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -145,17 +147,39 @@ public class CommentController {
|
|||||||
l.getId(),
|
l.getId(),
|
||||||
"log",
|
"log",
|
||||||
l.getTime(), // 注意字段名不一样
|
l.getTime(), // 注意字段名不一样
|
||||||
|
null,
|
||||||
l // payload 是 PostChangeLogDto
|
l // payload 是 PostChangeLogDto
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.toList()
|
.toList()
|
||||||
);
|
);
|
||||||
// 排序
|
// 排序
|
||||||
Comparator<TimelineItemDto<?>> comparator = Comparator.comparing(TimelineItemDto::getCreatedAt);
|
Comparator<TimelineItemDto<?>> pinnedOrderComparator = (a, b) -> {
|
||||||
|
LocalDateTime aPinned = a.getPinnedAt();
|
||||||
|
LocalDateTime bPinned = b.getPinnedAt();
|
||||||
|
if (aPinned == null && bPinned == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (aPinned == null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (bPinned == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return bPinned.compareTo(aPinned);
|
||||||
|
};
|
||||||
|
|
||||||
|
Comparator<TimelineItemDto<?>> comparator = Comparator.<TimelineItemDto<?>, Boolean>comparing(
|
||||||
|
item -> item.getPinnedAt() == null
|
||||||
|
).thenComparing(pinnedOrderComparator);
|
||||||
|
|
||||||
|
Comparator<TimelineItemDto<?>> createdAtComparator = Comparator.comparing(
|
||||||
|
TimelineItemDto::getCreatedAt
|
||||||
|
);
|
||||||
if (CommentSort.NEWEST.equals(sort)) {
|
if (CommentSort.NEWEST.equals(sort)) {
|
||||||
comparator = comparator.reversed();
|
createdAtComparator = createdAtComparator.reversed();
|
||||||
}
|
}
|
||||||
itemDtoList.sort(comparator);
|
itemDtoList.sort(comparator.thenComparing(createdAtComparator));
|
||||||
log.debug("listComments returning {} comments", itemDtoList.size());
|
log.debug("listComments returning {} comments", itemDtoList.size());
|
||||||
return itemDtoList;
|
return itemDtoList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,6 @@ public class TimelineItemDto<T> {
|
|||||||
private Long id;
|
private Long id;
|
||||||
private String kind; // "comment" | "log"
|
private String kind; // "comment" | "log"
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
|
private LocalDateTime pinnedAt;
|
||||||
private T payload; // 泛型,具体类型由外部决定
|
private T payload; // 泛型,具体类型由外部决定
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -342,6 +342,16 @@ body {
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*处理iframe视频标签*/
|
||||||
|
.info-content-text iframe {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
aspect-ratio: 16 / 9; /* 保持 16:9 比例 */
|
||||||
|
border: none;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.d2h-file-name {
|
.d2h-file-name {
|
||||||
font-size: 14px !important;
|
font-size: 14px !important;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user