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

[Data rearchitecture] sync with master #6119

Merged
Changes from 2 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7696cb4
added script to update hosts for Database Connection Issue While Sett…
JiyaGupta-cs Jan 4, 2025
29e251a
added script info in docker docs
JiyaGupta-cs Jan 4, 2025
9e4e70d
fix guard clause violations
chrisnicollo Jan 5, 2025
e054530
Adds guard statements to prevent `NoMethodError`s when `get_user_info…
empty-codes Jan 6, 2025
151fc26
Merge pull request #6090 from JiyaGupta-cs/update_mysql_hosts
ragesoss Jan 6, 2025
228a8d5
Change threshold for ContinuedCourseActivityAlert
ragesoss Jan 6, 2025
6b586fd
Merge pull request #6097 from empty-codes/fix-nil-user-data-no-method…
ragesoss Jan 6, 2025
9871621
Update dependency documentation
chrisnicollo Jan 5, 2025
098682d
Merge pull request #6092 from chrisnicollo/cc/update_troubleshooting
ragesoss Jan 6, 2025
11a64bd
refactor remaining violations
chrisnicollo Jan 6, 2025
918727d
fix: marked flaky test in multiwiki_assignment_spec as pending
Formasitchijoh Jan 7, 2025
531960e
Merge pull request #6100 from Formasitchijoh/@fix/multiwiki_assignmen…
ragesoss Jan 7, 2025
327f628
fix: update slide removal logic for conditional survey questions
Abishekcs Jan 8, 2025
d003c31
Merge pull request #6093 from chrisnicollo/cc/guard_clause
ragesoss Jan 8, 2025
a54adaa
Send reminder email to new non-instructors who complete onboarding bu…
ragesoss Jan 8, 2025
be8715d
@fix: stubbed api request and updated test for LiftWing, reference_co…
Formasitchijoh Jan 9, 2025
64e9595
fix: Replaced static error count with dynamically generated error cou…
Formasitchijoh Jan 9, 2025
bb2a194
Localisation updates from https://translatewiki.net.
translatewiki Jan 9, 2025
b6d0d14
Merge pull request #6103 from Abishekcs/fix/conditional-survey-questi…
ragesoss Jan 9, 2025
0548e3a
Merge pull request #6105 from Formasitchijoh/mock-flaky-tests
ragesoss Jan 9, 2025
22a97b2
Fix typos in training markup, add script for making a training .docx
ragesoss Jan 10, 2025
c49844d
Delete unused components
ragesoss Jan 9, 2025
75cc798
extended workflow to save screenshot of failed Capybara tests as arti…
Formasitchijoh Jan 7, 2025
515af36
Added rapid: false parameter to textarea set method for slower driver…
Formasitchijoh Jan 10, 2025
b678fe8
Fix: Prevent "Preview Question Group" button from rendering empty page
Abishekcs Jan 10, 2025
666317c
Ensure that PagePile Category records are unique by pileid
ragesoss Jan 10, 2025
4155322
Remove debugging line
ragesoss Jan 10, 2025
4ce9dee
Merge pull request #6108 from Formasitchijoh/workflow-artifact
ragesoss Jan 10, 2025
4f0fbc1
Merge pull request #6110 from Formasitchijoh/refactor-multiwiki-assig…
ragesoss Jan 10, 2025
51f0c56
Merge pull request #6106 from Abishekcs/fix/question-group-preview-bug
ragesoss Jan 10, 2025
35ecd9a
Localisation updates from https://translatewiki.net.
translatewiki Jan 13, 2025
a5fb923
Fix: Prevent state mutation in fetchRevisionsPromise function
Abishekcs Jan 13, 2025
977c438
Chore: Rename `enableMutationChecks` to `enableReduxSafetyChecks`
Abishekcs Jan 13, 2025
92f8b07
Fixes `uploads.json` endpoint returns `500 internal server error` for…
empty-codes Jan 13, 2025
539ee9e
Adheres to `prefer-promise-reject-errors` eslint rule
empty-codes Jan 13, 2025
3938a93
Merge pull request #6114 from empty-codes/fix-allow-decoding-of-filen…
ragesoss Jan 13, 2025
3b708e8
Merge pull request #6112 from Abishekcs/fix/redux-state-mutation
ragesoss Jan 13, 2025
365fd77
Merge pull request #6113 from Abishekcs/chore/redux-safety-checks
ragesoss Jan 13, 2025
783205a
Merge remote-tracking branch 'upstream/master' into data-rearchitectu…
gabina Jan 14, 2025
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
105 changes: 61 additions & 44 deletions app/assets/javascripts/surveys/modules/Survey.js
Original file line number Diff line number Diff line change
@@ -698,50 +698,45 @@ const Survey = {
}
},

// FIXME: This is supposed to remove a conditional question from
// the flow if the condition that it depends on has changed.
// However, when this happens it leaves the survey in a state
// with no visible questions and no way to proceed.
// Disabling this feature means that, once inserted, a conditional
// question will not be removed, but that's better than a broken survey.
resetConditionalGroupChildren(/* conditionalGroup */) {
// const { children, currentAnswers } = conditionalGroup;

// if ((typeof currentAnswers !== 'undefined' && currentAnswers !== null) && currentAnswers.length) {
// const excludeFromReset = [];
// currentAnswers.forEach((a) => { excludeFromReset.push(a); });
// children.forEach((question) => {
// const $question = $(question);
// let string;
// if ($question.data('conditional-question')) {
// string = $question.data('conditional-question');
// } else {
// string = $question.find('[data-conditional-question]').data('conditional-question');
// }
// const { value } = Utils.parseConditionalString(string);
// if (excludeFromReset.indexOf(value) === -1) {
// this.resetConditionalQuestion($question);
// } else {
// $question.removeClass('hidden');
// }
// });
// } else {
// children.forEach((question) => {
// this.resetConditionalQuestion($(question));
// if ($(question).hasClass('survey__question-row')) {
// const $parentBlock = $(question).parents(BLOCK_CONTAINER_SELECTOR);
// const blockIndex = $(question).data('block-index');
// if (!($parentBlock.find('.survey__question-row:not([data-conditional-question])').length > 1)) {
// this.resetConditionalQuestion($parentBlock);
// if (this.detachedParentBlocks[blockIndex] === undefined) {
// this.detachedParentBlocks[blockIndex] = $parentBlock;
// this.removeSlide($parentBlock);
// $parentBlock.detach();
// }
// }
// }
// });
// }
// To remove a conditional question from the flow if the condition that it depends on has changed.
resetConditionalGroupChildren(conditionalGroup) {
const { children, currentAnswers } = conditionalGroup;

if ((typeof currentAnswers !== 'undefined' && currentAnswers !== null) && currentAnswers.length) {
const excludeFromReset = [];
currentAnswers.forEach((a) => { excludeFromReset.push(a); });
children.forEach((question) => {
const $question = $(question);
let string;
if ($question.data('conditional-question')) {
string = $question.data('conditional-question');
} else {
string = $question.find('[data-conditional-question]').data('conditional-question');
}
const { value } = Utils.parseConditionalString(string);
if (excludeFromReset.indexOf(value) === -1) {
this.resetConditionalQuestion($question);
} else {
$question.removeClass('hidden');
}
});
} else {
children.forEach((question) => {
this.resetConditionalQuestion($(question));
if ($(question).hasClass('survey__question-row')) {
const $parentBlock = $(question).parents(BLOCK_CONTAINER_SELECTOR);
const blockIndex = $(question).data('block-index');
if (!($parentBlock.find('.survey__question-row:not([data-conditional-question])').length > 1)) {
this.resetConditionalQuestion($parentBlock);
if (this.detachedParentBlocks[blockIndex] === undefined) {
this.detachedParentBlocks[blockIndex] = $parentBlock;
this.removeSlide($parentBlock);
$parentBlock.detach();
}
}
}
});
}
},

removeSlide($block) {
@@ -753,7 +748,29 @@ const Survey = {
if ($question.hasClass('survey__question-row')) {
$question.removeAttr('style').addClass('hidden not-seen disabled');
} else {
// Find which question group/slider this question belongs to by climbing up the DOM tree
const $grandParents = $question.parents('[data-question-group-blocks]');

// Extract the group's index number so we know which specific slider we need to modify
const questionGroupIndex = $grandParents.data('question-group-blocks');

// Get the actual slider jQuery object that we need to remove the question from
const $slider = this.groupSliders[questionGroupIndex];

// Get the slide index before detaching
const slideIndex = $question.data('slick-index');

// Remove the slide from Slick first
$slider?.slick('slickRemove', slideIndex);

// Then detach the element
$question.detach();

// Updates Progress Bar on Top Right of the UI.
this.indexBlocks();

// Update Slide Button to Determine whether to show Next or Submit button.
this.updateButtonText();
}
$question.find('input[type=text], textarea').val('');
$question.find('input:checked').removeAttr('checked');
10 changes: 2 additions & 8 deletions spec/features/survey_bugs_spec.rb
Original file line number Diff line number Diff line change
@@ -128,14 +128,8 @@
click_button('Next', visible: true) # Q2
end

# Now this question ideally should be skipped
# but the code that did that breaks the survey
# by removing the question without sliding
# the next one into view.
find('.label', text: 'Maybe').click
within('div[data-progress-index="4"]') do
click_button('Next', visible: true) # Q3
end
sleep 2
expect(page).to have_content('Submit Survey')

# Now we can actually submit the survey
# and finish.

Unchanged files with check annotations Beta

export const TitleOpener = ({ showArticle, showButtonClass, showButtonLabel, title }) => (
<div className={`tooltip-trigger ${showButtonClass || ''}`}>
<button style={{ textAlign: 'left' }} onClick={showArticle} aria-describedby="icon-article-viewer-desc">{title}</button>
<p id="icon-article-viewer-desc">Open Article Viewer</p>

Check warning on line 7 in app/assets/javascripts/components/common/ArticleViewer/components/TitleOpener.jsx

GitHub Actions / build

Use I18n over string literals for localization: <p id="icon-article-viewer-desc">Open Article Viewer</p>
<div className="tooltip tooltip-title dark large">
<p>{showButtonLabel()}</p>
</div>

Check warning on line 10 in app/assets/javascripts/components/common/AssignmentLinks/AllPeerReviewLinks.jsx

GitHub Actions / build

Use I18n over string literals for localization: <span key="title">Reviews: </span>
let requestedAccountsLink;
if (!Features.wikiEd) {
const massEnrollmentUrl = `/mass_enrollment/${course.slug}`;
massEnrollmentLink = <p><a href={massEnrollmentUrl}>Add multiple users at once.</a></p>;

Check warning on line 132 in app/assets/javascripts/components/common/enroll_button.jsx

GitHub Actions / build

Use I18n over string literals for localization: <a href={massEnrollmentUrl}>Add multiple users at once.</a>
}
if (!Features.wikiEd) {
const requestedAccountsUrl = `/requested_accounts/${course.slug}`;
let button;
if (isVisible) {
button = <button onClick={hide} className="button dark small">Okay</button>;

Check warning on line 41 in app/assets/javascripts/components/common/final_article_checklist.jsx

GitHub Actions / build

Use I18n over string literals for localization: <button onClick={hide} className="button dark small">Okay</button>
} else {
button = <a onClick={show} className="button dark small">Quality checklist</a>;

Check warning on line 43 in app/assets/javascripts/components/common/final_article_checklist.jsx

GitHub Actions / build

Use I18n over string literals for localization: <a onClick={show} className="button dark small">Quality checklist</a>
}
let modal;
} else {
modal = (
<div ref={ref} className="article-viewer my-assignment-checklist">
<h2>Final review checklist</h2>

Check warning on line 52 in app/assets/javascripts/components/common/final_article_checklist.jsx

GitHub Actions / build

Use I18n over string literals for localization: <h2>Final review checklist</h2>
<p>
As you polish up your completed article, review each of these items and fix any problems you find.
</p>
const wikipediaHelpUser = this.wikipediaHelpUser();
wikipediaHelpButton = (
<span className="contact-wikipedia-help" key={`${wikipediaHelpUser.username}-wikipedia-help`}>
<a href="#" className="wikipedia-help-link button dark small stacked" onClick={e => this.updateTargetUser(wikipediaHelpUser, e)}>question about editing Wikipedia</a>

Check warning on line 114 in app/assets/javascripts/components/common/get_help_button.jsx

GitHub Actions / build

Use I18n over string literals for localization: <a href="#" className="wikipedia-help-link button dark small stacked" onClick={e => this.updateTargetUser(wikipediaHelpUser, e)}>question about editing Wikipedia</a>
<br />
</span>
);
const programHelpUser = this.programHelpUser();
programHelpButton = (
<span className="contact-program-help" key={`${programHelpUser.username}-program-help`}>
<a href="#" className="program-help-link button dark stacked small" onClick={e => this.updateTargetUser(programHelpUser, e)}>question about Wiki Ed or your assignment</a>

Check warning on line 124 in app/assets/javascripts/components/common/get_help_button.jsx

GitHub Actions / build

Use I18n over string literals for localization: <a href="#" className="program-help-link button dark stacked small" onClick={e => this.updateTargetUser(programHelpUser, e)}>question about Wiki Ed or your assignment</a>
<br />
</span>
);
const dashboardHelpUser = this.dashboardHelpUser();
dashboardHelpButton = (
<span className="contact-dashboard-help" key={`${dashboardHelpUser.username}-dashboard-help`}>
<a href="#" className="dashboard-help-link button dark stacked small" onClick={e => this.updateTargetUser(dashboardHelpUser, e)}>question about the dashboard</a>

Check warning on line 134 in app/assets/javascripts/components/common/get_help_button.jsx

GitHub Actions / build

Use I18n over string literals for localization: <a href="#" className="dashboard-help-link button dark stacked small" onClick={e => this.updateTargetUser(dashboardHelpUser, e)}>question about the dashboard</a>
<br />
</span>
);
let button;
if (isVisible) {
button = <button onClick={hide} className="button dark small">Okay</button>;

Check warning on line 20 in app/assets/javascripts/components/common/mainspace_checklist.jsx

GitHub Actions / build

Use I18n over string literals for localization: <button onClick={hide} className="button dark small">Okay</button>
} else {
button = <a onClick={show} className="button dark small">Quality checklist</a>;
}