Commit Graph

1646 Commits

Author SHA1 Message Date
Toby Zerner
e17bb0b433 Fix is:unread gambit 2019-03-24 12:24:44 +10:30
Franz Liedke
ef57b443c1
Apply fixes from StyleCI (#1761)
[ci skip] [skip ci]
2019-03-19 09:59:09 +01:00
Franz Liedke
5154d7e5a6
Allow configuring all drivers via frontend (#1169)
This includes an API endpoint for fetching the list of possible
drivers and their configuration fields. In the future, this can
be extended to include more meta information about each field.
2019-03-19 09:56:20 +01:00
Franz Liedke
c50d58d0f4
Add drivers for Mailgun, Mandrill, SES (#1169) 2019-03-16 12:58:35 +01:00
Franz Liedke
441ebacfd7
Apply fixes from StyleCI (#1760)
[ci skip] [skip ci]
2019-03-13 21:32:18 +01:00
Franz Liedke
46acfb6c23
Implement mail driver classes (#1169)
This adds an interface for mail drivers to implement, defining several
methods that we need throughout Flarum to configure, validate and use
the various email drivers we can support through Laravel.

More mail drivers can be added by `extend()`ing the container binding
"mail.supported_drivers" with an arbitrary key and the name of a class
that implements our new `DriverInterface`.

This will ensure that drivers added by extensions can be properly built
and validated, even in the frontend.
2019-03-13 21:31:19 +01:00
Daniël Klabbers
9910e884fc Allow fallback to check for bound mail drivers (#1757) 2019-03-12 19:45:42 +01:00
bdumaspilhou
33deea4791 Fixes #1738 : Search Title within discussions (#1741) 2019-03-07 00:20:37 +01:00
Franz Liedke
e8ab49abc1
Merge pull request #1743 from flarum/fl/test-structure
Improve test suite structure
2019-03-03 20:17:35 +01:00
Daniël Klabbers
654ab4cc29 prefixes indices when installing too 2019-02-05 09:50:15 +01:00
Daniël Klabbers
e0becd0c7b Capsule manager (#1744)
Refactored to use the Capsule Database manager for setting up the
Flarum (mysql) connection.

This will introduce the reconnector automatically, fixing #1740
2019-02-04 23:31:12 +01:00
Franz Liedke
ed43ad9c3f
Properly wrap error bag in session
Second part of fixing #1683.
2019-02-03 21:16:43 +01:00
Franz Liedke
4611abe5db
Fix error redirect when resetting passwords
This was an oversight from the large database column renamings.

Fixes #1683.
2019-02-03 21:06:47 +01:00
Franz Liedke
cf746079ed
Make integration tests independent
This creates a dedicated test suite for integration tests. All of them
can be run independently, and there is no order dependency - previously,
all integration tests needed the installer test to run first, and they
would fail if installation failed.

Now, the developer will have to set up a Flarum database to be used by
these tests. A setup script to make this simple will be added in the
next commit.

Small tradeoff: the installer is NOT tested in our test suite anymore,
only implicitly through the setup script. If we decide that this is a
problem, we can still set up separate, dedicated installer tests which
should probably test the web installer.
2019-02-03 20:39:32 +01:00
Franz Liedke
1a9f1f7a3d
Use Collection class rather than collect() helper 2019-02-01 14:12:29 +01:00
Franz Liedke
4d1411e2a8
Improve problem description for wrong PHP version 2019-02-01 13:00:25 +01:00
Franz Liedke
968152b740
DatabaseConfig: Implement Arrayable contract 2019-02-01 13:00:07 +01:00
Franz Liedke
ed9591c16f
Installer: Support reverting asset publication 2019-01-31 22:43:07 +01:00
Franz Liedke
8ad326941f
Migrator: Fix resetting core migrations 2019-01-31 22:42:35 +01:00
Franz Liedke
7ff9a90204
Check MariaDB version, update MySQL constraint
See flarum/docs#43.
2019-01-31 21:52:10 +01:00
Franz Liedke
f4fb1ab272
Simplify DataProviderInterface
Instead of passing all these objects / arrays from one object to the
next, simply pass an Installation instance around for configuration.
2019-01-31 21:52:10 +01:00
Franz Liedke
484c6d2edb
Extract DatabaseConfig class with validation 2019-01-31 21:52:09 +01:00
Franz Liedke
8b68ff6232
Extract AdminUser class that enforces invariants 2019-01-31 21:52:09 +01:00
Franz Liedke
0a59b7164e
Move password confirmation validation to frontends
Since this is not strictly speaking a domain invariant, but rather
specific to the user interface where passwords are not displayed, and
should therefore be entered twice to prevent mistakes going unnoticed,
this stuff should be checked in the frontend, not in the install steps.

Next step: Ensure that all domain-specific validation is done in the
installer's domain layer. This will ensure these validations cannot be
forgotten, and keep the frontends DRY.
2019-01-31 21:52:08 +01:00
Franz Liedke
0879829dc4
Use dedicated temporary variable instead of array 2019-01-31 21:52:08 +01:00
Franz Liedke
78ba3bd854
Combine building and storing config in one step 2019-01-31 21:52:08 +01:00
Franz Liedke
44c91099cd
Get rid of DefaultsDataProvider
Since we do not provide a development VM anymore, it does not make sense
to have "default" credentials etc.

To reproduce something similar, I'd suggest using a YAML or JSON file
together with the `--file` option.
2019-01-31 21:52:07 +01:00
Franz Liedke
4585f03ee3
Switch to a whitelist for enabling extensions 2019-01-31 21:52:07 +01:00
Franz Liedke
bc9e8f68f1
Move default settings to install step
The various installation "frontends" (such as GUI and console) can now
provide custom overrides, if they want to.
2019-01-31 21:52:06 +01:00
Franz Liedke
f5a21584c2
Collapse namespace imports 2019-01-31 21:52:06 +01:00
Franz Liedke
e0a508a765
Catch pipeline's own exception 2019-01-31 21:52:06 +01:00
Franz Liedke
89e018a4f0
Simplify PrerequisiteInterface
I went with a return type of Collection, because it is easier to call
methods such as isEmpty() directly on those objects.
2019-01-31 21:52:05 +01:00
Franz Liedke
790d5beee5
Split up the installer logic
This is probably the most complicated way I could find to fix #1587.

Jokes aside, this was done with a few goals in mind:
- Reduce coupling between the installer and the rest of Flarum's
  "Application", which we are building during installation.
- Move the installer logic to several smaller classes, which can then
  be used by the web frontend and the console task, instead of the
  former hacking its way into the latter to be "DRY".
- Separate installer infrastructure (the "pipeline", with the ability
  to revert steps upon failure) from the actual steps being taken.

The problem was conceptual, and would certainly re-occur in a similar
fashion if we wouldn't tackle it at its roots.

It is fixed now, because we no longer use the ExtensionManager for
enabling extensions, but instead duplicate some of its logic. That is
fine because we don't want to do everything it does, e.g. omit
extenders' lifecycle hooks (which depend on the Application instance
being complete).

> for each desired change, make the change easy (warning: this may be
> hard), then make the easy change

- Kent Beck, https://twitter.com/kentbeck/status/250733358307500032

Fixes #1587.
2019-01-31 21:52:04 +01:00
Toby Zerner
0ab9facc4b Make the Request available to the Formatter\Rendering event (#1721)
This is important because extensions may wish to render post content
differently depending on Request factors such as the actor. For example,
an attachments extension might wish to hide attachments from guests.

This solution is a bit of a hack-job for now, but soon when we refactor
the API layer to use tobscure/json-api-server, and also refactor the
Formatter layer, it can be revised.
2019-01-22 23:33:49 +01:00
Daniël Klabbers
1b2d4f1e1d set prefixing indices to be done automatically, now that illuminate can take care of that 2019-01-15 20:49:33 +01:00
Daniël Klabbers
390148456c reverts #96e2824 2019-01-15 20:39:38 +01:00
Franz Liedke
208bad393f
Mail: Add an array of supported drivers
This can be used for e.g. validation, or a dropdown in the frontend.
It can also be extended by extensions, such as flagrow/mail-drivers.

Refs #1169.
2018-12-20 13:36:08 +01:00
Franz Liedke
8a93f8b6b6
Apply fixes from StyleCI (#1714)
[ci skip] [skip ci]
2018-12-20 13:13:58 +01:00
Franz Liedke
9db04a4e19
Register service providers alphabetically
Order should not matter - and this is the only one that can
realistically stay consistent.
2018-12-20 13:13:04 +01:00
Franz Liedke
ac5e26a254
Use a custom service provider for email configuration 2018-12-20 13:10:30 +01:00
Daniël Klabbers
9794a08f39 updated constraint for 5.7 (#1698) 2018-12-20 08:20:52 +10:30
Franz Liedke
ababb8ebef
Don't resolve services when binding listeners
Refs #1578.
2018-12-19 22:47:58 +01:00
Franz Liedke
cb3baf9955
Apply fixes from StyleCI (#1713)
[ci skip] [skip ci]
2018-12-19 22:42:54 +01:00
Franz Liedke
dbe8cba14e
Avoid unnecessary event subscribers
Refs #1578.
2018-12-19 22:27:32 +01:00
Franz Liedke
9fe671c9bb
Fix UpdateServiceProvider
- Shorten registration of routes
- Do not resolve view factory before booting
2018-12-19 22:17:44 +01:00
Franz Liedke
0e5f334a0b
Locale: Don't resolve manager just to configure it
Refs #1578.
2018-12-19 22:07:31 +01:00
Franz Liedke
e4514d8413
Shorten registration of routes 2018-12-19 21:57:59 +01:00
Franz Liedke
1080d25561
Frontends: Populate default routes only when they are resolved 2018-12-19 21:55:58 +01:00
Franz Liedke
ba594de13a
Make site extenders run after extensions
Fixes #1708.
2018-12-19 21:30:29 +01:00
Daniel Klabbers
671fdec8d0 fixes #1695, post comment count is incorrectly calculated based on all posts, including events 2018-12-19 15:07:32 +01:00
Daniel Klabbers
9eca9192ca fixes a notice due to the forum variable not being defined before compacting 2018-12-19 11:40:48 +01:00
Franz Liedke
3468bdf511
Run local extenders before booting service providers
We still need to discuss the priority of local extenders vs. those
from enabled extensions, but let's first fix the actual bug.

Refs #1708.
2018-12-18 11:16:57 +01:00
Franz Liedke
54503d2c29
API: Populate default routes only when they are resolved
Refs #1708.
2018-12-18 10:33:01 +01:00
Franz Liedke
565131e2a7
Allow passing strings (names of invokable classes) to Formatter extender
In preparation for fixing #1703.
2018-12-15 12:05:17 +01:00
Toby Zerner
f0da3cf304
Remove obsolete binding 2018-12-14 11:28:11 +10:30
Franz Liedke
6acc91577d
Apply fixes from StyleCI (#1701)
[ci skip] [skip ci]
2018-12-14 01:48:19 +01:00
Franz Liedke
3e0cd3a21f
Use class constant to get qualified class names 2018-12-14 01:47:54 +01:00
Franz Liedke
5c9fa4c62d
Get rid of docblocks that don't add information 2018-12-13 23:08:49 +01:00
Franz Liedke
4b00f7996b
Early returns 2018-12-13 23:06:59 +01:00
Franz Liedke
b0e996e7ff
Merge pull request #1697 from flarum/fl/1578-speed-up-extenders
Do not resolve services in extenders
2018-12-13 10:33:00 +01:00
Franz Liedke
b41d9fb0e7
Inject dependencies when firing events, not before
The event subscriber approach means that dependencies have to be
injected (and thus instantiated, along with all *their* dependencies) at
the time of registering event listeners - even when events are never
fired within a request's lifecycle.

This is unnecessary and causes more classes than necessary to be loaded.

In this case, we can explicitly register event listeners that will
resolve their dependencies when the event is fired, not before.

Refs #1578.
2018-12-13 02:01:50 +01:00
Franz Liedke
ed02eed88f
Do not resolve services when extending them
Refs #1578.
2018-12-13 01:58:54 +01:00
David Sevilla Martín
c761802900 Fix DELETE /api/extensions/* returning 500 (#1580)
* Use extension string as parameter for ::disable & ::uninstall

* Remove repeated 'ExtensionManager::disable' call

* Fix StyleCI
2018-12-13 00:16:03 +01:00
David Sevilla Martín
9684fbc4da Add 'hasPermission' helper to Group (#1688)
* Add Group@hasPermission helper

* Improve performance of method
2018-12-10 22:32:21 +01:00
Franz Liedke
67f9375d47
Fix incorrect column name for registration token
Oversight from the database renamings, I suppose.

Fixes #1691.
2018-12-09 23:17:04 +01:00
Toby Zerner
0d16fac001 Performance: Actually make use of the translator cache
We had added a `storage/locale` directory to our skeleton, but we had
forgotten to hook it up with the translator. Enabling caching saves
parsing that locale YAML files on every pageload which should be good
for performance.

The locale cache will be cleared whenever an extension that uses the
`Locales` or `LanguagePack` extenders is enabled/disabled. If debug
mode is ON, then the caching mechanism will automatically check if any
of the loaded YAML files are dirty and update accordingly.
2018-12-07 09:38:08 +10:30
Franz Liedke
bbe62f400f
Release version 0.1.0-beta.8.1 2018-12-06 00:47:38 +01:00
Franz Liedke
fc5977f86f
Do not create tables as InnoDB automatically, rely on connection default
As argued in #1675, this makes us slightly less reliant on MySQL.
2018-12-06 00:34:43 +01:00
Toby Zerner
88e43cc694 Fix empty meta description tag. Fixes #1677 2018-12-04 09:28:24 +10:30
Toby Zerner
6370f7ecff Set the default engine in the installer
The installer doesn't use DatabaseServiceProvider, so we need to set
the default engine in the config here too.

Fixes #1675
2018-12-04 09:12:19 +10:30
Toby Zerner
d9d7027ed0 Fix oopsie in fb6b51b1cf 2018-12-04 08:54:33 +10:30
Franz Liedke
fb6b51b1cf
Set InnoDB for DB connection and new tables
Refs #1661.
2018-11-29 23:21:58 +01:00
Franz Liedke
57f73c9638
Installer: Fix invalid join time of admin user
Fixes #1664.
2018-11-29 22:56:56 +01:00
Franz Liedke
7705a2b7d7
Fix search with database prefix
wrap() only adds a table prefix when referencing a column with a table
name (such as `foo.bar`) - when only a single identifier is provided, it
is assumed to be a column name, which does not need a prefix.

Fixes #1659.
2018-11-29 22:50:32 +01:00
Franz Liedke
f591585d02
Fix live output in ResetCommand
This was forgotten in 9e487b4.

Fixes #1663.
2018-11-29 22:04:01 +01:00
Franz Liedke
45afc33eb0
Fix code style and doc block 2018-11-29 21:31:12 +01:00
Daniël Klabbers
213fd62be3 Up the version (#1582) 2018-11-29 00:34:49 +01:00
Franz Liedke
66607a5674
Always invalidate all user email tokens
Reported by B. Dhiyaneshwaran of Geek Freak.
2018-11-29 00:33:42 +01:00
Toby Zerner
96e282458b Fix index names in migrations
This can be reverted when we upgrade to Laravel 5.7.
2018-11-27 12:19:13 +10:30
David Sevilla Martín
24ff8899a0
Throw FileNotFoundException when FileSource path does not exist
Closes #1649.
2018-11-22 23:40:38 +01:00
David Sevilla Martín
1b32c7cc51
Fix frontend extender using old container & wrong class 2018-11-22 21:17:32 +01:00
Franz Liedke
6c2a4a5ff7
Remove obsolete property accessor in User model
The locale field does not exist, and the accessor code was broken.

Closes #1653.
2018-11-22 21:12:25 +01:00
Toby Zerner
9115b9e28f Include LESS mixins and variables in all frontend compilers 2018-11-22 12:09:50 +10:30
Toby Zerner
3bff2e0f5c Consolidate ControllerRouteHandler into RouteHandlerFactory
Also allow closure to be passed for frontend content when creating routes
2018-11-22 12:09:50 +10:30
Toby Zerner
edaca3160e Refactor frontend code to allow for extension of assets
- Simpler class naming:
    Frontend\CompilerFactory → Frontend\Assets
    Frontend\HtmlDocumentFactory → Frontend\Frontend
    Frontend\HtmlDocument → Frontend\Document

- Remove AssetInterface and simply collect callbacks in Frontend\Assets
  instead

- Remove ContentInterface because it serves no purpose (never type-
  hinted or type-checked)

- Commit and add asset URLs to the Document via a content callback
  instead of in the Document factory class itself

- Add translations and locale assets to Assets separate to the assets
  factory, as non-forum/admin asset bundles probably won't want them

- Update Frontend Extender to allow the creation of new asset bundles

- Make custom LESS validation listener a standalone class instead of
  extending RecompileFrontendAssets
2018-11-22 12:09:50 +10:30
Toby Zerner
f3a5a89e12
Apply fixes from StyleCI (#1651)
[ci skip] [skip ci]
2018-11-22 08:04:41 +10:30
Toby Zerner
2ef66ac716 Add "clear cache" button to admin 2018-11-22 08:03:43 +10:30
Toby Zerner
6654894da1 Fix old session method name 2018-11-22 07:24:44 +10:30
Toby Zerner
53d1b87daf Revert "Configure external links before dispatching event"
This reverts commit 4c55d278b6.

Fixes #1650
2018-11-22 07:21:16 +10:30
Toby Zerner
c3b2d8e7d8 Typehint Frontend extender arguments 2018-11-16 15:19:51 +10:30
Toby Zerner
62a40036d0 Fix empty JS files not actually being empty 2018-11-16 15:17:57 +10:30
Toby Zerner
2c1be86857 Only say that we're migrating an extension if it has migrations 2018-11-14 16:41:36 +10:30
Toby Zerner
b26eb8e609 Publish core assets when migrating 2018-11-14 16:41:07 +10:30
Toby Zerner
1f0bf33cfb Fix extension names not being displayed when running migrations 2018-11-14 16:28:00 +10:30
Toby Zerner
7e95b80341 Drastically improve search performance
The previous approach of joining the posts table into the main search
query was not scaling well. Searches on discuss.flarum.org were taking
~1.5 seconds which – a significant improvement over the pre-beta 8
search, but still not acceptable.

This new approach uses a much more efficient subquery join. Searches
on discuss.flarum.org now take mere milliseconds. The search result
ranking strategy has been further refined as well so that discussions
are ranked by the collective relevance of their posts.
2018-11-14 11:19:39 +10:30
Toby Zerner
18b90d16e3 Allow users to hide their own posts just as they can edit them
This fixes a regression introduced by #1466.
2018-11-14 09:33:28 +10:30
Toby Zerner
3c8262ccde Fix incorrect regex modifier, causing JS to become malformed is some cases 2018-11-14 06:45:14 +10:30
Franz Liedke
68c6638fb5
Merge pull request #1633 from flarum/tz/improve-logging
Improve logging
2018-11-13 11:03:24 +01:00
Toby Zerner
105dd093fe Remove fileinfo dependency
As per https://github.com/flarum/docs/issues/14#issuecomment-365972062
2018-11-13 17:16:47 +10:30
Toby Zerner
920802e5ae Log errors when debug mode is on too 2018-11-13 07:47:01 +10:30
Clark Winkelmann
13c593cbaa Fix notification isRead value not being updated in API update response (#1635) 2018-11-12 00:14:13 +01:00
Toby Zerner
f7a320bcca Boot new application instance before enabling extensions. fixes #1587 (#1631) 2018-11-12 00:01:17 +01:00
Franz Liedke
b980c6fb7d
Remove unused default constructor 2018-11-11 23:52:47 +01:00
Toby Zerner
222e3c3fe2 Log errors that occur in the API stack
This takes place only in the FallbackExceptionHandler. Having a custom
exception handler implies that a friendly message is displayed in the
API response, in which case we can bet that the exception won't need to
be "debugged" per se.
2018-11-11 18:00:57 +10:30
Toby Zerner
903c1e329d Stop logging errors that use a custom view
Having a custom view implies that a friendly message is displayed to
the user, in which case we can bet that the exception won't need to be
"debugged" per se.
2018-11-11 17:57:55 +10:30
Toby Zerner
295a007cd5 Catch Throwables so that we handle internal PHP errors too 2018-11-11 17:54:19 +10:30
Toby Zerner
64e43ec9a4
Apply fixes from StyleCI (#1632)
[ci skip] [skip ci]
2018-11-11 17:01:34 +10:30
Toby Zerner
bf8bc0222f Delete associated notifications when deleting discussions, posts, and users. fixes #1380 2018-11-11 16:59:24 +10:30
Toby Zerner
6d14d0c39b Perform visibility checks on notification subjects at the query level
This will prevent a notification from being seen by a user if its
subject is deleted or undergoes some kind of permission change (eg.
a discussion is moved into a private tag)

ref #1380
2018-11-11 16:58:08 +10:30
Toby Zerner
17fdc0ebe0 Consolidate Post visibility logic into the PostPolicy
A post can only be seen if the discussion in which it resides can be
seen. The logic for this belongs in the policy, not the model.
2018-11-11 16:54:15 +10:30
Toby Zerner
b92ae61294 Always allow users to see their own account. fixes #1626 2018-11-11 14:25:21 +10:30
Franz Liedke
e99f7fcdac
Fix leak of private information when updating users
Fixes #1628.
2018-11-09 12:02:26 +01:00
Daniël Klabbers
bb0fc165af [b8] master token fix (#1622)
* fixed not being able to use master token because id column no longer holds key
* added flexibility of user_id column
* added tests to confirm the api keys actually work as intended
2018-11-07 22:34:09 +01:00
Daniël Klabbers
a09894a906
Update AccessToken.php
Fixes phpdoc while working on #1622
2018-11-01 10:56:45 +01:00
Daniël Klabbers
c446c5cc61 fixes author gambit when used with fulltext search, added test to cover (#1620)
* fixes author gambit when used with fulltext search, added test to cover

* Apply fixes from StyleCI

[ci skip] [skip ci]
2018-10-29 23:01:25 +01:00
Franz Liedke
a1948e7bb8
Fix installation in subdirectory
Fixes #1604.
2018-10-26 00:27:35 +02:00
Franz Liedke
2392e06c0e
Apply fixes from StyleCI (#1616)
[ci skip] [skip ci]
2018-10-24 22:20:15 +02:00
Franz Liedke
e3e10a8fc3
Allow setting all paths when instantiating Site
Fixes #1592.
2018-10-24 22:19:09 +02:00
Toby Zerner
0e3b0fc5a0 Update forgotten column name 2018-10-23 20:52:09 +10:30
Franz Liedke
4ed1d0aaee
New extender for adding variables to HtmlDocument payload
Fixes #1602.
2018-10-21 20:45:19 +02:00
Franz Liedke
86b26ce2fb
Tweak ContentInterface so that callables can be used as well 2018-10-21 20:41:45 +02:00
Daniël Klabbers
a03f243ca5 Fixes logging in with access token (#1605)
Seems the created_at column has no default value. This was always the case, at least that's what I can tell from a clean install and no migrations changing that default value.

```
$table->timestamp('created_at');
```
2018-10-21 01:21:34 +02:00
Toby Zerner
5f5e1c512c Load extensions in the configured order 2018-10-20 22:21:39 +10:30
Toby Zerner
a4d540f74b Don't require paths to be set in config - use sensible defaults 2018-10-18 19:27:03 +10:30
Daniël Klabbers
4841661ee2 adds log rotation, reducing file size per log file and easier to delete 2018-10-09 19:54:52 +02:00
Franz Liedke
8474dfd6e2
Consistent use of private instead of protected
See discussion in 5b821b21b1 (r30752077).
2018-10-04 09:08:43 +02:00
Toby Zerner
d3a5e2451a
Merge pull request #1581 from flarum/fl/1463-extension-install-hooks
Extension enable/disable hooks
2018-09-29 08:19:26 +09:30
Franz Liedke
f03c954dcc
Extensions do not need to know whether they are enabled 2018-09-26 23:34:33 +02:00
Franz Liedke
3b70b9e76e
Let extensions take care of flushing the formatter cache 2018-09-26 23:11:27 +02:00
Franz Liedke
b823a9df47
migrate: Use existing public API to filter extensions 2018-09-26 23:03:48 +02:00
Franz Liedke
8621500501
Use early returns to flatten methods 2018-09-26 22:59:48 +02:00
Franz Liedke
f48101dc04
Add a new extender interface for extension lifecycle hooks 2018-09-26 22:56:25 +02:00
Franz Liedke
3c827d2fce
Tweak extender interface in preparation for adding more methods 2018-09-26 22:36:36 +02:00
David Sevilla Martín
8c679c715c Allow admins to see last online text (#1540)
* Allow admins to see last online text

* Use viewLastSeenAt permission

* Move permission to UserSerializer, removed from ForumSerializer

* Remove extra comma from ForumSerializer to keep diff clean

* Add permission to new seed migration
2018-09-22 23:55:53 +02:00
Sajjad Hashemian
e3afb38427 fix empty base url (#1453) 2018-09-22 21:58:18 +02:00
Franz Liedke
aa70441632
Fix installation command, part 2 2018-09-22 17:45:38 +02:00
Toby Zerner
5dfb9b474c
Auth token and avatarUrl security improvements (#1514)
* Remove AbstractOAuth2Controller

There is no reason to provide an implementation for a specific oAuth2
library in core; it's not generic enough (eg. auth-twitter can't use it).

This code could be moved into another package which auth extensions
depend on, but it's a negligible amount of relatively simple code that
I don't think it's worth the trouble.

* Introduce login providers

Users can have many login providers (a combination of a provider name
and an identifier for that user, eg. their Facebook ID).

After retrieving user data from a provider (eg. Facebook), you pass the
login provider details into the Auth\ResponseFactory. If an associated
user is found, a response that logs them in will be returned. If not, a
registration token will be created so the user can proceed to sign up.
Once the token is fulfilled, the login provider will be associated with
the user.
2018-09-22 13:48:27 +09:30
Toby Zerner
fcb97b256f Add migration helper to drop columns 2018-09-22 13:45:41 +09:30
Toby Zerner
c54f739484 Make "own" permissions depend on the user's ability to reply
Permission to rename/hide/edit one's own discussion/post is only granted
if the user has permission to reply to the discussion. This makes sense
if you think of these actions as forms of "replying" to a discussion.

Fixes #1419 because suspended users do not have permission to reply to
discussions, therefore they will not be granted these "own" permissions.
2018-09-22 12:15:46 +09:30
Franz Liedke
1cd8ec6873
Display only exception messages during booting
By not letting PHP render the stack trace, we prevent displaying
sensitive information (such as the database credentials). Instead,
we display a simple line with the exception message.

In the console, the full exception can still be shown, as that is
a tool only for forum admins anyway.

Fixes #1421.
2018-09-21 23:33:28 +02:00
Franz Liedke
4ed1c7a1bb
Boot Flarum app in Server classes
This is in preparation for fixing #1421 - it allows us to
encapsulate the exception handling in the server classes, so that
we can keep the skeleton (flarum/flarum) lean.
2018-09-21 23:30:14 +02:00
Franz Liedke
c67f673819
Remove references to deleted property 2018-09-21 12:29:16 +02:00
Toby Zerner
550d35e86f
Apply fixes from StyleCI (#1574)
[ci skip] [skip ci]
2018-09-21 14:28:02 +09:30
Toby Zerner
5ce702a5d0 Make registration errors still work properly when debug mode is on 2018-09-21 14:18:17 +09:30
Toby Zerner
8ec0578ddf Fix installation command 2018-09-21 11:32:46 +09:30
Toby Zerner
c34fcecf03 Update TextFormatter deprecated API 2018-09-21 11:23:24 +09:30
Toby Zerner
9e487b4e41 Live output of migrator notes 2018-09-21 11:22:51 +09:30
Toby Zerner
986d811a16 Fix notifications crash
When loading notifications, $this->type was null and thus array_get
was returning an array instead of null. I assume this issue was
introduced in a Laravel version upgrade? Anyway, this fixes it.
2018-09-21 11:22:26 +09:30
Toby Zerner
07298e165d Use default system font instead of Open Sans 2018-09-21 11:20:17 +09:30
Toby Zerner
93dfb6dec9 Revert "Frontend extender: Remove route registration"
This reverts commit 4770a5c906.
2018-09-21 09:05:45 +09:30
Toby Zerner
750d9d05a6 Use container events as an alternative to the ConfigureMiddleware event (#1462)
By moving the DispatchRoute middleware into an `afterResolving`
callback, this will allow a new Middleware extender to add a `resolving`
callback to the appropriate container binding, removing the need for the
ConfigureMiddleware event.

The ConfigureMiddleware event has been deprecated and should be removed
in beta 9.
2018-09-16 21:21:13 +02:00
Franz Liedke
68afdd21ae
Merge pull request #1344 from flarum/1236-database-changes
Database changes
2018-09-16 20:44:29 +02:00
Franz Liedke
2367a45c18
Use instance variable directly instead of passing it around 2018-09-07 01:40:31 +02:00
Franz Liedke
4770a5c906
Frontend extender: Remove route registration
This can be achieved using the Route extender, which is more
flexible, as it does not necessary connect the URL with the current
frontend's router.

(Example use-case: The ext-embed frontend will be a new frontend,
however any routes using this frontend will be part of the forum
route group.)

Refs #851.
2018-09-07 01:40:31 +02:00
Franz Liedke
c61badd754
Frontend extender: Route to correct frontend
So far, we always added routes configured via this extender to the
forum frontend. Not correct.
2018-09-07 01:02:13 +02:00
Franz Liedke
14393ec53e
RouteHandlerFactory: Refactor frontend parameter
By passing in just the frontend identifier, we can hide some of the
implementation details, in this case the identifier of the Frontend
instance in the IoC container.
2018-09-07 01:00:56 +02:00
Franz Liedke
96045ca390
flarum info: Try to fix STDERR redirection for Windows
See the following articles for more information:
- https://www.24k.com.sg/blog-27.html
- https://support.microsoft.com/en-us/help/110930/redirecting-error-messages-from-command-prompt-stderr-stdout

Refs #1562.
2018-09-07 00:25:26 +02:00
Franz Liedke
eb228dd7b9
flarum info: Extract extension table to function 2018-09-04 00:38:08 +02:00
Franz Liedke
092e5b9d23
flarum info: Tweak output styling 2018-09-04 00:32:54 +02:00
David Sevilla Martín
7e3980744e InfoCommand improvements (#1562)
* Ignore error output of 'git rev-parse HEAD'
* Organize extension information in a table
2018-09-04 00:24:07 +02:00
Franz Liedke
85c965afbc
Use correct method from contract 2018-09-03 23:55:16 +02:00
David Sevilla Martín
43fc2c0952 Add 'oldUsername' to User\Event\Renamed (#1563) 2018-09-03 22:42:30 +02:00
Franz Liedke
5a9b47cdf7
Apply fixes from StyleCI (#1561)
[ci skip] [skip ci]
2018-09-01 23:35:37 +02:00
Franz Liedke
5374f8a352
flarum info: Display warning when in debug mode
Refs #1421.
2018-09-01 16:57:44 +02:00
Franz Liedke
5f5af894ab
Load per-site extenders, if available
Closes #1559.
2018-09-01 16:27:52 +02:00
Franz Liedke
d7c283a48f
Frontend extender: Work without extension, too 2018-09-01 16:15:02 +02:00
Toby Zerner
5142c639c1 Rename user methods 2018-08-24 22:13:06 +09:30
Toby Zerner
eb3232dfc9 Missed a spot 2018-08-24 22:13:06 +09:30
Toby Zerner
9792576464 Rename notification.sender 2018-08-24 22:13:06 +09:30
Toby Zerner
5c0c2d1c40 Rename notification.time 2018-08-24 22:13:05 +09:30
Toby Zerner
ce39bc9070 Rename user.newNotificationsCount 2018-08-24 22:13:05 +09:30
Toby Zerner
37ffd04b3f Rename user.unreadNotificationsCount 2018-08-24 22:13:05 +09:30
Toby Zerner
d8d2de438f Rename user.readTime 2018-08-24 22:13:05 +09:30
Toby Zerner
70058652b5 Rename user.isActivated 2018-08-24 22:13:05 +09:30
Toby Zerner
d9d8162684 Rename user.lastSeenTime 2018-08-24 22:13:05 +09:30
Toby Zerner
2ee10bb49f Rename user.commentCount 2018-08-24 22:13:05 +09:30
Toby Zerner
64abbde8b2 Rename user.discussionsCount 2018-08-24 22:13:05 +09:30
Toby Zerner
ca93c8c609 Rename post.hideUser 2018-08-24 22:13:05 +09:30
Toby Zerner
8248ba2f7a Rename post.editUser 2018-08-24 22:13:05 +09:30
Toby Zerner
dd65801d57 Rename post.hideTime 2018-08-24 22:13:05 +09:30
Toby Zerner
07c08ca798 Rename post.editTime 2018-08-24 22:13:05 +09:30
Toby Zerner
ae75f21b6b Rename post.time 2018-08-24 22:13:05 +09:30
Toby Zerner
29cef23404 Rename discussion.hideUser 2018-08-24 22:13:05 +09:30
Toby Zerner
a7ffed6778 Rename discussion.readNumber 2018-08-24 22:13:05 +09:30
Toby Zerner
9074f7e592 Rename discussion.readTime 2018-08-24 22:13:05 +09:30
Toby Zerner
99e5013ac3 Rename discussion.hideTime 2018-08-24 22:13:05 +09:30
Toby Zerner
1e9d9b8322 Rename discussion.lastTime 2018-08-24 22:13:05 +09:30
Toby Zerner
568006fe73 Rename discussion.startTime 2018-08-24 22:13:05 +09:30
Toby Zerner
4756bf1daf Rename discussion.lastPostedUser 2018-08-24 22:13:05 +09:30
Toby Zerner
8ecb67d49d Rename discussion.startUser 2018-08-24 22:13:05 +09:30
Toby Zerner
e241518506 Rename discussion.startPost 2018-08-24 22:13:05 +09:30
Toby Zerner
cbd0643540 Rename discussion.participantsCount 2018-08-24 22:13:05 +09:30
Toby Zerner
7716944616 Rename discussion.commentsCount 2018-08-24 22:13:05 +09:30
Toby Zerner
e135b7830e Fix installer 2018-08-24 22:12:45 +09:30
Toby Zerner
950ab30c29 Fix reset password 2018-08-24 21:54:46 +09:30
Toby Zerner
582054c61c Merge branch 'master' into 1236-database-changes 2018-08-24 21:07:00 +09:30
Toby Zerner
280d51e678
Merge pull request #1555 from flarum/fl/sites
Rewrite sites / app
2018-08-24 18:21:05 +09:30
Toby Zerner
e9ed935ed1 Revert method name 2018-08-24 17:09:22 +09:30
Toby Zerner
809b161d71 Merge branch 'master' into 1236-database-changes 2018-08-24 17:03:50 +09:30
Franz Liedke
4c8908c005
Rename extension's bootstrap.php to extend.php
...while supporting the old name for a while.

Fixes #1556.
Refs #1557.
2018-08-24 00:08:56 +02:00