delete assignments in new index page

fixes CNVS-7295

test plan
- delete an assignment from the cog menu
- it should show a confirmation pop-up
- the assignment should be deleted when you choose yes

Change-Id: I13ea0901b098c5ceeb1eef076f0b8ebfb5ae7269
Reviewed-on: https://gerrit.instructure.com/23014
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Updated ar translation
display "(no subject)" for conversations w/o subjects.

fixes CNVS-7433

test plan:
  * create a conversation without a subject;
  * navigate to the new conversations interface;
  * verify that both on the conversation detail and in the
    conversation list on the left of the interface display
    "(No subject)".

Change-Id: Id1ab9077ff19c690f3449a591c68860411a90e65
Reviewed-on: https://gerrit.instructure.com/23219
QA-Review: Cam Theriault <cam@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
make slow migration postdeploy

slow migrations that aren't strictly necessary for the new code
should wait until after the deploy

Change-Id: I1bc5837567bccddd3babff57495d46996e45508b
Reviewed-on: https://gerrit.instructure.com/23229
Reviewed-by: Paul Hinze <paulh@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
change new pages to show/hide elements correctly

test plan (in the course and group wikis):
 * enable draft state for the account (enable_draft)
 - general
   * Pages course tab navigates to new pages
     - front page
     - index page (if no front page is set)
   * Pages breadcrumb (in pages) navigates to new pages index
 - index page
   * New Page button is hidden unless user has create rights
   * Publish icon & settings cog hidden unless user is a teacher or admin
 - show page
   * Published button is hidden unless user is a teacher or admin
   * Published button functions properly (publishes and unpublishes)
   * Edit button is hidden unless user has edit rights to the page
   * Settings cog/Delete button is hidden unless the user has delete rights to the page
   * Page content is restricted if the page is locked by a module
 - edit page
   * Published indicator is hidden unless user is a teacher or admin
   * Settings cog/Delete button is hidden unless the user has delete rights to the page
   * Title field is hidden unless user has full edit rights (course setting)
   * Hide this page from students is hidden unless user is a teacher or admin
   * ... can edit this page is hidden unless user has full edit rights (course setting)
   * Unauthorized error if page is locked by a module
 - pages api
   * Unauthorized error when updating page if page is locked by a module

fixes #CNVS-6859

Change-Id: I12239e58a5f267c43fd2bcb912c7b485693de2c1
Reviewed-on: https://gerrit.instructure.com/22677
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Sterling Cobb <sterling@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
add new page functionality to pages

test plan (course wiki and group wiki):
 - ensure that enable_draft is set for the account
 - navigate to the pages index
 * click the add Page button
   - ensure the page behaves as expected
   * editing permissions defaults to the course's setting
   * enter key (invokes the Save button, unless editing the body)
   * Save button (creates and navigates to the page)
   * Cancel button (navigates back to the index, hiding the sidebar)

fixes #CNVS-7167

Change-Id: Ib72f4c60e77420197d6e53efbe21ec46d4caf51f
Reviewed-on: https://gerrit.instructure.com/22701
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Sterling Cobb <sterling@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
fix sharding issue in per-user authentication logs

fixes CNVS-7452

User#active_pseudonyms will query on User#shard regardless of
Shard.current. But the value yielded to a partition_by_shard block is a
set of local_ids. So e.g. if visible_accounts included an account from
shard2 but @user is on shard1, we'd look for a pseudonym on shard1
belonging to both the user and an account on shard1 with the same local
id, rather than looking for a pseudonym on shard2 belonging to both the
user and the intended account.

the majority of the time, this bug would only cause the pseudonym to not
be found (in cooperation with another bug, this caused CNVS-7452). but
this could also provide unintended access, which is more severe. for
example:

 * user1 and account1 are on shard1
 * account2 is on shard2 but has the same local id as account1
 * user1 has pseudonyms in both account1 and account2
 * user2 has admin privileges in account2 but not account1
 * user2 requests user1's authentication log
 * user2 should get the events for the account2 pseudonym
 * user2 gets the events for the account1 pseudonym instead

test-plan:
 - setup user1, user2, account1, account2, and pseudonyms as in the
   example above
 - generate some authentication events for both pseudonyms
 - user2 should get the events for the account2 pseudonym
 - user2 should not get any events for the account1 pseudonym

Change-Id: Icc639d7a4b8217b77bd859629f983fbc1d30ccc0
Reviewed-on: https://gerrit.instructure.com/23204
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
fix bug preventing profile export

fixes CNVS-4438

testing steps:
1. Create an ePortfolio
2. Using the Home Page or New Section edit the page
3. Select the Course Submission tool under Add Content (Top right)
4. You must have a recent assignment submission with attachment
5. Select an assignment submission with an attachment and save the page
6. Navigate to Back to Portfolio Dashboard
7. Select "Download the contents of this ePortfolio as a zip file". It should now work and not hang.

Change-Id: I088388473ae4b7c81581e34e79159ded8a09facd
Reviewed-on: https://gerrit.instructure.com/23211
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
make slow migration postdeploy

slow migrations that aren't strictly necessary for the new code
should wait until after the deploy

Change-Id: I1bc5837567bccddd3babff57495d46996e45508b
Reviewed-on: https://gerrit.instructure.com/23229
Reviewed-by: Paul Hinze <paulh@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
require terms by default, fixes CNVS-7330

