From fd7404e56569cf654176c77709eeef8beaef427b Mon Sep 17 00:00:00 2001 From: muerwre Date: Thu, 21 Mar 2019 18:27:12 +0700 Subject: [PATCH] starred premoderation --- backend/routes/route/list.js | 7 +++---- src/components/dialogs/MapListDialog.tsx | 1 - src/components/panels/UserPanel.tsx | 1 - src/constants/dialogs.ts | 2 +- src/redux/user/reducer.ts | 5 ++++- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/routes/route/list.js b/backend/routes/route/list.js index 50198ab..7d2d6ea 100644 --- a/backend/routes/route/list.js +++ b/backend/routes/route/list.js @@ -23,17 +23,16 @@ module.exports = async (req, res) => { }; } - console.log('is starred?', starred); if (is_starred) { criteria = { ...criteria, is_starred: true, + is_public: true, }; - } - - if (!author || !user || (user._id !== author)) { + } else if (!author || !user || (user._id !== author)) { criteria = { ...criteria, + is_starred: false, is_public: true, }; } diff --git a/src/components/dialogs/MapListDialog.tsx b/src/components/dialogs/MapListDialog.tsx index 968a233..b8af1e1 100644 --- a/src/components/dialogs/MapListDialog.tsx +++ b/src/components/dialogs/MapListDialog.tsx @@ -15,7 +15,6 @@ import { import { isMobile } from '$utils/window'; import classnames from 'classnames'; -// import { Range } from 'rc-slider'; import * as Range from 'rc-slider/lib/Range'; import { TABS } from '$constants/dialogs'; import { Icon } from '$components/panels/Icon'; diff --git a/src/components/panels/UserPanel.tsx b/src/components/panels/UserPanel.tsx index a17a099..25665f4 100644 --- a/src/components/panels/UserPanel.tsx +++ b/src/components/panels/UserPanel.tsx @@ -14,7 +14,6 @@ import { CLIENT } from '$config/frontend'; import { DIALOGS } from '$constants/dialogs'; import { IRootState } from "$redux/user/reducer"; import { Tooltip } from "$components/panels/Tooltip"; -import { TitleDialog } from "$components/dialogs/TitleDialog"; interface Props extends IRootState { userLogout: typeof userLogout, diff --git a/src/constants/dialogs.ts b/src/constants/dialogs.ts index 8f10cc8..6532a98 100644 --- a/src/constants/dialogs.ts +++ b/src/constants/dialogs.ts @@ -18,6 +18,6 @@ export const DIALOGS: IDialogs = ({ export const TABS: IMapTabs = ({ mine: 'Мои', + all: 'Разное', starred: 'Общие', - all: 'ВСЕ', }); diff --git a/src/redux/user/reducer.ts b/src/redux/user/reducer.ts index 137d49b..d356f23 100644 --- a/src/redux/user/reducer.ts +++ b/src/redux/user/reducer.ts @@ -312,7 +312,10 @@ const setRouteStarred: ActionHandler = (s list: ( state.routes.list .map(el => el._id === _id ? { ...el, is_starred } : el) - .filter(el => state.routes.filter.tab !== 'starred' || el.is_starred) + .filter(el => ( + (state.routes.filter.tab === 'starred' && el.is_starred) || + (state.routes.filter.tab === 'all' && !el.is_starred) + )) ) } });