Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin cheerio #5401

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@
"enzyme-adapter-react-16": "^1.15.2"
},
"resolutions": {
"merge": "^2.1.1"
"merge": "^2.1.1",
"cheerio": "1.0.0-rc.12"
},
"packageManager": "[email protected]"
}
6 changes: 2 additions & 4 deletions static/js/actions/programs.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@ export const addProgramEnrollment = (
dispatch(receiveAddProgramEnrollmentSuccess(enrollment))
dispatch(
setToastMessage({
message: `You are now enrolled in the ${
enrollment.title
} MicroMasters`,
icon: TOAST_SUCCESS
message: `You are now enrolled in the ${enrollment.title} MicroMasters`,
icon: TOAST_SUCCESS
})
)
dispatch(setEnrollProgramDialogVisibility(false))
Expand Down
6 changes: 1 addition & 5 deletions static/js/components/DiscussionCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import { channelURL, postURL } from "../lib/discussions"
import type { Post } from "../flow/discussionTypes"
import CardContent from "@material-ui/core/CardContent"

const formatTime = R.compose(
date => date.fromNow(),
moment,
R.prop("created")
)
const formatTime = R.compose(date => date.fromNow(), moment, R.prop("created"))

const renderPosts = R.compose(
R.map(post => (
Expand Down
5 changes: 4 additions & 1 deletion static/js/components/ErrorMessage_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ describe("ErrorMessage", () => {
const renderErrorMessage = props => {
return makeStrippedHtml(<ErrorMessage {...props} />)
}
const codeAttributes = [["error_code", "500"], ["errorStatusCode", 404]]
const codeAttributes = [
["error_code", "500"],
["errorStatusCode", 404]
]
const messageAttributes = [
["user_message", "A message"],
["detail", "Some details"]
Expand Down
4 changes: 1 addition & 3 deletions static/js/components/LearnerInfoCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import CardContent from "@material-ui/core/CardContent"

const showLegalNameIfStaff = profile => {
return hasAnyStaffRole(SETTINGS.roles) ? (
<div className="legal-name">{`(Legal name: ${profile.first_name} ${
profile.last_name
})`}</div>
<div className="legal-name">{`(Legal name: ${profile.first_name} ${profile.last_name})`}</div>
) : null
}

Expand Down
7 changes: 1 addition & 6 deletions static/js/components/PersonalTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ export default class PersonalTab extends React.Component {
dispatch: Function
}

sortPrograms = R.sortBy(
R.compose(
R.toLower,
R.prop("title")
)
)
sortPrograms = R.sortBy(R.compose(R.toLower, R.prop("title")))

programOptions = R.compose(
R.map(program => ({ value: program.id, label: program.title })),
Expand Down
9 changes: 3 additions & 6 deletions static/js/components/PersonalTab_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,9 @@ describe("PersonalTab", () => {
.find("Select")
.props().options
assert.equal(programOptions.length, PROGRAMS.length)
const sortedEnrollments = R.sortBy(
R.compose(
R.toLower,
R.prop("title")
)
)(PROGRAMS)
const sortedEnrollments = R.sortBy(R.compose(R.toLower, R.prop("title")))(
PROGRAMS
)
programOptions.forEach((menuItem, i) => {
const program = sortedEnrollments[i]
assert.equal(program.title, menuItem.label)
Expand Down
12 changes: 4 additions & 8 deletions static/js/components/channels/withChannelCreateDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ export const withChannelCreateDialog = (WrappedComponent: ReactClass<*>) => {
this.closeAndClearDialog()

if (SETTINGS.open_discussions_redirect_url) {
const channelUrl = `${
SETTINGS.open_discussions_redirect_url
}channel/${channel.name}`
const channelUrl = `${SETTINGS.open_discussions_redirect_url}channel/${channel.name}`
window.open(channelUrl, "_self")
}
},
Expand All @@ -114,11 +112,9 @@ export const withChannelCreateDialog = (WrappedComponent: ReactClass<*>) => {
)
}

updateFieldEdit = R.curry(
(fieldName, e): void => {
this.updateChannelChanges(fieldName, e.target.value)
}
)
updateFieldEdit = R.curry((fieldName, e): void => {
this.updateChannelChanges(fieldName, e.target.value)
})

render() {
const {
Expand Down
5 changes: 4 additions & 1 deletion static/js/components/dashboard/courses/Grades_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ describe("Course Grades", () => {
})

it("should only display the course grade if has_exam == false", () => {
[[true, 3], [false, 1]].forEach(([hasExam, expectedGradeCount]) => {
[
[true, 3],
[false, 1]
].forEach(([hasExam, expectedGradeCount]) => {
course.has_exam = hasExam
const grades = renderGrades()
assert.equal(
Expand Down
20 changes: 6 additions & 14 deletions static/js/components/dashboard/courses/StatusMessages_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,7 @@ describe("Course Status Messages", () => {
` Enrollment starts ${formatDate(moment().add(10, "days"))}.`
]
]) {
it(`should nag about missing the payment deadline when future re-enrollments and date is ${
nextEnrollmentStart[0]
}`, () => {
it(`should nag about missing the payment deadline when future re-enrollments and date is ${nextEnrollmentStart[0]}`, () => {
makeRunPast(course.runs[0])
makeRunMissedDeadline(course.runs[0])
makeRunOverdue(course.runs[0])
Expand All @@ -427,10 +425,8 @@ describe("Course Status Messages", () => {
const date = formatDate(course.runs[1].course_start_date)
assertIsJust(calculateMessages(calculateMessagesProps), [
{
message: `You missed the payment deadline, but you can re-enroll. Next course starts ${date}.${
nextEnrollmentStart[1]
}`,
action: "course action was called"
message: `You missed the payment deadline, but you can re-enroll. Next course starts ${date}.${nextEnrollmentStart[1]}`,
action: "course action was called"
}
])
assert(
Expand Down Expand Up @@ -534,9 +530,7 @@ describe("Course Status Messages", () => {
` Enrollment starts ${formatDate(moment().add(10, "days"))}.`
]
]) {
it(`should inform next enrollment date after failing edx course when date is ${
nextEnrollmentStart[0]
}`, () => {
it(`should inform next enrollment date after failing edx course when date is ${nextEnrollmentStart[0]}`, () => {
makeRunPast(course.runs[0])
makeRunFailed(course.runs[0])
makeRunFuture(course.runs[1])
Expand All @@ -546,10 +540,8 @@ describe("Course Status Messages", () => {
)
assertIsJust(calculateMessages(calculateMessagesProps), [
{
message: `You did not pass the course, but you can re-enroll. Next course starts ${date}.${
nextEnrollmentStart[1]
}`,
action: "course action was called"
message: `You did not pass the course, but you can re-enroll. Next course starts ${date}.${nextEnrollmentStart[1]}`,
action: "course action was called"
}
])
assert(
Expand Down
7 changes: 1 addition & 6 deletions static/js/components/email/EmailCompositionDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ const convertHTMLToEditorState = (html: string): Object => {
const editorStateFromProps = R.compose(
S.maybe({ editorState: EditorState.createEmpty() }, R.objOf("editorState")),
S.map(convertHTMLToEditorState),
S.filter(
R.compose(
R.not,
R.isEmpty
)
),
S.filter(R.compose(R.not, R.isEmpty)),
getm("body"),
R.pathOr({}, ["activeEmail", "inputs"])
)
Expand Down
8 changes: 3 additions & 5 deletions static/js/components/email/hoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ export const withEmailDialog = R.curry(
}
}

updateEmailFieldEdit = R.curry(
(fieldName, e): void => {
this.saveEmailChanges(fieldName, e.target.value)
}
)
updateEmailFieldEdit = R.curry((fieldName, e): void => {
this.saveEmailChanges(fieldName, e.target.value)
})

updateEmailBody = (editorState: EditorState): void => {
this.saveEmailChanges(
Expand Down
9 changes: 3 additions & 6 deletions static/js/components/email/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,9 @@ export const getFilters = (root: Object) => {
}

export const AUTOMATIC_EMAIL_ADMIN_CONFIG: EmailConfig = {
title: "Edit Email Campaign",
editEmail: actions.automaticEmails.patch,
emailSendParams: R.compose(
convertEmailEdit,
R.prop("inputs")
),
title: "Edit Email Campaign",
editEmail: actions.automaticEmails.patch,
emailSendParams: R.compose(convertEmailEdit, R.prop("inputs")),
supportBulkEmails: true,

emailOpenParams: (emailOpenParams: AutomaticEmail) => ({
Expand Down
7 changes: 1 addition & 6 deletions static/js/components/search/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,7 @@ export const NestedAccessorMixin = BaseSearchkitAccessorClass =>
const matcher = matchFieldName(oldKey)
filtersMap = R.compose(
R.fromPairs,
R.reject(
R.compose(
matcher,
R.view(R.lensIndex(0))
)
),
R.reject(R.compose(matcher, R.view(R.lensIndex(0)))),
R.toPairs
)(filtersMap)

Expand Down
5 changes: 1 addition & 4 deletions static/js/containers/AutomaticEmailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ const noEmailsMessage = () => (
const emptyMessage = automaticEmails =>
fetchingEmail(automaticEmails) ? <CircularProgress /> : noEmailsMessage()

const notEmpty = R.compose(
R.not,
R.isEmpty
)
const notEmpty = R.compose(R.not, R.isEmpty)

type AutomaticEmailsType = RestState<Array<AutomaticEmail>> & {
emailsInFlight: Set<number>
Expand Down
5 changes: 1 addition & 4 deletions static/js/containers/CopyLinkDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,4 @@ const mapDispatchToProps = dispatch =>
["setRecordShareLink", setRecordShareLink]
])

export default connect(
mapStateToProps,
mapDispatchToProps
)(CopyLinkDialog)
export default connect(mapStateToProps, mapDispatchToProps)(CopyLinkDialog)
6 changes: 2 additions & 4 deletions static/js/containers/DashboardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,8 @@ class DashboardPage extends React.Component {
dispatch(
setToastMessage({
title: "Course Enrollment",
message: `Something went wrong. You paid for this course '${
course.title
}' but are not enrolled.`,
icon: TOAST_FAILURE
message: `Something went wrong. You paid for this course '${course.title}' but are not enrolled.`,
icon: TOAST_FAILURE
})
)
} else {
Expand Down
10 changes: 3 additions & 7 deletions static/js/containers/DashboardPage_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,8 @@ describe("DashboardPage", function() {
).then(() => {
assert.deepEqual(helper.store.getState().ui.toastMessage, {
title: "Course Enrollment",
message: `Something went wrong. You paid for this course '${
course.title
}' but are not enrolled.`,
icon: TOAST_FAILURE
message: `Something went wrong. You paid for this course '${course.title}' but are not enrolled.`,
icon: TOAST_FAILURE
})
})
})
Expand Down Expand Up @@ -842,9 +840,7 @@ describe("DashboardPage", function() {

for (const faExpectedObj of faExpectedStateList) {
it(`shows the payment teaser dialog when a user lacks permission
to contact a course team with financial aid status: ${
faExpectedObj.hasFA
}`, () => {
to contact a course team with financial aid status: ${faExpectedObj.hasFA}`, () => {
const course = makeCourse()
course.has_contact_email = true
// Set all course runs to unpaid
Expand Down
4 changes: 1 addition & 3 deletions static/js/containers/FinancialAidCalculator_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,7 @@ describe("FinancialAidCalculator", function() {
)
assert.equal(
document.querySelector(".api-error").textContent,
`There was an error (Error 500: an error message). Please contact ${
SETTINGS.support_email
} \
`There was an error (Error 500: an error message). Please contact ${SETTINGS.support_email} \
if you continue to have problems.`
)
const state = helper.store.getState()
Expand Down
5 changes: 1 addition & 4 deletions static/js/containers/ProfileImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,4 @@ const mapDispatchToProps = dispatch => ({
dispatch: dispatch
})

export default connect(
mapStateToProps,
mapDispatchToProps
)(ProfileImage)
export default connect(mapStateToProps, mapDispatchToProps)(ProfileImage)
5 changes: 1 addition & 4 deletions static/js/containers/RevokeShareDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,4 @@ const mapDispatchToProps = dispatch =>
["setRevokeShareDialogVisibility", setRevokeShareDialogVisibility]
])

export default connect(
mapStateToProps,
mapDispatchToProps
)(RevokeShareDialog)
export default connect(mapStateToProps, mapDispatchToProps)(RevokeShareDialog)
5 changes: 1 addition & 4 deletions static/js/containers/SendGradesDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,4 @@ const mapDispatchToProps = dispatch => {
}
}

export default connect(
mapStateToProps,
mapDispatchToProps
)(SendGradesDialog)
export default connect(mapStateToProps, mapDispatchToProps)(SendGradesDialog)
10 changes: 2 additions & 8 deletions static/js/lib/google_analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ const makeGAEvent = (category, action, label, value) => ({
})

const removeNilValue = R.when(
R.compose(
R.isNil,
R.prop("value")
),
R.compose(R.isNil, R.prop("value")),
R.dissoc("value")
)

const formatGAEvent = R.compose(
removeNilValue,
makeGAEvent
)
const formatGAEvent = R.compose(removeNilValue, makeGAEvent)

export const sendGAEvent = (
category: string,
Expand Down
14 changes: 3 additions & 11 deletions static/js/lib/grades.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,9 @@ import type { Course } from "../flow/programTypes"
// and processing grades, mainly for displaying them in the dashboard

const findLargestGrade = key =>
R.compose(
R.prop(key),
R.reduce(R.maxBy(R.prop(key)), { [key]: 0 })
)

const filterEmpty = S.filter(
R.compose(
R.not,
R.isEmpty
)
)
R.compose(R.prop(key), R.reduce(R.maxBy(R.prop(key)), { [key]: 0 }))

const filterEmpty = S.filter(R.compose(R.not, R.isEmpty))

// getLargestExamGrade :: Course -> Maybe Number
export const getLargestExamGrade = R.compose(
Expand Down
11 changes: 6 additions & 5 deletions static/js/lib/location_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import { codeToCountryName } from "./location"
describe("location", () => {
describe("codeToCountryName", () => {
it("should return a valid country name for a code", () => {
[["US", "United States"], [null, ""]].forEach(
([countryCode, country]) => {
assert.equal(codeToCountryName(countryCode), country)
}
)
[
["US", "United States"],
[null, ""]
].forEach(([countryCode, country]) => {
assert.equal(codeToCountryName(countryCode), country)
})
})
})
})
Loading
Loading