they were required prior to our new settings refactors. this way we don't
need to go set it in prod

test plan:
1. terms should be required when registering at /register
2. terms should be required when activing an account (via course
   invitation email)
3. in the console, do Setting.set('terms_required', 'false')
4. terms should no longer be required on those pages

Change-Id: Idb13727839b847845cd4dacde4797e4e1571b42f
Reviewed-on: https://gerrit.instructure.com/22988
Reviewed-by: Mark Ericksen <marke@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
page revisions api

test plan:
 1. consult the Pages API documentation, and notice
   (a) the new "List revisions" endpoint
       and the PageRevision data type it returns
   (b) the "Show revision" endpoint
       (which can accept an id or "latest")
   (c) the "Revert to revision" endpoint
 2. exercise these endpoints as a teacher
   (a) note that reverting a page should not change
       editing roles, hidden, or published state
 3. exercise these endpoints as a student
   (a) students should not be able to list,
       or retrieve prior revisions unless they have
       edit rights to the page
   (b) all students (who can read the page) have permission
       to get the latest version (but edit rights
       are required to get a specific revision number)
   (c) for the revert action, the course permissions must
       allow students to edit wiki pages; if the course
       does not grant wiki edit rights to the student,
       but the page does, the student can change page content
       only (cannot revert or rename)
   (d) for the show revision action, the permissions of the current
       version of the page are applied; students with edit rights
       to it can view or revert to previous versions that
       may have been hidden or unpublished (in other words,
       "hidden" and "unpublished" apply only to the current
       state of the page, not historical versions of it)

fixes CNVS-7301

Change-Id: Ie4948617e24154a61f3111e08fc3f89b9265da6d
Reviewed-on: https://gerrit.instructure.com/23088
Reviewed-by: Mark Severson <markse@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
new conversations ui message sending

fixes CNVS-7329

test plan
- send some messages from the new ui
- ensure that users on the old and new ui can see them and that
 they were sent to the right recipients

note: the new ui does not automatically refresh when sending, so
you won't see the new message

Change-Id: I98e73f845c2012bc2e5367b9363b728e9ffd902a
Reviewed-on: https://gerrit.instructure.com/23207
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
extract EventStream::Index#select_cql

refs CNVS-6755

cleans up code a little, there will be times we need this same snippet
elsewhere

test-plan: N/A

Change-Id: Ia210165f7799b97a825eff0d91c5d3afc416012d
Reviewed-on: https://gerrit.instructure.com/22974
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
make EventStream#fetch_cql public

refs CNVS-6755

Change-Id: I419692e2c2f779091a58bba21288421252124b95
test-plan: N/A
Reviewed-on: https://gerrit.instructure.com/23075
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
ttl_seconds should take timestamp, not record

refs CNVS-6755

there are times we'll want to know it for a given timestamp that's not
necessarily in an instantiated record's created_at.

test-plan:
  - specs pass
  - PageView::EventStream.ttl_seconds(Time.now) should give a value

Change-Id: I6a37810711bb782474e66153a3cf53ace1b55070
Reviewed-on: https://gerrit.instructure.com/22931
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
create foo_index accessor when adding index :foo

refs CNVS-6755

to allow referring to the indexes directly

test-plan: [in script/console]
  # should be able to refer to page view's user index
  index = PageView::EventStream.user_index
  # select a user with page views
  user = User.find(some_user_id)
  # index should be the one underlying PageView::EventStream.for_user
  coll1 = index.for_key(user.global_asset_string)
  coll2 = PageView::EventStream.for_user(user)
  coll1.paginate(:per_page => 3) == coll2.paginate(:per_page => 3)

Change-Id: I5bc481ed1ef61543acd36f800bdcc56a6df4e554
Reviewed-on: https://gerrit.instructure.com/22930
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
roll TempTable up into ActiveRecord itself

removes the confusing options, and simplifies because it has direct
access to the class members that it needs. especially, this made
it trivial to add support for preloads via includes on the scope.

Change-Id: Ia98987de8c4f2ab697781af00bce5006ff456cf3
Reviewed-on: https://gerrit.instructure.com/22669
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
conversations: fix compose field spacing

fixes CNVS-7436

test plan:
  * open conversations beta
  * open compose dialog
  * verify that spacing on Course, To, and Subject rows
      match the mockup

Change-Id: I6773a1bbc8717bca394e3aea222a749a37e502e7
Reviewed-on: https://gerrit.instructure.com/23233
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
unblack gear menu links

fixes CNVS-7439

test plan
- ensure help and gear menu item in new conversations ui are white

Change-Id: I865c691d540382145327305423d0ec6ba6a7af9d
Reviewed-on: https://gerrit.instructure.com/23235
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
data fixup for page view url param filtering

fixes CNVS-7202

test plan:
* without the CNVS-7202 commits,
  make an api request that gets logged as a page view such as
  /api/v1/courses/X/discussion_topics?access_token=XXX
* then apply this commit and run the data fixup, and verify that the
  data was fixed in the page views store (test with both db store and
  cassandra store)

Change-Id: Id10e1ba69cd8c82797fd5b7bcf6309afa0773288
Reviewed-on: https://gerrit.instructure.com/22729
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>