Compare commits

..

5 Commits

Author SHA1 Message Date
edX requirements bot
4a1e77bd13 Merge pull request #541 from DmytroAlipov/fix-discussion-search-palm
Fix bug with a repeated search query  for Palm
2023-07-12 06:05:17 -04:00
alipov_d
dcb0f9e0ec fix: issue with a repeated search query for Palm 2023-06-19 18:32:21 +02:00
edX requirements bot
5ca61b9480 Merge pull request #535 from DmytroAlipov/fix-edit-reason-palm
fix: 400 error editing comment
2023-06-12 06:05:04 -04:00
alipov_d
e801fbb5cd fix: 400 error editing comment
This is a backport from the master
2023-06-09 12:38:27 +02:00
Bilal Qamar
5c6e40bc48 feat: upgraded to node v18, added .nvmrc and updated workflows (#471)
* feat: upgraded to node v18, added .nvmrc and updated workflows

* refactor: updated packages

* refactor: resolved eslint issues
2023-06-09 09:12:08 +02:00
2 changed files with 8 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
import React, { useContext, useEffect } from 'react';
import React, { useContext, useEffect, useState } from 'react';
import camelCase from 'lodash/camelCase';
import { useDispatch, useSelector } from 'react-redux';
@@ -14,6 +14,7 @@ import postsMessages from '../discussions/posts/post-actions-bar/messages';
import { setFilter as setTopicFilter } from '../discussions/topics/data/slices';
const Search = ({ intl }) => {
const [previousSearchValue, setPreviousSearchValue] = useState('');
const dispatch = useDispatch();
const { page } = useContext(DiscussionContext);
const postSearch = useSelector(({ threads }) => threads.filters.search);
@@ -35,6 +36,7 @@ const Search = ({ intl }) => {
dispatch(setSearchQuery(''));
dispatch(setTopicFilter(''));
dispatch(setUsernameSearch(''));
setPreviousSearchValue('');
};
const onChange = (query) => {
@@ -42,7 +44,7 @@ const Search = ({ intl }) => {
};
const onSubmit = (query) => {
if (query === '') {
if (query === '' || query === previousSearchValue) {
return;
}
if (isPostSearch) {
@@ -52,6 +54,7 @@ const Search = ({ intl }) => {
} else if (page === 'learners') {
dispatch(setUsernameSearch(query));
}
setPreviousSearchValue(query);
};
useEffect(() => onClear(), [page]);

View File

@@ -58,7 +58,9 @@ const CommentEditor = ({
const initialValues = {
comment: comment.rawBody,
// eslint-disable-next-line react/prop-types
editReasonCode: comment?.lastEdit?.reasonCode || (userIsStaff ? 'violates-guidelines' : ''),
editReasonCode: comment?.lastEdit?.reasonCode || (
userIsStaff && canDisplayEditReason ? 'violates-guidelines' : undefined
),
};
const handleCloseEditor = (resetForm) => {