✨ Feed no longer show replies
This commit is contained in:
parent
1baffd4200
commit
b0c9368530
@ -5,7 +5,6 @@ import "time"
|
||||
type Post struct {
|
||||
BaseModel
|
||||
|
||||
// TODO Introduce thumbnail
|
||||
Alias string `json:"alias" gorm:"uniqueIndex"`
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
|
@ -77,11 +77,14 @@ func listPost(c *fiber.Ctx) error {
|
||||
if len(c.Query("category")) > 0 {
|
||||
tx = services.FilterPostWithCategory(tx, c.Query("category"))
|
||||
}
|
||||
|
||||
if len(c.Query("tag")) > 0 {
|
||||
tx = services.FilterPostWithTag(tx, c.Query("tag"))
|
||||
}
|
||||
|
||||
if !c.QueryBool("reply", true) {
|
||||
tx = tx.Where("reply_id IS NULL")
|
||||
}
|
||||
|
||||
var count int64
|
||||
if err := tx.
|
||||
Model(&models.Post{}).
|
||||
|
@ -12,10 +12,14 @@ export default function DashboardPage() {
|
||||
|
||||
async function readPosts(pn?: number) {
|
||||
if (pn) setPage(pn);
|
||||
const res = await fetch("/api/posts?" + new URLSearchParams({
|
||||
const res = await fetch(
|
||||
"/api/posts?" +
|
||||
new URLSearchParams({
|
||||
take: (10).toString(),
|
||||
offset: ((page() - 1) * 10).toString()
|
||||
}));
|
||||
offset: ((page() - 1) * 10).toString(),
|
||||
reply: false.toString(),
|
||||
}),
|
||||
);
|
||||
if (res.status !== 200) {
|
||||
setError(await res.text());
|
||||
} else {
|
||||
@ -28,7 +32,7 @@ export default function DashboardPage() {
|
||||
const meta: { [id: string]: any } = {
|
||||
reposting: null,
|
||||
replying: null,
|
||||
editing: null
|
||||
editing: null,
|
||||
};
|
||||
meta[field] = data;
|
||||
setPublishMeta(meta);
|
||||
@ -39,7 +43,7 @@ export default function DashboardPage() {
|
||||
const [publishMeta, setPublishMeta] = createStore<any>({
|
||||
replying: null,
|
||||
reposting: null,
|
||||
editing: null
|
||||
editing: null,
|
||||
});
|
||||
|
||||
return (
|
||||
@ -47,10 +51,18 @@ export default function DashboardPage() {
|
||||
<div id="alerts">
|
||||
<Show when={error()}>
|
||||
<div role="alert" class="alert alert-error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none"
|
||||
viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="stroke-current shrink-0 h-6 w-6"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
/>
|
||||
</svg>
|
||||
<span class="capitalize">{error()}</span>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user