starred premoderation

This commit is contained in:
muerwre 2019-03-21 18:27:12 +07:00
parent d2beab0976
commit fd7404e565
5 changed files with 8 additions and 8 deletions

View file

@ -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,
};
}

View file

@ -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';

View file

@ -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,

View file

@ -18,6 +18,6 @@ export const DIALOGS: IDialogs = ({
export const TABS: IMapTabs = ({
mine: 'Мои',
all: 'Разное',
starred: 'Общие',
all: 'ВСЕ',
});

View file

@ -312,7 +312,10 @@ const setRouteStarred: ActionHandler<typeof ActionCreators.setRouteStarred> = (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)
))
)
}
});