Commit Graph

3151 Commits

Author SHA1 Message Date
Franz Liedke
919ebfcc33 Determine error view and message based on type
...not based on status code.

To simplify this logic, we now use the same error "type" both when
routes are not found and specific models are not found. One exception is
ours, one is from Laravel, but for the purposes of error handling they
should be treated the same.

Fixes flarum/core#1641.
2019-08-14 19:47:56 +02:00
flarum-bot
40a8068dea Bundled output for commit 4cd48ac048 [skip ci] 2019-08-14 06:41:45 +00:00
Franz Liedke
4cd48ac048 Tweak translation keys, always use full keys
Makes them easier to grep when editing / removing.

Refs #1750, #1788.
2019-08-14 08:34:36 +02:00
Franz Liedke
e7cdd497dd Extract real method
Refs #1750, #1788.
2019-08-14 08:34:14 +02:00
flarum-bot
c3740281b6 Bundled output for commit be6d42d46f [skip ci] 2019-08-13 21:02:10 +00:00
Tobias Karlsson
be6d42d46f Improve feedback on user deletion
Fixes #1750, #1777
2019-08-13 22:56:24 +02:00
Franz Liedke
fcb3921a42 Merge pull request #1843 from flarum/fl/1641-exception-handling
Implement new error handling stack
2019-08-13 22:45:46 +02:00
Franz Liedke
01c77b8e2a Support multiple error reporters
The error handling middleware now expects an array of reporters.
Extensions can register new reporters in the container like this:

    use Flarum\Foundation\ErrorHandling\Reporter;

    $container->tag(NewReporter::class, Reporter::class);

Note that this is just an implementation detail and will be hidden
behind an extender.
2019-08-10 11:04:12 +02:00
Franz Liedke
f73a39d3f4 Remove old error handler, middleware and tests 2019-08-10 00:26:24 +02:00
Franz Liedke
8e0cd27f54 API Client: Use new error handling mechanism 2019-08-10 00:26:24 +02:00
Franz Liedke
410028dae6 Use new error handler middleware 2019-08-10 00:26:24 +02:00
Franz Liedke
817e54abe0 Wire up new error handling stack 2019-08-10 00:26:23 +02:00
Franz Liedke
13377100fb Make existing extensions compatible with new stack 2019-08-10 00:26:22 +02:00
Franz Liedke
11e76b1965 Implement new error handling stack
This separates the error registry (mapping exception types to status
codes) from actual handling (the middleware) as well as error formatting
(Whoops, pretty error pages or JSON-API?) and reporting (log? Sentry?).

The components can be reused in different places (e.g. the API client
and the error handler middleware both need the registry to understand
all the exceptions Flarum knows how to handle), while still allowing to
change only the parts that need to change (the API stack always uses the
JSON-API formatter, and the forum stack switches between Whoops and
pretty error pages based on debug mode).

Finally, this paves the way for some planned features and extensibility:
- A console error handler can build on top of the registry.
- Extensions can register new exceptions and how to handle them.
- Extensions can change how we report exceptions (e.g. Sentry).
- We can build more pretty error pages, even different ones for
  exceptions having the same status code.
