mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat: implement mod queue
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
isAllView,
|
||||
isBoardView,
|
||||
isCatalogView,
|
||||
isHomeView,
|
||||
isModView,
|
||||
isModQueueView,
|
||||
isPendingPostView,
|
||||
isPostPageView,
|
||||
isSettingsView,
|
||||
isSubscriptionsView,
|
||||
isNotFoundView,
|
||||
ParamsType,
|
||||
} from './view-utils';
|
||||
|
||||
export {
|
||||
isAllView,
|
||||
isBoardView,
|
||||
isCatalogView,
|
||||
isHomeView,
|
||||
isModView,
|
||||
isModQueueView,
|
||||
isPendingPostView,
|
||||
isPostPageView,
|
||||
isSettingsView,
|
||||
isSubscriptionsView,
|
||||
isNotFoundView,
|
||||
};
|
||||
export type { ParamsType };
|
||||
@@ -106,6 +106,7 @@ export const isFeedRoute = (pathname: string): boolean => {
|
||||
|
||||
if (normalizedPath.includes('/thread/')) return false;
|
||||
if (normalizedPath.startsWith('/pending/')) return false;
|
||||
if (normalizedPath.includes('/queue')) return false;
|
||||
|
||||
const pathWithoutSettings = normalizedPath.replace(/\/settings$/, '');
|
||||
|
||||
@@ -137,6 +138,11 @@ export const isPendingPostRoute = (pathname: string): boolean => {
|
||||
return normalizedPath.startsWith('/pending/');
|
||||
};
|
||||
|
||||
export const isModQueueRoute = (pathname: string): boolean => {
|
||||
const normalizedPath = pathname.replace(/\/settings$/, '');
|
||||
return normalizedPath.includes('/queue');
|
||||
};
|
||||
|
||||
export const getFeedCacheKey = (pathname: string): string | null => {
|
||||
let normalizedPath = pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
|
||||
normalizedPath = normalizedPath.replace(/\/settings$/, '');
|
||||
@@ -150,6 +156,10 @@ export const getFeedCacheKey = (pathname: string): string | null => {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (normalizedPath.includes('/queue')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isFeedRoute(pathname)) {
|
||||
return normalizedPath;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,10 @@ export const isModView = (pathname: string): boolean => {
|
||||
return pathname === `/mod` || pathname.startsWith(`/mod/`);
|
||||
};
|
||||
|
||||
export const isModQueueView = (pathname: string): boolean => {
|
||||
return pathname.includes('/queue');
|
||||
};
|
||||
|
||||
export const isPendingPostView = (pathname: string, params: ParamsType): boolean => {
|
||||
return pathname === `/pending/${params.accountCommentIndex}` || pathname === `/pending/${params.accountCommentIndex}/settings`;
|
||||
};
|
||||
@@ -101,6 +105,7 @@ export const isNotFoundView = (pathname: string, params: ParamsType): boolean =>
|
||||
!isPendingPostView(pathname, params) &&
|
||||
!isPostPageView(pathname, params) &&
|
||||
!isSettingsView(pathname, params) &&
|
||||
!isSubscriptionsView(pathname, params)
|
||||
!isSubscriptionsView(pathname, params) &&
|
||||
!isModQueueView(pathname)
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user