Commit Graph

3169 Commits

Author SHA1 Message Date
Franz Liedke
5d768db6d2 Bubble up exception for invalid confirmation token
This way, the error handler can simply be amended to deal with this
exception type with a dedicated error message or page.

Refs #1337.
Closes #1528.
2020-02-04 22:55:25 +01:00
Franz Liedke
6e089c12d4 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.
2020-02-04 22:55:25 +01:00
flarum-bot
5ddb843eb2 Bundled output for commit 29df6b60be [skip ci] 2020-02-04 22:55:25 +01:00
Franz Liedke
bbeacc0299 Tweak translation keys, always use full keys
Makes them easier to grep when editing / removing.

Refs #1750, #1788.
2020-02-04 22:55:25 +01:00
Franz Liedke
82480457ce Extract real method
Refs #1750, #1788.
2020-02-04 22:55:25 +01:00
flarum-bot
685459c0bc Bundled output for commit 37e0a5579b [skip ci] 2020-02-04 22:55:25 +01:00
Tobias Karlsson
347edcf2cd Improve feedback on user deletion
Fixes #1750, #1777
2020-02-04 22:55:25 +01:00
Franz Liedke
731a038f29 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.
2020-02-04 22:55:25 +01:00
Franz Liedke
af5113eb7b Remove old error handler, middleware and tests 2020-02-04 22:55:25 +01:00
Franz Liedke
ddfb2c1ec1 API Client: Use new error handling mechanism 2020-02-04 22:37:25 +01:00
Franz Liedke
6cf3c1088d Use new error handler middleware 2020-02-04 22:37:24 +01:00
Franz Liedke
2f174edfd0 Wire up new error handling stack 2020-02-04 22:37:24 +01:00
Franz Liedke
2c231aa475 Make existing extensions compatible with new stack 2020-02-04 22:37:24 +01:00
Franz Liedke
1e5c7e54ee 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.
2020-02-04 22:37:24 +01:00
Franz Liedke
408043a203 Remove obsolete constructor parameter
This was removed in commit 484c6d2e.
2020-02-04 22:37:24 +01:00
flarum-bot
9b449386d6 Bundled output for commit c5122bf5d5 [skip ci] 2020-02-04 22:37:24 +01:00
Franz Liedke
f1d9753aee a11y: Try to make screenreaders read tooltips
Refs #1835.
2020-02-04 22:37:24 +01:00
David Sevilla Martín
54f733ca80 Add canonical URL to discussion list (#1814) 2020-02-04 22:37:24 +01:00
Franz Liedke
a737b98e7f Bypass CSRF token check when using access tokens
Fixes #1828.
2020-02-04 22:37:24 +01:00
Franz Liedke
80546b9ed7 Make exception message dynamic as well 2020-02-04 22:37:24 +01:00
Franz Liedke
9758dfac47 Determine default route after extensions
Fixes #1819.
2020-02-04 22:37:24 +01:00
Franz Liedke
970c0f5604 PHPUnit: Get rid of deprecated annotation
Refs #1795.
2020-02-04 22:37:24 +01:00
Daniël Klabbers
42a7f2f586 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.
2020-02-04 22:37:24 +01:00
Daniël Klabbers
3611fa1bb9 fixes #1695, take into consideration is_private with counts on User stats 2020-02-04 22:37:24 +01:00
Daniël Klabbers
c881f9f633 fixed ci, make green again; mysql service wasnt booted 2020-02-04 22:37:24 +01:00
Franz Liedke
0a22a66189 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.
2020-02-04 22:37:24 +01:00
Franz Liedke
64b53fb0ac Revert "Remove deprecated bootstrap.php fallback"
This reverts commit f8061bbca1.

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.
2020-02-04 22:37:24 +01:00
Franz Liedke
627724839d 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.
2020-02-04 22:37:24 +01:00
dependabot[bot]
fa3915fa53 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>
2020-02-04 22:37:24 +01:00
luceos
1948b7e6f4 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-02-04 21:11:08 +00:00
Daniël Klabbers
4465e7648b move deprecated methods to trait for cleaner code until we remove it 2020-02-04 22:10:39 +01:00
luceos
aef56c055a Apply fixes from StyleCI
[ci skip] [skip ci]
2019-11-19 11:38:56 +00:00
Daniël Klabbers
dd3a4173a1 noop instead of exception 2019-11-19 12:38:45 +01:00
Daniël Klabbers
7c204c82ab attempt to be more decisive on forcing the new user preferences 2019-11-13 14:35:42 +01:00
Daniël Klabbers
12fff33763 started refactoring the User class to the Notification Preference class 2019-10-28 10:27:38 +01:00
Daniël Klabbers
603367a41a added followAfterReply to core 2019-10-25 22:38:30 +02:00
luceos
6bdebfbf3c Apply fixes from StyleCI
[ci skip] [skip ci]
2019-10-25 20:33:57 +00:00
Daniël Klabbers
58ab6052ad reordered migrations 2019-09-28 21:02:45 +02:00
luceos
3737ce8146 Apply fixes from StyleCI
[ci skip] [skip ci]
2019-07-09 20:17:16 +00:00
Daniël Klabbers
ca5404db76 Merge branch '1236-user-preferences' of github.com:flarum/core into 1236-user-preferences 2019-07-09 22:17:00 +02:00
Daniël Klabbers
d6fc3a91a6 removed references to preferences column, now we need to refactor how notification ppreferences is integrated into the current app 2019-07-09 22:16:51 +02:00
luceos
31134ca16d Apply fixes from StyleCI
[ci skip] [skip ci]
2019-07-09 19:42:15 +00:00
Daniël Klabbers
6cfc9182f4 added the drop column statement for user.preferences and tested migrations 2019-07-09 21:41:57 +02:00
Daniël Klabbers
caa63107ad add migration to drop preferences column 2019-07-09 21:22:37 +02:00
Daniël Klabbers
0acab8f1c7 Merge branch 'master' into 1236-user-preferences 2019-07-09 21:19:41 +02:00
Daniël Klabbers
b2dbb0439c fixed class property hint for event post content attribute 2019-07-09 08:31:48 +02:00
Daniël Klabbers
085c924a07 fix return type hint for event post content attribute 2019-07-09 08:30:10 +02:00
David Sevilla Martín
f31f02d4cc 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
797f6eea50 moved GetDisplayName event to User namespace (#1768) 2019-07-06 19:27:44 +02:00
Franz Liedke
9fb3a31b51
Get rid of unnecessary method 2019-07-06 02:25:06 +02:00