TEST PLAN:
- try to bulk_insert something with a missing parent
- notice the actual error that occurs
Change-Id: Id93f3f52f0dc3e2ba50e98e144742b38d152bf5c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236204
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
FIXES CNVS-49060
flag = none
when the row count is exactly
the size of the batch, this
prevents the find_in_batches
code from erroring
TEST PLAN:
1) find things in batches
2) force it to make a temp_table with exactly batch_size
3) batch iteration does not fail
Change-Id: I81ce7f6a58fa45e8041f814bac4cf5ec12879026
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236102
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Gentry Beckmann <gbeckmann@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
fixes CNVS-48937
flag = none
test plan:
* start canvas
* make it talk to some service for some reason
* force the http call to return timeout errors
* after enough of those within a short window
we should start getting circuit breaker errors
* make the http call not die
* 15 seconds later circuit breaker errors should
no longer happen
Change-Id: I3298932114bd2ed4a9e35e78ed41219403d4ee27
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/234637
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
fixes USERS-274
test plan:
* have a lot of users in an account (like 500)
* go to /accounts/self/users
* it should load, and show you how many pages there are
* set the timeout to something absurdly low (like Setting.set('pagination_count_timeout', '1ms'))
* go to the page again
* it should still load the first page quickly, but the pages thingy at the bottom should only list
1 and 2, and then an ellipsis
Change-Id: Ibc07036b39a9f4ed19d8824bb9254b23679298d1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/234557
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
closes APM-11
flag = none
TEST PLAN:
* deploy to some environment with APM enabled
* observe telemetry and confirm root_account
and shard tags
Change-Id: I7246801c51617f10b8b7f3ca69b5d245375e81be
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/230415
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: David Warkentin <dwarkentin@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
closes APM-7, APM-8
flag = none
hardcode set to a very low % of client sampling by default
to keep performance impact low.
test plan:
* make sure telemetry is arriving in datadog APM
* ensure trace traffic level is low, only from one cluster
(proves settings are working)
* canvas should not show degradation in response times post deployment
Change-Id: Ifca8d3f6239d6c4e70098dd2b68b9c2a1950e121
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/230064
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
Currently, this just replaces the dynamic_settings cache;
it will also be used to cache things from vault
flag=none
test plan:
- Dynamic settings specs pass
Change-Id: I314a2c377adbcda59d7a7ec2d7522f25a3de08eb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/224230
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
closes CORE-2754
Change-Id: I38a255abf0f6ae06d3f9323d7da53239a8ebaf47
Reviewed-on: https://gerrit.instructure.com/202528
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
Tested-by: Jenkins
Change-Id: I20d2b6f522a742d220f4263e4d53353bbd996671
Reviewed-on: https://gerrit.instructure.com/146125
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
(Canvas won't even boot with an older version)
so remove conditionals for older features
Change-Id: Ied601ef97f527ac93d386a650a1bd23f198dcf04
Reviewed-on: https://gerrit.instructure.com/143634
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
test-plan:
- without any other plugin defining `#account` on delayed jobs,
`job.account` should still exist and should return Account.default
- with some other plugin already defining `#account` on delayed jobs,
`job.account` should still use the plugin defined behavior
Change-Id: I5c74febd4525b4196e38c632cfb737a97090f704
Reviewed-on: https://gerrit.instructure.com/143005
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Michael Jasper <mjasper@instructure.com>
QA-Review: Michael Jasper <mjasper@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
Test Plan:
* Configure canvas to work with 3rd party service (like address-book)
* Confirm that canvas can connect to third party service
* Save or touch any file (IE app/observers/live_events_observer.rb)
* Reload page, and confirm that canvas can still connect to service
closes RECNVS-246
Change-Id: Ib3a1b12cdc038f90c139e4d4c957e960288b3e9a
Reviewed-on: https://gerrit.instructure.com/138638
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
fetch the entire tree at once, stuff it all in the cache, and
then only read from the cache (don't read for real, since we want
negative cache effects as well)
Change-Id: I18bfca57dcbeb0c1bbfdc90d210ac8de9290d434
Reviewed-on: https://gerrit.instructure.com/138754
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
fixes CNVS-39235
also allow chaining of clusters (to share a cache store among
multiple clusters), and hot-reloading. but do it all carefully so that
if config doesn't change, we don't reconnect, and shared cache stores
are actually shared (not multiple connections)
Change-Id: I2b72472b4d0f4a34619878752801dd5c05a305a8
Reviewed-on: https://gerrit.instructure.com/125833
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
closes CNVS-35834
* allow specifying tree, service, and cluster for consul stuff
* check multiple consul keys for each setting (cluster, env, region, global)
test plan:
* an existing consul environment still works
Change-Id: I48e8fadeac2e140973bfc4b41c1cfb386532d15c
Reviewed-on: https://gerrit.instructure.com/125271
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This method is already defined by YARD, but we don't include YARD in our
production dependencies, so we have to reimplement it.
Test plan: check that production builds work
Change-Id: I1dc383b8ca5414a57151ac409795e53932f9cd8a
Reviewed-on: https://gerrit.instructure.com/122078
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
Fixes: CNVS-35833
There is a lot more than just moving to Consul going on here. The whole
PrefixProxy business wouldn't be required for this change, but it will
be really useful as we move to adding cluster awareness.
Test Plan:
- Have MathMan running
- Update config/consul.yml to enable use_for_svg and
use_for_mml under the math-man init values key
- Start Canvas
- Build an equation with the rich content editor
- The equation should be rendered as usual.
Change-Id: I650527ebaecb6224c6ee6ba26346d27dee33b9d7
Reviewed-on: https://gerrit.instructure.com/111543
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Tyler Pickett <tpickett@instructure.com>
test plan:
- ContentExport.joins(:attachment).where(id: 1).limit(1).
update_all(updated_at: Time.now.utc) should do the right thing
Change-Id: Ibffb448205a823df23a81dae6200db8cd31baf7d
Reviewed-on: https://gerrit.instructure.com/115785
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
fixes CNVS-33651
Test plan:
* Create a course
* Enroll 3 students
* Create 2 assignments with different due dates
* In rails console:
* Submission.pluck(:assignment_id, :cached_due_date) should return
an array of 6 tuples of (assignment id, its due date)
* Create an override for one student on one assignment
* In rails console:
* Submission.where(
assignment_id: <assignment picked above>,
user_id: <user picked above>
).cached_due_date should equal the override date
* Smoke test grading and viewing students in different places to make
sure the new dummy submissions aren't breaking anything
Change-Id: Idc2721fd3f05214555db780b452ddf53e67ff404
Reviewed-on: https://gerrit.instructure.com/109027
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
most of these are simple fixes, but there are a few where the spec has
actually been broken due to underlying API changes, that were masked
due to the generic raise_error matcher
fixes CNVS-35542
Change-Id: I982e7ab9af59101b79fdf6b2e0816b374a6a6d5b
Reviewed-on: https://gerrit.instructure.com/104750
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
to avoid serializing massive amounts of tz data into audit logs
Change-Id: If9959f461c3e5f992b29e014900bc845b2dcc4a0
Reviewed-on: https://gerrit.instructure.com/104314
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
in particular, completely dump the quoting monkeypatch and specs -
we no longer know what column it's quoting for at this level, and
the float problems have long been fixed in rails proper
Change-Id: I9bbd214e6c866fcae1222f368f544f4805aac1cf
Reviewed-on: https://gerrit.instructure.com/103830
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Fixes CNVS-34757
On the back-end, automatically localize numbers that are part of a
localized string even if the developer has forgotten to do so
explicitly. We already did this for the %{count} placeholder, now
do it for any interpolated number. Any explicitly localized numbers
will be unaffected.
Test plan:
* Confirm localization works as per usual
* Confirm this new behavior works in places where we don't explicitly
localize the number, e.g. upload a bigger file than is allowed by the
quota and confirm the error message says something like "file size
exceeds quota limits: 2,097,152 bytes" (instead of "2097152 bytes")
Change-Id: I6896a2c31b1f6debad96c974b1c8b95f653268d9
Reviewed-on: https://gerrit.instructure.com/101137
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Cemal Aktas <caktas@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
especially since randomizing db sequences, account ids often have a "99"
in them somewhere, so make sure we're checking the right thing
Change-Id: I3089993ff3028b1c602e718150e31c98c11dee94
Reviewed-on: https://gerrit.instructure.com/103207
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
based on previous tests we though a default precision of 9 with
insignificant zeros striped was safe, but with large numbers it
breaks down in javascript. for example:
50000000.12.toFixed(9) // => "50000000.119999997"
after more testing with large numbers a precision of 5 will be safe
and should be sufficient. anything needing more specify an explicit
precision.
fixes CNVS-34986
test plan:
- enter 50000000.12 and other large numbers with decimals in a rubric
- ensure the number gets displayed correctly
Change-Id: I10c115dbcd8232632d2822f5301c5eb161ee019d
Reviewed-on: https://gerrit.instructure.com/102292
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Cemal Aktas <caktas@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
closes CNVS-33864
test plan: specs pass
Change-Id: Ida6d8adfde3e4c59f40dd876d2f184dc7ae97256
Reviewed-on: https://gerrit.instructure.com/97641
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
refs CNVS-33864
test plan: specs should pass
Change-Id: I27bb28b7f0076ea6ba01ad7e6a89dbf200b7886d
Reviewed-on: https://gerrit.instructure.com/97638
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
fixes CNVS-33187, CNVS-33546
switch existing usage of number_(to|with)_(delimiter|precision|rounded|percentage)
to the new helper, and simplifying local arguments
test plan:
* have at least 1000 courses, and 1000 files
* make sure jobs have run to generate the statistics
* go to /accounts/x/statistics
* the numbers for course and files should have a thousands delimiter
(i.e. "1,000", not "1000")
Change-Id: Ica8ccccba478030f5b4712f739b3120192313386
Reviewed-on: https://gerrit.instructure.com/96127
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Change-Id: Id1900160375644ea33badaa9d9f9185fab6b81ac
Reviewed-on: https://gerrit.instructure.com/92726
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
stub out external stuff in specs. once we do so in plugins, we can
change this to `WebMock.disable_net_connect! allow_localhost: true`
previously it would either allow or disallow requests across the board,
depending on which spec files were loaded, which caused flickering
failures.
Change-Id: I1da58596dc7b781710ed615dd700850d3fea555a
Reviewed-on: https://gerrit.instructure.com/92634
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
refs CNVS-28112
test plan:
* translations should still be correct, especially check
- date and time pickers
- calendar
- RCE
Change-Id: I283c7eb1ee24bca3878ae331b8419379bef434db
Reviewed-on: https://gerrit.instructure.com/74823
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
they were all cleaned by the psych migration
closes #CNVS-28871
Change-Id: I788a68900e6e3fc6371331ab9f4bf37035a664c8
Reviewed-on: https://gerrit.instructure.com/77584
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
closes CNVS-28105
TEST PLAN:
1) remove consul config file
2) use a dynamic_settings.yml file
3) Canvas::DynamicSettings calls should work from the console
returning the data in the file
Change-Id: I90ee2a3fb3e660ef4f527f23bcf2d5b24db8fad4
Reviewed-on: https://gerrit.instructure.com/74782
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
closes CNVS-27597
We need to not slam consul for rarely changing data.
the '#find' method still gets the value from consul everytime.
Cache can be infinite or with timeout.
TEST PLAN:
1) have some data in consul for what the signing secret is for canvas
2) Make sure to query it (Canvas::Security::ServicesJwt.signing_secret)
3) change the consul data
4) query it again, it should not have updated
5) send a SIGHUP
6) query it again, it should have changed
Change-Id: I5b923b8e44ab90692e87969c494a7c65fafcad72
Reviewed-on: https://gerrit.instructure.com/73198
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins
Reviewed-by: David Adams <dadams@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
before this patch, if you violate a foreign key
while in a temp table transaction, you just
would see the error generated when we fail to drop the
temp table in the ensure block
Change-Id: I7975c5c9cd7101b21452006abb2f30dbc855fa50
Reviewed-on: https://gerrit.instructure.com/72458
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
TEST PLAN:
1) start canvas with no consul config
2) no error messages should be logged
Change-Id: I55898e1630b63ca5a96d1d178dba6db66c844fb5
Reviewed-on: https://gerrit.instructure.com/71009
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
refs #CNVS-26056
Change-Id: I6bd8f15c375afc1bbb49d156949c1a92bd1c01d3
Reviewed-on: https://gerrit.instructure.com/70497
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
either with Relation#all or Association#scope
refs #CNVS-26056
Change-Id: Ie370a3c47c575007ce3b0ba75a122d854e6f8fbc
Reviewed-on: https://gerrit.instructure.com/69497
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
fixes various brittle specs
Change-Id: Ia595df0865efb3cdfcdd73d62adba9c40cf6f737
Reviewed-on: https://gerrit.instructure.com/68684
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
refs CNVS-24816
create the feature flag and expose it in
the Eportfolios controller
Add a consul docker container to docker-compose.yml,
and a class for consuming settings in consul.
Also, add the ability to init config values
into consul from the consul.yml file
TEST PLAN:
1) edit your consul.yml to look kinda like this:
development:
host: consul
port: 8500
ssl: false
init_values:
rich-content-service:
app-host: rce.docker
cdn-host: rce.docker
2) go to edit an eportfolio as a logged in user
3) check in js console "ENV.RICH_CONTENT_SERVICE_ENABLED"
4) should be "true" or "false" depending on the feature
flag state for that user's root account
5) with the feature flag on, refresh and check the env
6) should have values in the env for
RICH_CONTENT_APP_HOST and RICH_CONTENT_CDN_HOST
Change-Id: Ic138e24416b2aadd965ce4811d3c56538de391bc
Reviewed-on: https://gerrit.instructure.com/66614
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
refs #CNVS-21596
Change-Id: I430704d1f40aa8bcd54072a13ef55aa6a5332dd1
Reviewed-on: https://gerrit.instructure.com/58955
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
closes CNVS-21340
this initializer was producing the right keys, but not
with indifferent access, so string access wasn't working and the
linkedin registered service would just die.
Also fixed a problem in the twitter connector which has the same
issue with running a find at initialization time.
TEST PLAN:
1) linked in as a registered service should not break horribly
2) twitter as a registered service should not break horribly
Change-Id: Iaa3a5c7f3f0ac5561079a334493d215399d45d76
Reviewed-on: https://gerrit.instructure.com/57186
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Jenkins
closes CNVS-21297
These settings are referenced everywhere else with "consumer"
prefixes rather than "client" prefixes, this fixes that typo.
Also makes the config hash with indifferent access,
wraps the configuration in a testable object, and
relaxes the twitter gems' requirement for a Proc,
letting it be satisfied with a callable object.
(also started unit tests on that object
since I was touching it anyway and it had none)
TEST PLAN:
1) twitter as a registered service works
Change-Id: I9daf03547c3e60b99bdd6c24a4c632b0f8b6b091
Reviewed-on: https://gerrit.instructure.com/57074
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
closes CNVS-20176
in several places we check the postgresql version to see
if we can use the NO KEY UPDATE lock style. This abstracts
those checks into one place in our active record initializer.
TEST PLAN:
1) make sure course enrollments still works, enrolling in a course
makes use of this directly.
2) make sure importing a CSV for SIS still works.
Change-Id: Ifc3fe364058e22c75b4fb035695da0a2e5cf066d
Reviewed-on: https://gerrit.instructure.com/53861
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
and make module prerequisites endpoint use this function.
test plan:
- have a quiz in a module that is locked by preceding module
items with incomplete requirements in a module that requires
sequential progress
- navigate to the quiz via the module sequence footer
- completion prerequisites should be shown
fixes CNVS-20114
Change-Id: I390bc41c2df0d11909502dbba0b9a2b0fa1c96d3
Reviewed-on: https://gerrit.instructure.com/53219
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
refs CNVS-16459
this logic was problematic for cases where we're doing more
manually-constructed select statements that DO indeed
have the primary key in them, but don't manifest them in the
select array the same way a symbol array does when you use
the higher level Model.select(:id, :name).
Here we try to account for cases where we're including the .* finder,
or where the primary key is part of one bigger string, or is prefixed
with the table name, and we need to not use a cursor (an
example would be when running long batch finds on a slave database
where the conflict/resolve cycle will kill any transactions that are
open too long, like very long cursors.)
TEST PLAN:
...general regression of finders that pull up many records? Make
sure we didn't bork anything, but I can't think of an explicit case
at the feature level that would leverage this correctly.
We'll be making one such change over in account_reports for the same
ticket that's ref'd above, so may verify them together?
Change-Id: I732fce10d6f2bbdc63be0d5776d5e05f9fcffcca
Reviewed-on: https://gerrit.instructure.com/50657
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
fixes CNVS-17179, CNVS-17182, CNVS-17183, CNVS-17184, CNVS-17195
this was a regression in the i18nliner commit. this fixes anywhere we are
doing I18n.t calls in a model (validations, role names, etc.)
test plan:
1. run canvas w/ optimized js and translations enabled
2. refer to listed tickets and confirm they are working now
Change-Id: Ic84244fef0419eaf6c9656e91f322bda1286dbd3
Reviewed-on: https://gerrit.instructure.com/47391
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
fixes CNVS-16816
test plan:
- make sure that the following are properly filtered
from modules with DA on/off
- quizzes
- assignments
- graded discussions
- ungraded discusisons
- wiki pages
- check for modules index & student progressions page
- discussion topic index properly filters with DA
ON and OFF
Change-Id: Id0e2e97d2d876dfb48968163bf140da42183a3c9
Reviewed-on: https://gerrit.instructure.com/45133
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
closes CNVS-15881
This mostly involved adding hooks to the gem for things that we were
directly modifying in Canvas, then hooking into those points in the
canvas config/initializers/delayed_job.rb file.
Periodic jobs scheduling changed a bit as well -- there's no longer
support in the extracted gem for reading a special file under config/,
so I moved our periodic_jobs.rb file to a normal initializer.
test plan: delayed jobs should still work as before, including queuing
jobs, running the worker pool, and in tests.
Change-Id: I9ce57091d18f21f4355011fcb75230193d53facb
Reviewed-on: https://gerrit.instructure.com/42027
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
fixes #CNVS-12711
Using three seperate trigram searches
when looking for courses by a name match
is taking more time than we'd like.
This builds an index for all 3 relevant
columns together and reworks the scope
that references them to build a search
clause that takes advantage of that index.
TEST PLAN:
- no behavior changes, just performance improvements
- regression test /users/x/manageable_courses api
endpoint with a name parameter as that's what
makes the primary use of this query.
Change-Id: Ia645da66f0df1a4cec9298f7fa941fa51de815f4
Reviewed-on: https://gerrit.instructure.com/40507
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
fixes CNVS-13306
fixes gh-453
MySQL refuses to change columns that have a foreign key on them
Test plan
- Run the polling migrations on MySQL
- They should migrate the database correctly.
Change-Id: Ib781c5237c0973b254043096e536ac094dd809cf
Reviewed-on: https://gerrit.instructure.com/35511
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
also add hash of query to temp table name. this fixes nested
queries, but also defeats query cache getting confused
fixes CNVS-13783
test plan:
* *don't* have a slave configured in database.yml
* run the last_user_access report
* it should work
Change-Id: I6fba9826f6cfee5a2e651157fd898f42c0e1345e
Reviewed-on: https://gerrit.instructure.com/36911
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
fixes CNVS-13824
test plan:
- with rails3, you should be able to create new course modules without error
Change-Id: I02c38f6d50eff575fc4c7f3371735eaf5d33f332
Reviewed-on: https://gerrit.instructure.com/37165
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
test plan:
* run specs
Change-Id: Ic2a76e3c6290c06f68f06796babbdc5ff3b405d9
Reviewed-on: https://gerrit.instructure.com/29733
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
gives a default region-qualified value for any canvas-supported locale.
e.g. if I18n.locale is :en, I18n.qualified_locale is 'en-US'.
Change-Id: Iac5697bde840385fe2d643da5cb80918585113a7
Reviewed-on: https://gerrit.instructure.com/24673
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
already fixed, just need to move it out of the CANVAS_RAILS2 branch.
also, we don't care about quoting of money or binary columns, and the
default quoting of them changed from rails 2 to rails 3, so don't test
them
Change-Id: I26a556020ec672ff2818470b503aa9f0961a98e4
Reviewed-on: https://gerrit.instructure.com/30307
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
still runs :after hooks even though it's pending
Change-Id: Ibb0909084a5f6cc279049d216485db779006b210
Reviewed-on: https://gerrit.instructure.com/30394
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
in rails 3, ActionController::TestUploadedFile has
been moved to Rack::Test::UploadedFile. This commit
simply updates uses of TestUploadedFile to work
with this new structure
Change-Id: Ib31159c635f033a13908608dffeea88c8f719086
Reviewed-on: https://gerrit.instructure.com/28234
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
test plan:
- create a new discussion
- attach a non-ASCII file
- save the discussion
- it shouldn't explode
Change-Id: I9ada9dbf2bf25e63baab22f6117171436d4808c6
Reviewed-on: https://gerrit.instructure.com/27832
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
test plan:
- have a Canvas instance that uses local file storage (not S3)
- acquire an Android app that can talk to this instance
(the Play Store build will not)
- ensure the app can upload a file (such as a profile picture)
to the Canvas instance
fixes CNVS-10065
Change-Id: I942cc60c5a408a064955e0c2f629d4a02d366a5e
Reviewed-on: https://gerrit.instructure.com/27698
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Severson <markse@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
test plan
- specs should pass
Change-Id: I37857a560d3159c77706bfc737e71c7ac62c3428
Reviewed-on: https://gerrit.instructure.com/25771
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
rather than rails2.3 style validate_on_* and before_validation_on_*
fixes CNVS-8752
test-plan: (in script/console)
- initialize a discussion entry (not yet saved)
- set entry.depth to DiscussionEntry.max_depth + 1
- try to save it; should raise an error about the maximum depth
- set entry.depth to nil
- save it; should not encounter an error
- check entry.depth; should be 1
[this next part seems weird to me, but follows the letter of the code]
- with the same, no-longer-new entry, set entry.depth to nil
- try to save it; should not encounter an error
- check entry.depth; should still be nil
Change-Id: Ia56a7ab17d36698e59fda4b520b07352d61ce02e
Reviewed-on: https://gerrit.instructure.com/24997
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
The query string is the same each time, so AR was returning the cached
results.
fixes CNVS-7117
test plan:
* in script/console on your dev box, run:
User.connection.cache { User.transaction { User.find_each(batch_size: 1) { |u| puts u } } }
it should print out each user, rather than getting stuck in an infinite loop
Change-Id: Ib30b085618917dad8bf8d6bcc04687e04ac12340
Reviewed-on: https://gerrit.instructure.com/22645
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
fixes CNVS-5852
if a value has a (approximate) integer representation that's *not* used
by rails' default quoting (e.g. a float, time, etc.) use that
representation rather than issuing an invalid query.
if a value has no appropriate integer representation that's not already
used by rails' default quoting (e.g. a symbol, class, object, etc.),
raise StatementInvalid immediately without actually issuing the invalid
query.
also restructures the Infinity/NaN patch to make it amenable to
"stacking" with this one. its behavior should be unchanged.
test-plan:
- in script/console, try Course.find_by_id with non-integer values
- should execute the query with an integer cast if available
(examples: 1.2 -> 1, '1.2' -> 1, Time.now -> 1369087209, etc.)
- should raise ActiveRecord::StatementInvalid *without* pinging the
database if no integer cast is available
(example: :foo, Course, Object.new)
Change-Id: I100cf6a290397cd56b0136e47e16d38ab075aeb4
Reviewed-on: https://gerrit.instructure.com/20775
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
- update the Gemfile to be 1.9 only, and raise an exception on wrong
ruby version
- remove RUBY_VERSION checks, replacing with the applicable code
- remove the FasterCSV compatibility shim, just use CSV now
test plan: trying to bundle install on ruby 1.8 or 2.0 should raise an
exception, specs should pass, canvas should work as normal on 1.9
Change-Id: I49088e9d227c59c6d5d5acb417c2df971129474a
Reviewed-on: https://gerrit.instructure.com/19806
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
Rails 2.3 decided to warn every time this method is called when on Ruby
1.9 -- and this method is called lots of times every request. We don't
actually put non-ascii text in URLs but I switched to using
I18n.transliterate rather than a no-op anyway, since that's what Rails 3
does.
fixes CNVS-4864
test plan: generating urls from routes should still work (you can test
this by loading most any page in canvas), and you shouldn't see warnings
in the log: "Ruby 1.9 doesn't support Unicode normalization yet"
Change-Id: Ie99425bb04989c3d671e6761ee519f4cce66cd01
Reviewed-on: https://gerrit.instructure.com/18721
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
This was spewing mad warnings every time the method was run, because
ruby doesn't like applying the //n regex option to utf-8 strings.
test plan: specs should pass, naming your user to something like "<&>'"
should escape properly on display, same as before.
Change-Id: I72c27fdc1ec025f0707c002f2e38d15cbdf2c61d
Reviewed-on: https://gerrit.instructure.com/18379
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Browsers tend to send a filename, but some API clients don't.
fixes CNVS-4233
test plan: do a multipart file upload to an api endpoint, such as a sis
api, and leave out the filename=/original/filename component of the
parameter. the upload should still be accepted and no error raised.
Change-Id: I9be8d425693cfb9d8d44644e57358f5dc9cee4c1
Reviewed-on: https://gerrit.instructure.com/18114
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Backported from ruby 2.0 (and possibly later 1.9 patchlevels) because it
was filling our logs with many millions of warnings. The code was
backported directly, the test was backported with conversion from
minitest -> rspec.
test plan: Delayed jobs that use ruby's net libraries should still work,
such as sending messages, taking web snapshots, etc. You shouldn't see
any further lines like this in the log:
net/protocol.rb:313: warning: regexp match /.../n against to UTF-8 string
Change-Id: Ic29daa4ee9f0587fb2a1ac2968cd08a2f68365a1
Reviewed-on: https://gerrit.instructure.com/17431
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
refs CNVS-1368
This backports a Rails 3.1 fix as a monkey patch to our Rails 2.3.X
installation. It should address unquoted instances of Infinity we are
seeing occasionally in web conference queries.
The test plan for this is not UI-based, since I was unable to reproduce
by poking around the BigBlueButton web conferences UI.
Test Plan:
- Inside a ./script/console, choose a model with a column of type
"float", like WebConference
- Try to create it with 0.0/0 and 1.0/0 as the value of that column,
like BigBlueButtonConference.new(:duration => 0.0/0).save(false)
- Verify that no database exceptions are thrown
The official Rails commit with this fix is here:
06c23c4c7f
Change-Id: I41141054aa06c88ed121a33e6e2da578ff9be82d
Reviewed-on: https://gerrit.instructure.com/17317
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
refs #CNVS-2326
Added a UserSearch module that provides
and interface for searching across the name,
the email, and the sis id (and the database id),
and added a trigram index on the columns
that will be searched against.
also made a slight refactor to the AR
initializer in order to expose
some of the behavior I wanted more granularly
and added some specs to cover it
fixed a small permissions bug in course.rb
and pulled some scoping out of the courses
controller down into the user search module
TEST PLAN:
This is currently not accessible from
the site itself, this is just the ground
work for the eventual user search api endpoint.
The code is not called by anything currently in
production either so there is no need for
regression testing. The one thing to check would
be the creation of new users (and pseudonyms and
communication channels). There have been new
indexes added to columns on those tables
and there is some documentation indicating
that writing to these indexes can be time
consuming if the data set is quite large. It
would be worth making sure that there have not
been any unacceptable performance regressions
in the creation of any of those record types in
a database that has a full load of data
(comparable to the production environment)
Change-Id: I8fb13a6ec714f27efc8012c5ed2bed4d963c24e6
Reviewed-on: https://gerrit.instructure.com/16459
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>