# frozen_string_literal: true

module SurveysUrlHelper
  def course_survey_url(notification)
    "#{survey_url(notification.survey)}?course_slug=#{notification.course.slug}"
  end
end

# frozen_string_literal: true

module SurveysUrlHelper
  def course_survey_url(notification)
    "#{survey_url(notification.survey)}?course_slug=#{notification.course.slug.gsub('&', '%26')}"
  end
end

Replace ampersand in course slug for survey links
Replace ampersand in course slug for survey links

We disallow "&" in a course title on the frontend, but that validation wasn't preventing submission for several months. We now have 11 courses, most of them recent (and a few much older) that have this character. It's fine except in cases where the slug is passed as a URL param, in which case it gets treated as a separated instead of being automatically encoded in by the browser. This should fix survey links that are going out to Fall 2019 courses.
