diff --git a/CHANGELOG.md b/CHANGELOG.md index ac66e52..fbec0ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [1.2] - (16/03/2020) + +### Changed +- Bump SDK version +- Use the request parameters to track the activity instance + +### Added +- Bind default testing Authentication and ActivityInstance contracts in tests ## [1.1.2] - (12/03/2020) @@ -54,7 +61,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Open and save module instances - Change settings, permissions and third party connections -[Unreleased]: https://github.com/bristol-su/playground/compare/v1.1.2...HEAD +[Unreleased]: https://github.com/bristol-su/playground/compare/v1.2...HEAD +[1.2]: https://github.com/bristol-su/playground/compare/v1.1.2...v1.2 [1.1.2]: https://github.com/bristol-su/playground/compare/v1.1.1...v1.1.2 [1.1.1]: https://github.com/bristol-su/playground/compare/v1.1...v1.1.1 [1.1]: https://github.com/bristol-su/playground/compare/v1.0.3...v1.1 diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 4db9b5d..bd1ef54 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -70,7 +70,7 @@ public function render($request, Exception $exception) app(ResourceIdGenerator::class)->fromString($activity->activity_for) ); app(ActivityInstanceResolver::class)->setActivityInstance($activityInstance); - return redirect()->to($request->url()); + return redirect()->to($request->fullUrl()); } return parent::render($request, $exception); diff --git a/composer.json b/composer.json index 99928ec..a2e6ffe 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "require": { "php": "^7.2", "bristol-su/static-page": "^1.0", - "bristol-su/support": "^3.0", + "bristol-su/support": "^3.1", "bristol-su/typeform": "^1.0", "bristol-su/upload-file": "^1.0", "fideloper/proxy": "^4.0", diff --git a/composer.lock b/composer.lock index 993a764..abd18b8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "aedd4d47e518cf9052d4477233b4608c", + "content-hash": "aa5da710b0d95766004413d74aab9391", "packages": [ { "name": "bristol-su/control", @@ -108,16 +108,16 @@ }, { "name": "bristol-su/support", - "version": "v3.0.2", + "version": "v3.1", "source": { "type": "git", "url": "https://github.com/bristol-su/support.git", - "reference": "3999307d92480932810662845daa2688c3cdffa4" + "reference": "f6a3e8a1623de5deee26f0129d8d35870b7e7d93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bristol-su/support/zipball/3999307d92480932810662845daa2688c3cdffa4", - "reference": "3999307d92480932810662845daa2688c3cdffa4", + "url": "https://api.github.com/repos/bristol-su/support/zipball/f6a3e8a1623de5deee26f0129d8d35870b7e7d93", + "reference": "f6a3e8a1623de5deee26f0129d8d35870b7e7d93", "shasum": "" }, "require": { @@ -176,7 +176,7 @@ "portal", "sdk" ], - "time": "2020-03-11T15:30:12+00:00" + "time": "2020-03-16T13:45:25+00:00" }, { "name": "bristol-su/typeform", @@ -277,20 +277,20 @@ }, { "name": "bristol-su/upload-file", - "version": "v1.0", + "version": "v1.0.1", "source": { "type": "git", "url": "https://github.com/bristol-su/upload-file.git", - "reference": "d857714a72a5b5e7a28ce31e83cd75f4c7349e34" + "reference": "dd719cdc67db44440f55bb27b9ab4b3bafe31ecc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bristol-su/upload-file/zipball/d857714a72a5b5e7a28ce31e83cd75f4c7349e34", - "reference": "d857714a72a5b5e7a28ce31e83cd75f4c7349e34", + "url": "https://api.github.com/repos/bristol-su/upload-file/zipball/dd719cdc67db44440f55bb27b9ab4b3bafe31ecc", + "reference": "dd719cdc67db44440f55bb27b9ab4b3bafe31ecc", "shasum": "" }, "require": { - "bristol-su/support": "^3.0", + "bristol-su/support": "^3.1", "php": "^7.2" }, "require-dev": { @@ -319,7 +319,7 @@ "email": "toby.twigger@bristol.ac.uk" } ], - "time": "2020-03-05T15:06:04+00:00" + "time": "2020-03-16T14:14:40+00:00" }, { "name": "defuse/php-encryption", @@ -6449,16 +6449,16 @@ }, { "name": "vlucas/phpdotenv", - "version": "v3.6.0", + "version": "v3.6.1", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "1bdf24f065975594f6a117f0f1f6cabf1333b156" + "reference": "8f7961f7b9deb3b432452c18093cf16f88205902" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/1bdf24f065975594f6a117f0f1f6cabf1333b156", - "reference": "1bdf24f065975594f6a117f0f1f6cabf1333b156", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/8f7961f7b9deb3b432452c18093cf16f88205902", + "reference": "8f7961f7b9deb3b432452c18093cf16f88205902", "shasum": "" }, "require": { @@ -6467,8 +6467,12 @@ "symfony/polyfill-ctype": "^1.9" }, "require-dev": { + "ext-filter": "*", "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" }, + "suggest": { + "ext-filter": "Required to use the boolean validator." + }, "type": "library", "extra": { "branch-alias": { @@ -6502,7 +6506,7 @@ "env", "environment" ], - "time": "2019-09-10T21:37:39+00:00" + "time": "2020-03-12T13:44:00+00:00" }, { "name": "watr/typeform", diff --git a/docs/Console_2Kernel_8php_source.html b/docs/Console_2Kernel_8php_source.html index b996f29..1484ff0 100644 --- a/docs/Console_2Kernel_8php_source.html +++ b/docs/Console_2Kernel_8php_source.html @@ -66,12 +66,13 @@
Definition at line 8 of file Kernel.php.
+Definition at line 9 of file Kernel.php.
Definition at line 34 of file Kernel.php.
+Definition at line 40 of file Kernel.php.
Definition at line 25 of file Kernel.php.
+Definition at line 26 of file Kernel.php.
+ +References BristolSU\Playground\Console\Kernel\$commands.
Definition at line 15 of file Kernel.php.
+Definition at line 16 of file Kernel.php.
+ +Referenced by BristolSU\Playground\Console\Kernel\schedule().
diff --git a/public/modules/uploadfile/js/module.js b/public/modules/uploadfile/js/module.js index cbbcd4f..ce2de76 100644 --- a/public/modules/uploadfile/js/module.js +++ b/public/modules/uploadfile/js/module.js @@ -267,6 +267,10 @@ __webpack_require__.r(__webpack_exports__); statuses: { required: true, type: Array + }, + queryString: { + type: String, + required: true } }, data: function data() { @@ -305,7 +309,7 @@ __webpack_require__.r(__webpack_exports__); }); }, downloadUrl: function downloadUrl(id) { - return this.$url + '/file/' + id + '/download'; + return this.$url + '/file/' + id + '/download?' + this.queryString; }, presentSize: function presentSize(size) { var i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024)); @@ -583,6 +587,10 @@ __webpack_require__.r(__webpack_exports__); "default": function _default() { return []; } + }, + queryString: { + type: String, + required: true } }, data: function data() { @@ -961,6 +969,10 @@ __webpack_require__.r(__webpack_exports__); type: Boolean, required: true, "default": false + }, + queryString: { + type: String, + required: true } }, data: function data() { @@ -979,7 +991,7 @@ __webpack_require__.r(__webpack_exports__); return user.data.first_name + ' ' + user.data.last_name; }, downloadUrl: function downloadUrl(id) { - return this.$url + '/file/' + id + '/download'; + return this.$url + '/file/' + id + '/download?' + this.queryString; }, deleteFile: function deleteFile(id) { var _this = this; @@ -53960,6 +53972,7 @@ var render = function() { [ _c("view-tab-content", { attrs: { + "query-string": _vm.queryString, "can-update": _vm.canUpdate, "can-see-comments": _vm.canSeeComments, "can-delete": _vm.canDelete, diff --git a/resources/views/vendor/uploadfile/admin.blade.php b/resources/views/vendor/uploadfile/admin.blade.php index c23eac6..1c39012 100644 --- a/resources/views/vendor/uploadfile/admin.blade.php +++ b/resources/views/vendor/uploadfile/admin.blade.php @@ -15,7 +15,8 @@ :can-change-status="{{(BristolSU\Support\Permissions\Facade\PermissionTester::evaluate('uploadfile.admin.status.create')?'true':'false')}}" :can-add-comments="{{(BristolSU\Support\Permissions\Facade\PermissionTester::evaluate('uploadfile.admin.comment.store')?'true':'false')}}" :can-see-comments="{{(BristolSU\Support\Permissions\Facade\PermissionTester::evaluate('uploadfile.admin.comment.index')?'true':'false')}}" - :statuses="{{json_encode(settings('statuses'))}}"> + :statuses="{{json_encode(settings('statuses'))}}" + query-string="{{url()->getAuthQueryString()}}"> diff --git a/resources/views/vendor/uploadfile/participant.blade.php b/resources/views/vendor/uploadfile/participant.blade.php index 6664333..a4e6ef6 100644 --- a/resources/views/vendor/uploadfile/participant.blade.php +++ b/resources/views/vendor/uploadfile/participant.blade.php @@ -19,7 +19,8 @@ :allowed-extensions="{{json_encode((settings('allowed_extensions')??[]))}}" :can-update="{{(\BristolSU\Support\Permissions\Facade\PermissionTester::evaluate('uploadfile.file.update')?'true':'false')}}" :can-delete="{{(\BristolSU\Support\Permissions\Facade\PermissionTester::evaluate('uploadfile.file.destroy')?'true':'false')}}" - :can-see-comments="{{(\BristolSU\Support\Permissions\Facade\PermissionTester::evaluate('uploadfile.comment.index')?'true':'false')}}"> + :can-see-comments="{{(\BristolSU\Support\Permissions\Facade\PermissionTester::evaluate('uploadfile.comment.index')?'true':'false')}}" + query-string="{{url()->getAuthQueryString()}}"> diff --git a/tests/Exceptions/HandlerTest.php b/tests/Exceptions/HandlerTest.php index c74a3c6..7d02ea8 100644 --- a/tests/Exceptions/HandlerTest.php +++ b/tests/Exceptions/HandlerTest.php @@ -24,7 +24,7 @@ public function it_logs_into_an_activity_instance_if_a_not_in_activity_instance_ $request = $this->prophesize(Request::class); $request->route('activity_slug')->shouldBeCalled()->willReturn($activity); - $request->url()->willReturn('https://example.com'); + $request->fullUrl()->willReturn('https://example.com'); $resourceIdGenerator = $this->prophesize(ResourceIdGenerator::class); $resourceIdGenerator->fromString('user')->shouldBeCalled()->willReturn(1); @@ -52,7 +52,7 @@ public function it_refreshes_the_page_if_exception_was_a_NotInActivityInstanceEx $request = $this->prophesize(Request::class); $request->route('activity_slug')->shouldBeCalled()->willReturn($activity); - $request->url()->willReturn('https://example.com'); + $request->fullUrl()->willReturn('https://example.com?a=1'); $resourceIdGenerator = $this->prophesize(ResourceIdGenerator::class); $resourceIdGenerator->fromString('user')->shouldBeCalled()->willReturn(1); @@ -70,11 +70,10 @@ public function it_refreshes_the_page_if_exception_was_a_NotInActivityInstanceEx $exception = new NotInActivityInstanceException(); $handler = new Handler($this->app); - /** @var RedirectResponse $response */ $response = $handler->render($request->reveal(), $exception); $this->assertInstanceOf(RedirectResponse::class, $response); - $this->assertEquals('https://example.com', $response->getTargetUrl()); + $this->assertEquals('https://example.com?a=1', $response->getTargetUrl()); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index ee26cd9..f78bc11 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,7 +2,11 @@ namespace BristolSU\Playground\Tests; +use BristolSU\Support\ActivityInstance\Contracts\ActivityInstanceResolver; +use BristolSU\Support\Authentication\Contracts\Authentication; +use BristolSU\Support\Testing\ActivityInstance\LaravelAuthActivityInstanceResolver; use BristolSU\Support\Testing\AssertsEloquentModels; +use BristolSU\Support\Testing\Authentication\SessionAuthentication; use BristolSU\Support\Testing\CreatesSdkEnvironment; use BristolSU\Support\Testing\HandlesAuthentication; use Illuminate\Database\Eloquent\Factory as ModelFactory; @@ -14,7 +18,6 @@ abstract class TestCase extends \Illuminate\Foundation\Testing\TestCase public function setUp(): void { - parent::setUp(); $this->app['config']->set('database.default', 'testing'); $this->app['config']->set('database.connections.testing', [ @@ -26,7 +29,8 @@ public function setUp(): void $this->artisan('migrate', ['--database' => 'testing']); $this->createSdkEnvironment($this->app); $this->app->make(ModelFactory::class)->load(__DIR__ . '/../vendor/bristol-su/support/database/factories'); - + $this->app->bind(Authentication::class, SessionAuthentication::class); + $this->app->bind(ActivityInstanceResolver::class, LaravelAuthActivityInstanceResolver::class); } }