spec: fix intermittently failing selenium grades spec

Change-Id: I136428f8da59357f3d9603eb12193f9c2a706d43
Reviewed-on: https://gerrit.instructure.com/9016
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
added selenium spec to quizzes questions spec refs #7402

Change-Id: I1bbe1952f4af04d687de8a622b4e91893d19d06f
Reviewed-on: https://gerrit.instructure.com/8997
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
fix ie 8 select clipping in quizzes, fixes #4681

the driver behind this change was to fix quizzes for IE 8 so that select
options didn't get clipped when the contents were relatively long

summary of changes:

 * replace all select controls in quizzes with ui.selectmenu's
 * upgrade ui.selectmenu
 * tweak active control background to use a gradient instead of an image
 * remove quiz select control bugfix hacks
 * clean up speedgrader selectmenu usuage, which incidentally fixes issue
   where the selectmenu wouldn't close on subsequent clicks
 * fix amd bug in app/views/quizzes/history.html.erb

this change will make html answers in dropdowns fairly trivial to
implement

test plan:
 * create a quiz with matching questions and multiple dropdown
   questions, some with extremely long answer options
 * take the quiz
 * ensure that the selectmenu dropdowns appear and function correctly
   (e.g. all text should be visible for each option when the dropdown is
   expanded)
 * ensure that the selectmenu dropdowns appear and function correctly
   when viewing the quiz submission after the fact (as the student
   and via the teacher, e.g. in speedgrader)
 * use the speedgrader and ensure there are no regressions in the
   student dropdown behavior

Change-Id: I9e50853d4bf1ff4e7e606de872577f374df93061
Reviewed-on: https://gerrit.instructure.com/8869
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
remove notification throttles and increase daily limit; fixes #6955

we had some notifications categories set to throttle in a sliding 24 hour
window, switching to a daily batch mode if we went over the limit. this change
removes that functionality, so all messages simply count toward the total
limit, which has been raised to 500 (still customizable).

test-plan:
- set e.g. discussion notifications to immediate
- do something that generates > 5 messages
- the should all come separately and immediately

Change-Id: I2b67ebb52b019010253b3d746a600dc8dafd7aa5
Reviewed-on: https://gerrit.instructure.com/9015
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
allow setting account grading scheme on course; fixes #5690

we were showing these grading schemes in the list of options you had, but we
weren't allowing them to be set. this brings into line what is
shown in the list with what can be set

test-plan:
- make a course level grading standard and an account level one
- make sure they can both be set for the course (or an assignment in the
  course) both by their creator or another teacher.

Change-Id: I951e7fb6102b8b8574234d0fa201ed0b4eaa5e57
Reviewed-on: https://gerrit.instructure.com/9004
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
student assignment submission api, refs #7171

Allows submitting an assignment as a student.

test plan (API calls):
  * submit as the four supoorted types
  * submit a comment with the submission
  * submit as a user not a student in the course, verify the 401
  * submit invalid data, verify the 400
  * as a teacher, verify you can view and grade the submission

Change-Id: Ie567d57987e2d5ed6532a0616d5a9c4681ee0364
Reviewed-on: https://gerrit.instructure.com/8717
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
fix wording on "Change pts to match rubric?" dialog

changed the wording and pulled it out into a handlebars
template where it belongs.

Test plan:
 * create assignment worth 5 points
 * add a rubric for grading worth 10 points
 * save the rubric
 * verify the "Change points to match rubric?" dialog
   shows up and looks good

also see "should not adjust assignment points
possible for grading rubric" spec in
spec/selenium/assignments_spec.rb

Change-Id: I91615f390988045c80f52e763cf47e262c38bf36
fixes: #7293
Reviewed-on: https://gerrit.instructure.com/8758
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
allow including the PID in syslog logging

test plan:
  * configure syslog logging in your development environment
  * set "include_pid: true" in your log configuration
  * verify that log lines include the proc pid after the process name

Change-Id: I29414acb0b6f7cba06765520b1fb4caf67ebe1a4
Reviewed-on: https://gerrit.instructure.com/9026
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
cache migrations globally closes #7443

we never add/remove migrations while code is running, and expect to
pick up the changes without restarting the process, so this is fine

test plan: n/a

Change-Id: I8420e99bc32b0eb5b166e870b31d8bdb02a7b164
Reviewed-on: https://gerrit.instructure.com/9010
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
remove unused notification categories fixes #7394

also move notifications in "new email messages" to "administrative alerts",
because that's a much better description of them

test plan:
 * go to communication preferences
 * the last one should be "administrative alerts"
 * "Files", "Private message from student", "New email messages",
   and "Context Message" should be nowhere to be found

Change-Id: I8b30d53b8137ab4b17cb436920d87331327e01f9
Reviewed-on: https://gerrit.instructure.com/8996
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
don't fail if entry.id is nil

