Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.

Upgrading Laravel Framework #1071

Merged
merged 50 commits into from
Jul 29, 2020
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
04b8d9b
Updating composer packages.
weerd Jul 8, 2020
15cbbba
Updating dependencies.
weerd Jul 9, 2020
2dc7b8d
Removing unused files and updating index.php
weerd Jul 9, 2020
2fc52a3
Updating .htaccess.
weerd Jul 9, 2020
a299bed
Removing bootstrap/autoload call.
weerd Jul 9, 2020
7fe7dfb
Updating TrustedProxy settings.
weerd Jul 9, 2020
0c77833
Removing mentions of Dusk in project since no longer used.
weerd Jul 9, 2020
8c0127f
Upadating Hashing config.
weerd Jul 13, 2020
05cc009
Updating Logging.
weerd Jul 13, 2020
c356a02
Updating logger method name.
weerd Jul 13, 2020
9ac1c52
Bringing rest of files up to date and in sync with 5.6 framework files.
weerd Jul 14, 2020
123258b
Reverting web routes file I was using for debugging.
weerd Jul 14, 2020
3198f2e
Figuring out issues with running tests.
weerd Jul 16, 2020
bb78b4c
Updating composer.
weerd Jul 20, 2020
8ada9ae
StyleCI fix.
weerd Jul 20, 2020
9f3865d
Updating dependencies for 5.7.
weerd Jul 20, 2020
4be7a98
Updating assets.
weerd Jul 20, 2020
c2af8ef
Updating authorization.
weerd Jul 20, 2020
ed89b54
Updating cache.
weerd Jul 20, 2020
96118e2
Updating tests.
weerd Jul 20, 2020
4a2da82
Removing overridden mock() method since the signature changed and Lar…
weerd Jul 21, 2020
19bafd9
Removing unused imported class.
weerd Jul 21, 2020
2b294d0
Removing CustomGate now that framework supports Guest User Gates.
weerd Jul 23, 2020
ee07c28
Fixing up broken tests.
weerd Jul 23, 2020
05e3b87
Composer lock update.
weerd Jul 23, 2020
c8453d4
Wrapping up miscellaneous updates from 5.6 to 5.7.
weerd Jul 23, 2020
f1a4250
Some miscellaneous updates from 5.7 to 5.8.
weerd Jul 23, 2020
8c10c8f
Updating dependencies and fixing API routes.
weerd Jul 23, 2020
51ced1d
Updating testing.
weerd Jul 23, 2020
72991e7
Updating notifications.
weerd Jul 25, 2020
cd60a80
Updating support.
weerd Jul 27, 2020
b0a30f4
Updating support with env() changes.
weerd Jul 27, 2020
8817e91
Updating env example vars.
weerd Jul 27, 2020
02324fa
Updates to env vars used and simplifying redis env settings.
weerd Jul 27, 2020
6a322f8
Fixing up Tag tests and errors with notifications.
weerd Jul 28, 2020
76f9d43
Updating cache config.
weerd Jul 28, 2020
a8896d2
Removing deleted_at from array since automatically converted after u…
weerd Jul 28, 2020
cf74c81
Changing tag so it does not trigger notification, if not point of test.
weerd Jul 28, 2020
83f6b85
Cleanup.
weerd Jul 28, 2020
fffa483
Fixing StyleCI issue.
weerd Jul 28, 2020
31d07f7
StyleCI fixes.
weerd Jul 28, 2020
99c0746
StyleCI fixes.
weerd Jul 28, 2020
8b1c4eb
Updating Trusted Proxies based on Heroku docs.
weerd Jul 29, 2020
88b74cd
Type-hinting the Authenticateable class works.
weerd Jul 29, 2020
f433f03
Updating redis options.
weerd Jul 29, 2020
cddadb2
Updating filesystems config and reivew app config.
weerd Jul 29, 2020
3e16a73
Adding note regarding a potential future update.
weerd Jul 29, 2020
c93b144
Restoring the Good Submission tag and setting empty string var for sl…
weerd Jul 29, 2020
94fae7f
Restoring old approach now that tests do not trigger notifications.
weerd Jul 29, 2020
0521749
Updaing AWS_* env variables.
weerd Jul 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@ root = true


[*]
indent_style = space
indent_size = 2

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true

[*.php]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.json]
indent_style = space
[*.js*]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
22 changes: 15 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG=daily
APP_LOG_LEVEL=debug
APP_URL=http://rogue.test

LOG_CHANNEL=daily
LOG_SLACK_WEBHOOK_URL=

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
Expand All @@ -13,20 +14,27 @@ DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=redis
FILESYSTEM_DRIVER=public
QUEUE_CONNECTION=sync
weerd marked this conversation as resolved.
Show resolved Hide resolved
SESSION_DRIVER=redis
STORAGE_DRIVER=public
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
REDIS_URL=redis://h:null@127.0.0.1:6379
weerd marked this conversation as resolved.
Show resolved Hide resolved

