Compare commits
1 Commits
renovate/g
...
aansari/is
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e216d847eb |
@@ -97,7 +97,7 @@ export const postThread = async (
|
||||
content,
|
||||
{
|
||||
following,
|
||||
cohort,
|
||||
groupId,
|
||||
anonymous,
|
||||
anonymousToPeers,
|
||||
notifyAllLearners,
|
||||
@@ -114,7 +114,7 @@ export const postThread = async (
|
||||
following,
|
||||
anonymous,
|
||||
anonymousToPeers,
|
||||
groupId: cohort,
|
||||
groupId,
|
||||
enableInContextSidebar,
|
||||
notifyAllLearners,
|
||||
captchaToken: recaptchaToken,
|
||||
@@ -154,6 +154,7 @@ export const updateThread = async (threadId, {
|
||||
pinned,
|
||||
editReasonCode,
|
||||
closeReasonCode,
|
||||
groupId,
|
||||
} = {}) => {
|
||||
const url = `${getThreadsApiUrl()}${threadId}/`;
|
||||
const patchData = snakeCaseObject({
|
||||
@@ -169,6 +170,7 @@ export const updateThread = async (threadId, {
|
||||
pinned,
|
||||
editReasonCode,
|
||||
closeReasonCode,
|
||||
groupId,
|
||||
});
|
||||
const { data } = await getAuthenticatedHttpClient()
|
||||
.patch(url, patchData, { headers: { 'Content-Type': 'application/merge-patch+json' } });
|
||||
|
||||
@@ -208,7 +208,7 @@ export function createNewThread({
|
||||
following,
|
||||
anonymous,
|
||||
anonymousToPeers,
|
||||
cohort,
|
||||
groupId,
|
||||
enableInContextSidebar,
|
||||
notifyAllLearners,
|
||||
recaptchaToken,
|
||||
@@ -224,12 +224,12 @@ export function createNewThread({
|
||||
following,
|
||||
anonymous,
|
||||
anonymousToPeers,
|
||||
cohort,
|
||||
groupId,
|
||||
notifyAllLearners,
|
||||
recaptchaToken,
|
||||
}));
|
||||
const data = await postThread(courseId, topicId, type, title, content, {
|
||||
cohort,
|
||||
groupId,
|
||||
following,
|
||||
anonymous,
|
||||
anonymousToPeers,
|
||||
@@ -252,7 +252,8 @@ export function createNewThread({
|
||||
}
|
||||
|
||||
export function updateExistingThread(threadId, {
|
||||
flagged, voted, read, topicId, type, title, content, following, closed, pinned, closeReasonCode, editReasonCode,
|
||||
flagged, voted, read, topicId, type, title, content, following,
|
||||
closed, pinned, closeReasonCode, editReasonCode, groupId,
|
||||
}) {
|
||||
return async (dispatch) => {
|
||||
try {
|
||||
@@ -270,6 +271,7 @@ export function updateExistingThread(threadId, {
|
||||
pinned,
|
||||
editReasonCode,
|
||||
closeReasonCode,
|
||||
groupId,
|
||||
}));
|
||||
const data = await updateThread(threadId, {
|
||||
flagged,
|
||||
@@ -284,6 +286,7 @@ export function updateExistingThread(threadId, {
|
||||
pinned,
|
||||
editReasonCode,
|
||||
closeReasonCode,
|
||||
groupId,
|
||||
});
|
||||
dispatch(updateThreadSuccess(camelCaseObject(data)));
|
||||
} catch (error) {
|
||||
|
||||
@@ -140,7 +140,7 @@ const PostEditor = ({
|
||||
notifyAllLearners: false,
|
||||
anonymous: allowAnonymous ? false : undefined,
|
||||
anonymousToPeers: allowAnonymousToPeers ? false : undefined,
|
||||
cohort: post?.cohort || 'default',
|
||||
cohort: post?.groupId || 'default',
|
||||
editReasonCode: post?.lastEdit?.reasonCode || (
|
||||
userIsStaff && canDisplayEditReason ? 'violates-guidelines' : undefined
|
||||
),
|
||||
@@ -175,6 +175,8 @@ const PostEditor = ({
|
||||
|
||||
const submitForm = useCallback(async (values, { resetForm }) => {
|
||||
let recaptchaToken;
|
||||
const groupId = canSelectCohort(values.topic) ? selectedCohort(values.cohort) : undefined;
|
||||
|
||||
if (shouldRequireCaptcha && executeRecaptcha) {
|
||||
try {
|
||||
recaptchaToken = await executeRecaptcha('submit_post');
|
||||
@@ -196,10 +198,9 @@ const PostEditor = ({
|
||||
title: values.title,
|
||||
content: values.comment,
|
||||
editReasonCode: values.editReasonCode || undefined,
|
||||
groupId,
|
||||
}));
|
||||
} else {
|
||||
const cohort = canSelectCohort(values.topic) ? selectedCohort(values.cohort) : undefined;
|
||||
|
||||
await dispatchSubmit(createNewThread({
|
||||
courseId,
|
||||
topicId: values.topic,
|
||||
@@ -209,7 +210,7 @@ const PostEditor = ({
|
||||
following: values.follow,
|
||||
anonymous: allowAnonymous ? values.anonymous : undefined,
|
||||
anonymousToPeers: allowAnonymousToPeers ? values.anonymousToPeers : undefined,
|
||||
cohort,
|
||||
groupId,
|
||||
enableInContextSidebar,
|
||||
notifyAllLearners: values.notifyAllLearners,
|
||||
...(shouldRequireCaptcha && recaptchaToken ? { recaptchaToken } : {}),
|
||||
|
||||
Reference in New Issue
Block a user