Change-Id: Ia3138d79e402bfec6a64613ebfbb3f3a5228a31e
Reviewed-on: https://gerrit.instructure.com/9007
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
calendar2: don't show the assignments tab to students

fixes #7033

Test plan:
  - go to calendar2 as a student
  - click on a day to open the new event tab
  - observe that their is no assignment tab
  - teachers should still get the assignment tab

Change-Id: Id74df0e116fa207f70172b15cb22ad5cd6b569bf
Reviewed-on: https://gerrit.instructure.com/9021
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
don't hide student names while editing groups, fixes: #6283

was because the .name selector was getting both the group's
name and each person's name.

test plan:
* go to /courses/x/groups
* click pencil to edit group name
* make sure the group name title disappears but
  the student names inside of it don't

Change-Id: Ifc6a9b41eb6eab244adadab7c4e8d5e4eca02571
Reviewed-on: https://gerrit.instructure.com/8937
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
link to peer reviews from discussion assignment; fixes #5032

we show a link to peer reviews from an assignment that has peer reviews
enabled, but when that assignment is a discussion topic, that link is hard to
get to because the assignment page redirects to the discussion page.

test-plan:
- create a discussion assignment with peer reviews.
- click on the assignment (ie from speedgrader) and the page you end up at
  should have the peer review button in the sidebar.

Change-Id: I17b0940d775a68c6012dc7c20b255ace50f52a74
Reviewed-on: https://gerrit.instructure.com/9034
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
spec: add selenium spec to gradebook2 file refs #7435

Change-Id: I082b0720f67c69df8a744ecb574e5688f344eeee
Reviewed-on: https://gerrit.instructure.com/9032
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Show freeform rubric comments to students, fixes #4864

Rather than displaying the comments, we were just showing the
placeholder "the assessor will use this area to enter comments".

test plan:
  * create an assignment and a rubric used for grading. on the rubric,
    select the "use freeform comments" option.
  * grade a student on the assignment, and enter comments on the rubric
    rows. add some line breaks or urls, to test the html formatting.
  * as a student, go to your course grades summary page
    (/courses/X/grades), verify that when you click to show the rubric,
    the comment is displayed and properly html-ified.
  * as the student, do the same on the individual submission page
    (/courses/X/assignments/Y/submissions/U)

Change-Id: Ic4667eda36064d3fd4d70eec0d2bd7656e543051
Reviewed-on: https://gerrit.instructure.com/8908
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
spec: add selenium spec to assignments file refs #7463 #7464

Change-Id: I0a96538b1413519d1cbdad3d76357baa493e575d
Reviewed-on: https://gerrit.instructure.com/9042
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
handle discussion assignments correcly when unlocking modules

Test Plan:
 * Create a discussion assignment worth 10 points
 * Make a module item that is locked until that item has at least 5 points
 * As a student make a comment on the discussion
 * As the teacher give the student > 5 points.
 * When reloading the modules page for the student the module item should be completed

closes #7170

Change-Id: Ie1eed0dc80cae85427f1a02fc833e33d7864ed49
Reviewed-on: https://gerrit.instructure.com/9040
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
prevent subsequent qti imports from referencing the wrong file

separate qti imports would use the same migration id for
files with the same path/name. This prepends the prepend id
to the attachment's migration id so that these files don't
get mixed up when resolving references to them in html

Test Plan:
 * Import a qti package with an image twice
 * The second import should point to a different attachment id than the first

closes #7305

Change-Id: I1b1f3cb0dbb85eba7352b36c9ca5024a6676b4e9
Reviewed-on: https://gerrit.instructure.com/8976
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
introduce preferred user list search mode

closes #7059, #7411

preferred is a compromise between open registration and closed
registration. if a single user is found, that user is found without
introducing any temporary user to allow user disambiguation.  if no
users are found, or multiple users are found, it's the same behavior
as open registration.

as part of this, the "only search existing users" checkbox has been
removed. instead, preferred searching will be used in the following
cases:
 * adding an admin, and open registration is enabled
 * adding an admin, open registration is disabled, and the user
   has permission to create new users
 * adding a user to a course, open registration is enabled, and
   delegated authentication is in use
 * adding a user to a course, open registration is disabled, and
   the user has permission to create new users

the notable case that preferred searching is not used, and the
user would want to use search existing users is open registration
enabled, and adding a user to a course.  in this case, a temporary
user will be created instead of sending the invitation to the
existing user.  however, the end user experience is identical
(invitation sent to e-mail, invitation visible in the same locations
in the UI), with the small exception that the end user gets the
opportunity to create a separate account if desired (but not
preferred).

test plan:
 * go through each of the cases above for a user that doesn't exist
   yet, a single matching user exists, or multiple users exist.
   it should behave as described above

Change-Id: Idbc7fe23bfc7430b4cd25f7981f5dc08b9e4ffda
Reviewed-on: https://gerrit.instructure.com/8966
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>