fix: remove post sorting from frontend

This commit is contained in:
Awais Ansari
2022-09-28 19:12:39 +05:00
committed by Mehak Nasir
parent b256238941
commit ab2c031bdc
2 changed files with 4 additions and 8 deletions

View File

@@ -52,7 +52,7 @@ function DiscussionPostType({
<label htmlFor={`post-type-${value}`} className="d-flex p-0 my-2 mr-3">
<Form.Radio value={value} id={`post-type-${value}`} className="sr-only">{type}</Form.Radio>
<Card
className={classNames('border-2', {
className={classNames('border-2 shadow-none', {
'border-primary': selected,
'border-light-400': !selected,
})}

View File

@@ -1,6 +1,6 @@
/* eslint-disable import/prefer-default-export */
import { getIn } from 'formik';
import { orderBy, uniqBy } from 'lodash';
import { uniqBy } from 'lodash';
import { generatePath, useRouteMatch } from 'react-router';
import { getConfig } from '@edx/frontend-platform';
@@ -252,13 +252,9 @@ export const isPostPreviewAvailable = (htmlNode) => {
* @param {array} posts arrays of posts
* @param {string} filterBy name of post object attribute. un will use for reverse
* condition. like pinned attribute for pinned post and unpinned for non pinned posts.
* @param {string} sortBy name of post object attribute
* @param {string} order order of the sorting list
*/
export const filterPosts = (posts, filterBy, sortBy = 'createdAt', order = 'desc') => orderBy(
uniqBy(posts, 'id').filter(
post => (filterBy.startsWith('un') ? !post[filterBy.slice(2)] : post[filterBy]),
), [sortBy], [order],
export const filterPosts = (posts, filterBy) => uniqBy(posts, 'id').filter(
post => (filterBy.startsWith('un') ? !post[filterBy.slice(2)] : post[filterBy]),
);
/**