Download wp-calypso/client/state/selectors/get-comments-page.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 968 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/get-comments-page.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/selectors/get-comments-page.js
-
curl -L -o get-comments-page.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/get-comments-page.js
968 Bytes
| import { get } from 'lodash'; | |
| import { getFiltersKey } from 'calypso/state/comments/ui/utils'; | |
| import 'calypso/state/comments/init'; | |
| /** | |
| * Returns a list of comment IDs for the requested page and filters. | |
| * @param {Object} state Redux state. | |
| * @param {number} siteId Site identifier. | |
| * @param {Object} query Filter parameters. | |
| * @param {string} [query.order] Query order ('ASC' or 'DESC'). | |
| * @param {number} [query.page] Requested page. | |
| * @param {number} [query.postId] Post identifier. | |
| * @param {string} [query.search] Search query. | |
| * @param {string} [query.status] Comments status. | |
| * @returns {Array} List of comment IDs for the requested page and filters. | |
| */ | |
| export const getCommentsPage = ( state, siteId, query ) => { | |
| const { page = 1, postId } = query; | |
| const parent = postId || 'site'; | |
| const filter = getFiltersKey( query ); | |
| return get( state, [ 'comments', 'ui', 'queries', siteId, parent, filter, page ] ); | |
| }; | |
| export default getCommentsPage; | |