Skip to content

Commit

Permalink
Merge pull request #6070 from Formasitchijoh/@fix/front-end-bug
Browse files Browse the repository at this point in the history
Fix: front end bugs
  • Loading branch information
ragesoss authored Jan 2, 2025
2 parents efc5e32 + e43a8f2 commit 7517540
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const CourseCreator = createReactClass({

campaignParam() {
// The regex allows for any number of URL parameters, while only capturing the campaign_slug parameter
const campaignParam = window.location.search.match(/\?.*?campaign_slug=(.*?)(?:$|&)/);
const campaignParam = window.location?.search?.match(/\?.*?campaign_slug=(.*?)(?:$|&)/);
if (campaignParam) {
return campaignParam[1];
}
Expand Down Expand Up @@ -162,8 +162,11 @@ const CourseCreator = createReactClass({
cleanedCourse.scoping_methods = getScopingMethods(this.props.scopingMethods);
this.props.submitCourse({ course: cleanedCourse }, onSaveFailure);
}
} else if (!this.props.validations.exists.valid) {
this.setState({ isSubmitting: false });
} else {
const existsValidation = this.props.validations?.exists?.valid;
if (existsValidation === false) {
this.setState({ isSubmitting: false });
}
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const CampaignList = ({ campaigns, course }) => {
let comma = '';
const url = `/campaigns/${campaign.slug}`;
if (index !== lastIndex) { comma = ', '; }
return <span key={campaign.slug}><a href={url}>{campaign.title}</a>{comma}</span>;
return <span key={`${campaign.slug}-${index}`}><a href={url}>{campaign.title}</a>{comma}</span>;
})
: I18n.t('courses.none'));

Expand Down
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Capybara::Screenshot.prune_strategy = :keep_last_run
Capybara.save_path = 'tmp/screenshots/'
Capybara.server = :puma, { Silent: true }

Capybara.default_max_wait_time = 10
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
Expand Down

0 comments on commit 7517540

Please sign in to comment.