diff --git a/app/services/sqlstore/postgres/common.go b/app/services/sqlstore/postgres/common.go index 4729ea014..748bad786 100644 --- a/app/services/sqlstore/postgres/common.go +++ b/app/services/sqlstore/postgres/common.go @@ -58,6 +58,12 @@ func getViewData(query query.SearchPosts, tagsPlaceholder int) (string, []enum.P switch query.View { case "recent": sort = "id" + case "recently-responded": + // Limit the result set to posts an admin has actually responded to; + // without this filter, open posts with NULL response_date dominate the + // tail of the list and make the sort look broken. + condition += " AND response_date IS NOT NULL" + sort = "response_date" case "most-wanted": sort = "votes_count" case "most-discussed": diff --git a/locale/en/client.json b/locale/en/client.json index 5a77ed622..406f620a8 100644 --- a/locale/en/client.json +++ b/locale/en/client.json @@ -59,7 +59,9 @@ "home.postfilter.option.myposts": "My Posts", "home.postfilter.option.myvotes": "My Votes", "home.postfilter.option.notags": "Untagged", + "home.postfilter.option.pending": "Pending", "home.postfilter.option.recent": "Recent", + "home.postfilter.option.recentlyresponded": "Recently Responded", "home.postfilter.option.trending": "Trending", "home.postscontainer.label.noresults": "No results matched your search, try something different.", "home.postscontainer.label.viewmore": "View more posts", diff --git a/locale/pl/client.json b/locale/pl/client.json index 27fc6fefb..0787583f9 100644 --- a/locale/pl/client.json +++ b/locale/pl/client.json @@ -59,7 +59,9 @@ "home.postfilter.option.myposts": "Moje posty", "home.postfilter.option.myvotes": "Moje Głosy", "home.postfilter.option.notags": "Nieoznaczone", + "home.postfilter.option.pending": "Oczekujące", "home.postfilter.option.recent": "Niedawne", + "home.postfilter.option.recentlyresponded": "Ostatnio rozpatrzone", "home.postfilter.option.trending": "Popularne", "home.postscontainer.label.noresults": "Brak wyników pasujących do Twojego wyszukiwania, spróbuj czegoś innego.", "home.postscontainer.label.viewmore": "Pokaż więcej postów", diff --git a/public/pages/Home/components/ListPosts.tsx b/public/pages/Home/components/ListPosts.tsx index 2fc55f96a..dfb9b243c 100644 --- a/public/pages/Home/components/ListPosts.tsx +++ b/public/pages/Home/components/ListPosts.tsx @@ -91,7 +91,11 @@ const MinimalListPostItem = (props: { post: Post; tags: Tag[]; onPostClick?: (po {props.post.title} - {isPending && pending} + {isPending && ( + + pending + + )} {props.post.status !== "open" ? (
diff --git a/public/pages/Home/components/PostFilter.tsx b/public/pages/Home/components/PostFilter.tsx index b3b49a10f..6b0b9e239 100644 --- a/public/pages/Home/components/PostFilter.tsx +++ b/public/pages/Home/components/PostFilter.tsx @@ -114,7 +114,7 @@ export const PostFilter = (props: PostFilterProps) => { // Add Pending status for collaborators and admins if (fider.session.isAuthenticated && fider.session.user.isCollaborator) { options.push({ - label: "Pending", + label: i18n._({ id: "home.postfilter.option.pending", message: "Pending" }), value: "pending", type: "status", }) diff --git a/public/pages/Home/components/PostsSort.tsx b/public/pages/Home/components/PostsSort.tsx index 37d1b6520..3532748bb 100644 --- a/public/pages/Home/components/PostsSort.tsx +++ b/public/pages/Home/components/PostsSort.tsx @@ -18,6 +18,11 @@ export const PostsSort: React.FC = ({ value = "trending", onChan { value: "most-wanted", label: i18n._({ id: "home.postfilter.option.mostwanted", message: "Most Wanted" }), icon: IconThumbsUp }, { value: "most-discussed", label: i18n._({ id: "home.postfilter.option.mostdiscussed", message: "Most Discussed" }), icon: IconChat }, { value: "recent", label: i18n._({ id: "home.postfilter.option.recent", message: "Recent" }), icon: IconClock }, + { + value: "recently-responded", + label: i18n._({ id: "home.postfilter.option.recentlyresponded", message: "Recently Responded" }), + icon: IconClock, + }, ] const selectedItem = options.find((x) => x.value === value) || options[0]