2019-08-10 00:26:22 +02:00
Franz Liedke
dbbfb01e3a Remove obsolete constructor parameter
This was removed in commit 7b2807a8.
2019-08-10 00:16:21 +02:00
flarum-bot
e79d1b8f6b Bundled output for commit 1702929079 [skip ci] 2019-08-08 23:12:56 +00:00
Franz Liedke
1702929079 a11y: Try to make screenreaders read tooltips
Refs #1835.
2019-08-08 22:40:30 +02:00
David Sevilla Martín
b3019e72fe Add canonical URL to discussion list (#1814) 2019-08-08 00:01:25 +02:00
Franz Liedke
2fc2cd5863 Bypass CSRF token check when using access tokens
Fixes #1828.
2019-08-01 22:53:31 +02:00
Franz Liedke
51b33c8cab Make exception message dynamic as well 2019-08-01 22:25:28 +02:00
Daniël Klabbers
a46c9b0c1d Merge branch 'master' of github.com:flarum/core 2019-07-31 17:10:47 +02:00
Daniël Klabbers
9209a5f588 Allows configuration of where the language files live. So that
language packs can optionally decide for themselves if they want
to use a different directory.
2019-07-31 17:10:13 +02:00
Franz Liedke
1169e4aca6 Determine default route after extensions
Fixes #1819.
2019-07-30 00:56:29 +02:00
Franz Liedke
b59aef7838 PHPUnit: Get rid of deprecated annotation
Refs #1795.
2019-07-30 00:09:10 +02:00
Daniël Klabbers
720c88e73a fixes #1695, take into consideration is_private with counts on User stats 2019-07-28 20:59:12 +02:00
Daniël Klabbers
6745f55ad7 fixed ci, make green again; mysql service wasnt booted 2019-07-27 22:24:39 +02:00
Franz Liedke
7ca47b67c3 Prevent MySQL search operators from taking effect
We do not want to inherit MySQL's fulltext query language, so let's
just drop all non-word characters from the search term.

Fixes #1498.
2019-07-23 23:55:06 +02:00
Franz Liedke
10ba2e9464 Revert "Remove deprecated bootstrap.php fallback"
This reverts commit 4abd6d61a9.

We will keep this fallback in place, to avoid unnecessary breakage of
backwards compatibility for extension authors.

Removal is planned for the final 0.1 release.
2019-07-14 22:22:06 +02:00
Franz Liedke
928b360135 Clean up database query
- Use existing `selectRaw()` method to avoid using the global `app()`
  helper as a service locator, which hides dependencies.
- Do the same for the join.
- The `Expression` is necessary to prevent the aliased column from being
  prefixed with the database table prefix, if configured.
2019-07-11 22:35:19 +02:00
dependabot[bot]
2697397376 Bump lodash-es from 4.17.11 to 4.17.14 in /js (#1818)
Bumps [lodash-es](https://github.com/lodash/lodash) from 4.17.11 to 4.17.14.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.14)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-11 09:21:17 +02:00
Daniël Klabbers
ffb7495266 fixed class property hint for event post content attribute 2019-07-09 08:31:48 +02:00
Daniël Klabbers
84a3edaba8 fix return type hint for event post content attribute 2019-07-09 08:30:10 +02:00
David Sevilla Martín
aa442f2cb8 Set Whoops middleware HTTP status to error code (#1648)
* Use error code for HTTP status, defaults to 500
* Use logic from HandleErrorsWithView, make sure status is valid
2019-07-07 14:57:40 +02:00
Daniël Klabbers
7e0855d9da moved GetDisplayName event to User namespace (#1768) 2019-07-06 19:27:44 +02:00
Franz Liedke
741ce3acd4 Get rid of unnecessary method 2019-07-06 02:25:06 +02:00
Franz Liedke
4abd6d61a9 Remove deprecated bootstrap.php fallback
Closes #1557.
2019-07-06 02:11:09 +02:00
Franz Liedke
f19d80ee0f Travis: Allow PHP 7.4 to fail for now
We are currently experiencing issues due to Mockery not yet being 100%
compatible with PHP.

See https://github.com/mockery/mockery/pull/980.
2019-07-06 01:56:54 +02:00
Franz Liedke
67040303f9 Update test libraries 2019-07-06 01:49:55 +02:00
Franz Liedke
7c05033405 Travis: Test against the upcoming PHP 7.4 2019-07-06 01:30:59 +02:00
Franz Liedke
1ea617239b Convert more helpers in tests 2019-07-06 01:30:59 +02:00
Franz Liedke
5103a50711 Type hint contract, not implementation 2019-07-06 01:30:58 +02:00
Franz Liedke
32e84d651c Use Laravel's class-based Str and Arr helpers
Starting with version 5.9, the global funtions will be deprecated.

* https://laravel-news.com/laravel-5-8-deprecates-string-and-array-helpers
* https://github.com/laravel/framework/pull/26898
2019-07-06 01:30:58 +02:00
Franz Liedke
039973c5f8 Issue templates: Remove vulnerability information
GitHub now automatically displays this information (or rather, links to
the Security Policy) at the issue type selection page.
2019-07-06 00:08:55 +02:00
Franz Liedke
c76f606437 Use class constant instead of strings 2019-07-06 00:03:25 +02:00
Franz Liedke
bbd0cc5676 Add descriptions to custom Composer scripts 2019-07-05 23:34:23 +02:00
David Sevilla Martín
02ab9eb905 Update Application version string to beta 9 (#1784) 2019-07-05 12:37:02 +02:00
flarum-bot
eb68b3ec3a Bundled output for commit 26b9a3ec69 [skip ci] 2019-06-27 19:23:54 +00:00
David Sevilla Martín
26b9a3ec69 Merge pull request #1803 from flarum/ds/1777-previous-route-default
Visit home page if previous route does not exist when going back in history
2019-06-27 15:17:41 -04:00
David Sevilla Martín
28e5f5cdb2 Update CHANGELOG.md 2019-06-27 15:07:53 -04:00
David Sevilla Martín
20dfcfc39c Visit home page if no previous route exists
Fixes #1777
2019-06-27 14:58:05 -04:00