# AWS
AWS_ACCESS_KEY=
AWS_REGION=us-east-1
AWS_SECRET_KEY=
AWS_S3_BUCKET=
AWS_S3_URL=
weerd marked this conversation as resolved.
Show resolved Hide resolved

# Northstar
NORTHSTAR_URL=https://identity-dev.dosomething.org
NORTHSTAR_AUTH_ID=dev-oauth
NORTHSTAR_AUTH_SECRET=
NORTHSTAR_CLIENT_ID=dev-machine
NORTHSTAR_CLIENT_SECRET=

# GraphQL
GRAPHQL_URL=https://graphql-dev.dosomething.org

# Algolia (only use if testing indexing):
Expand Down
18 changes: 8 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
/vendor
/node_modules
/public/assets/**
/public/dist
/public/storage
/storage/debugbar
Homestead.yaml
Homestead.json
.env
.env.dusk.local
/vendor

.DS_Store
.env
.env.backup
.phpunit.result.cache

public/assets/**
public/dist

Homestead.json
Homestead.yaml
npm-debug.log

/_book
1 change: 0 additions & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ enabled:
disabled:
- concat_without_spaces
- no_useless_return
- simplified_null_return
- phpdoc_no_package
- phpdoc_summary
- phpdoc_var_without_name
Expand Down
27 changes: 0 additions & 27 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,35 +65,8 @@
"NORTHSTAR_URL": {
"required": true
},
"ASHES_API_VERSION": {
"required": true
},
"ASHES_PASSWORD": {
"required": true
},
"ASHES_URI": {
"required": true
},
"ASHES_USERNAME": {
"required": true
},
"ROGUE_API_KEY": {
"required": true
},
"S3_BUCKET": {
"required": true
},
"S3_KEY": {
"required": true
},
"S3_REGION": {
"required": true
},
"S3_SECRET": {
"required": true
},
"S3_URL": {
"required": true
}
}
}
47 changes: 0 additions & 47 deletions app/Auth/CustomGate.php

This file was deleted.

26 changes: 12 additions & 14 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,37 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @param \Exception $exceptionxception
* @return void
*/
public function report(Exception $e)
public function report(Exception $exception)
{
parent::report($e);
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response
* @param \Exception $exception
* @return \Illuminate\Http\Response | \Symfony\Component\HttpFoundation\Response
*/
public function render($request, Exception $e)
public function render($request, Exception $exception)
{
// If Intervention can't parse a file (corrupted or wrong type), return 422.
// @TODO: Handle this with a validation rule on our v3 routes.
if ($e instanceof \Intervention\Image\Exception\NotReadableException) {
if ($exception instanceof \Intervention\Image\Exception\NotReadableException) {
abort(422, 'Invalid image provided.');
}

// Re-cast specific exceptions or uniquely render them:
if ($e instanceof GlideNotFoundException) {
$e = new NotFoundHttpException('That image could not be found.');
} elseif ($e instanceof ModelNotFoundException) {
$e = new NotFoundHttpException('That resource could not be found.');
if ($exception instanceof GlideNotFoundException) {
$exception = new NotFoundHttpException('That image could not be found.');
} elseif ($exception instanceof ModelNotFoundException) {
$exception = new NotFoundHttpException('That resource could not be found.');
}

return parent::render($request, $e);
return parent::render($request, $exception);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/CampaignsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Rogue\Http\Controllers;

use Rogue\Models\Campaign;
use Illuminate\Support\Arr;
use Illuminate\Http\Request;
use Rogue\Http\Transformers\CampaignTransformer;

Expand Down Expand Up @@ -65,7 +66,7 @@ public function index(Request $request)
}

// Experimental: Allow paginating by cursor (e.g. `?cursor[after]=OTAxNg==`):
if ($cursor = array_get($request->query('cursor'), 'after')) {
if ($cursor = Arr::get($request->query('cursor'), 'after')) {
$query->whereAfterCursor($cursor);

// Using 'cursor' implies cursor pagination:
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/GroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Rogue\Http\Controllers;

use Rogue\Models\Group;
use Illuminate\Support\Arr;
use Illuminate\Http\Request;
use Rogue\Http\Transformers\GroupTransformer;

Expand Down Expand Up @@ -44,7 +45,7 @@ public function index(Request $request)

$request->query->set('orderBy', 'name,asc');

if ($cursor = array_get($request->query('cursor'), 'after')) {
if ($cursor = Arr::get($request->query('cursor'), 'after')) {
$query->whereAfterCursor($cursor);
$this->useCursorPagination = true;
}
Expand Down
15 changes: 9 additions & 6 deletions app/Http/Controllers/PostsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Rogue\Models\Post;
use Rogue\Models\Campaign;
use Illuminate\Support\Arr;
use Illuminate\Http\Request;
use Rogue\Managers\PostManager;
use Rogue\Managers\SignupManager;
Expand Down Expand Up @@ -87,11 +88,11 @@ public function index(Request $request)
$query = $query->withHiddenPosts();

// If tag param is passed, only return posts that have that tag.
if (array_has($filters, 'tag')) {
if (Arr::has($filters, 'tag')) {
$query = $query->withTag($filters['tag']);
}

if (array_has($filters, 'volunteer_credit')) {
if (Arr::has($filters, 'volunteer_credit')) {
if (filter_var($filters['volunteer_credit'], FILTER_VALIDATE_BOOLEAN)) {
$query = $query->withVolunteerCredit($filters['volunteer_credit']);
} else {
Expand All @@ -100,7 +101,7 @@ public function index(Request $request)
}

// If the northstar_id param is passed, only allow admins, staff, or owner to see anonymous posts.
if (array_has($filters, 'northstar_id')) {
if (Arr::has($filters, 'northstar_id')) {
$query = $query->withoutAnonymousPosts();
}

Expand All @@ -113,7 +114,7 @@ public function index(Request $request)
$request->query->set('orderBy', 'created_at,desc');

// Experimental: Allow paginating by cursor (e.g. `?cursor[after]=OTAxNg==`):
if ($cursor = array_get($request->query('cursor'), 'after')) {
if ($cursor = Arr::get($request->query('cursor'), 'after')) {
$query->whereAfterCursor($cursor);

// Using 'cursor' implies cursor pagination:
Expand Down Expand Up @@ -175,12 +176,14 @@ public function update(PostRequest $request, Post $post)
// Only allow an admin/staff or the user who owns the post to update.
$this->authorize('update', $post);

$validatedRequest = $request->validated();

// But don't allow user's to review their own posts.
if (! Gate::allows('review', $post)) {
unset($request['status']);
unset($validatedRequest['status']);
}

$this->posts->update($post, $request->validated());
$this->posts->update($post, $validatedRequest);
weerd marked this conversation as resolved.
Show resolved Hide resolved

return $this->item($post);
}
Expand Down
8 changes: 5 additions & 3 deletions app/Http/Controllers/SignupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Rogue\Models\Signup;
use Rogue\Models\Campaign;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Rogue\Managers\SignupManager;
use Rogue\Http\Transformers\SignupTransformer;
Expand Down Expand Up @@ -92,7 +94,7 @@ public function index(Request $request)
$query = $this->filter($query, $filters, Signup::$indexes);

// Only allow an admin or the user who owns the signup to see the signup's unapproved posts.
if (starts_with($request->query('include'), 'posts')) {
if (Str::startsWith($request->query('include'), 'posts')) {
$types = (new \League\Fractal\Manager)
->parseIncludes($request->query('include'))
->getIncludeParams('posts');
Expand All @@ -106,7 +108,7 @@ public function index(Request $request)
$query = $this->orderBy($query, $orderBy, Signup::$sortable);

// Experimental: Allow paginating by cursor (e.g. `?cursor[after]=OTAxNg==`):
if ($cursor = array_get($request->query('cursor'), 'after')) {
if ($cursor = Arr::get($request->query('cursor'), 'after')) {
$query->whereAfterCursor($cursor);

// Using 'cursor' implies cursor pagination:
Expand All @@ -127,7 +129,7 @@ public function index(Request $request)
public function show(Request $request, Signup $signup)
{
// Only allow an admin or the user who owns the signup to see the signup's unapproved posts.
if (starts_with($request->query('include'), 'posts')) {
if (Str::startsWith($request->query('include'), 'posts')) {
$types = (new \League\Fractal\Manager)
->parseIncludes($request->query('include'))
->getIncludeParams('posts');
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/TagsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Rogue\Http\Controllers;

use Rogue\Models\Post;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Rogue\Repositories\PostRepository;
use Rogue\Http\Transformers\PostTransformer;
Expand Down Expand Up @@ -54,7 +55,7 @@ public function store(Post $post, Request $request)
// If a tag slug is sent in (dashed or lowercase), change to the tag name.
// @TODO: This controller/model should really deal in slugs...
$tag = $request->tag_name;
if (str_contains($tag, '-') || ctype_lower($tag)) {
if (Str::contains($tag, '-') || ctype_lower($tag)) {
$tag = ucwords(str_replace('-', ' ', $tag));
}

Expand Down
Loading