Commit Graph

1422 Commits

Author SHA1 Message Date
Toby Zerner
baeaa73597 Wrap column names; use whereColumn where possible 2018-07-21 22:02:54 +09:30
Toby Zerner
677a7dd2d3 Merge branch 'master' into 1236-database-changes
# Conflicts:
#	src/Forum/Controller/IndexController.php
#	src/User/UserMetadataUpdater.php
2018-07-21 21:37:49 +09:30
Toby Zerner
c562302161 Don't save in the model 2018-07-21 21:28:44 +09:30
Toby Zerner
d42f33971a Fix user list sorting 2018-07-21 18:39:32 +09:30
Toby Zerner
aa4c4b07bd Revert notifications_from table
I didn't think this change through and it's going to be too difficult
to implement right now. It can wait until we do the notifications
revamp. For now reverting back to the old structure, with the
`sender_id` column renamed to `from_user_id`.
2018-07-21 18:35:50 +09:30
Toby Zerner
420bb2efc8 Apply fixes from StyleCI
[ci skip] [skip ci]
2018-07-21 07:52:21 +00:00
Toby Zerner
ed57d6e51c Clean up attribute assignment 2018-07-21 17:22:03 +09:30
Toby Zerner
b4f6c4be1f Specify ambiguous column names 2018-07-21 17:21:37 +09:30
Toby Zerner
ff7f7681c7 Use Eloquent's latest and oldest 2018-07-21 17:21:08 +09:30
Toby Zerner
7d0813bce4 Fix some incorrect attribute names 2018-07-21 17:20:43 +09:30
Toby Zerner
4f259425b0 Fix entity deletion
Foreign keys take care of most of this for us!
2018-07-21 17:18:40 +09:30
Toby Zerner
22fadb7f9c Fix API key generation 2018-07-21 17:14:15 +09:30
Toby Zerner
6f3eb3f335 Fix discussion and post list sorting 2018-07-21 17:10:02 +09:30
Toby Zerner
2d667d885d Fix email confirmation links 2018-07-21 17:08:11 +09:30
Toby Zerner
0fb81958cb Clean up Eloquent definitions 2018-07-21 17:06:42 +09:30
Toby Zerner
87bba2186e Fix to ensure we can rename columns in tables with enums
See https://github.com/laravel/framework/issues/1186
2018-07-21 15:26:12 +09:30
Toby Zerner
93b9513df2 Fix column names 2018-07-21 15:24:51 +09:30
Toby Zerner
fb6b2d05b1 Fix table name 2018-07-21 15:24:33 +09:30
Toby Zerner
fe73cf3237 Clean up migrations
* Make filenames and order more consistent

* Split foreign keys into their own migrations, add statements to ensure
  data integrity prior to adding them

* Add renameColumns helper, use other helpers where possible
2018-07-21 15:23:37 +09:30
Daniel Klabbers
5a04635e7a decided to leave the posts.discussion_id foreign key constraint to discussions out for now 2018-07-20 08:41:01 +02:00
Daniel Klabbers
b2e873ba7b undo carbon change as proposed in review 2018-07-19 09:15:59 +02:00
David Sevilla Martín
d6414cfb44 Properly set comments_count and discussions_count (#1436) 2018-07-17 19:02:37 +02:00
Franz Liedke
85ceda0b0b
Remove another unused parameter 2018-07-16 15:48:48 +02:00
Franz Liedke
dc7c31e1c2
Remove incorrect attribute 2018-07-16 15:48:48 +02:00
Franz Liedke
177ac74596
Apply fixes from StyleCI (#1508)
[ci skip] [skip ci]
2018-07-16 15:13:21 +02:00
Franz Liedke
c76d9e1298
Move initial permission setup to migrations
Refs #1466.
2018-07-16 15:12:46 +02:00
Franz Liedke
dee54a008f
Apply fixes from StyleCI (#1507)
[ci skip] [skip ci]
2018-07-16 01:44:50 +02:00
Franz Liedke
551ca23267
Discussion HTML: Add a canonical URL
Refs #358 and #1140.
2018-07-16 01:43:06 +02:00
Franz Liedke
3d845d5730
Discussion HTML: Fix generation of next/prev URLs 2018-07-16 01:42:36 +02:00
Franz Liedke
9b03f8c71a
Make post filtering work with database prefixes 2018-07-16 01:22:13 +02:00
Franz Liedke
ce90d2bbdd
Installer: Get rid of an instance variable
Leftover from PR #1405.
2018-07-16 00:33:32 +02:00
Franz Liedke
6e5b0f5289
Formatter: Tweak minifier setup
See discussion in PR #1457.
2018-07-14 22:57:20 +02:00
Sajjad Hashemian
fba31995b1 Upgrade text formatter (#1457)
* upgrade TextFormatter

* remove finalize options

* cleanup JsCompiler

* simplify Formatter

* refactor Formatter cache

* minify formatter js

* remove Closure Compiler
2018-07-14 22:22:14 +02:00
AFR
034b82f4d4 Create new hidePosts permission (#1466) 2018-07-14 22:15:40 +02:00
Toby Zerner
0e73785498
Frontend refactor (#1471)
Refactor Frontend + Asset code

- Use Laravel's Filesystem component for asset IO, meaning theoretically
  assets should be storable on S3 etc.

- More reliable checking for asset recompilation when debug mode is on,
  so you don't have to constantly delete the compiled assets to force
  a recompile. Should also fix issues with locale JS files being
  recompiled with the same name and cached.

- Remove JavaScript minification, because it will be done by Webpack
  (exception is for the TextFormatter JS).

- Add support for JS sourcemaps.

- Separate frontend view and assets completely. This is an important
  distinction because frontend assets are compiled independent of a
  request, whereas putting together a view depends on a request.

- Bind frontend view/asset factory instances to the container (in
  service providers) rather than subclassing. Asset and content
  populators can be added to these factories – these are simply objects
  that populate the asset compilers or the view with information.

- Add RouteHandlerFactory functions that make it easy to hook up a
  frontend controller with a frontend instance ± some content.

- Remove the need for "nojs"

- Fix cache:clear command

- Recompile assets when settings/enabled extensions change
2018-06-30 12:31:12 +09:30
Daniel Klabbers
0f5ddc1c43 phpversion minimum requirement changed in wrong location for installation 2018-06-28 11:40:34 +02:00
Daniel Klabbers
eaf98ccfc5 Revert "have install command demand php 7.1 too"
This reverts commit 9c7cc0548e.
2018-06-28 11:39:19 +02:00
Daniel Klabbers
9c7cc0548e have install command demand php 7.1 too 2018-06-28 11:23:04 +02:00
Daniël Klabbers
54678e8d5c
Merge branch 'master' into 1236-database-changes 2018-06-27 21:23:52 +02:00
Toby Zerner
b3f8379a15
Allow a single extender to be returned (#1469)
Casting an object to an array does not have the intended effect of
wrapping the object in an array. Instead we need to explicitly check
if the returned value is an array or not.
2018-06-22 18:10:54 +09:30
Daniel Klabbers
1800f4290a Merge branch 'master' into 1236-database-changes 2018-06-22 07:48:21 +02:00
Toby Zerner
805768a9e0
[WIP] JS Extender API foundation (#1468)
* Run extenders exported by extensions
* Add some basic extenders
* Patch Mithril as the very first thing so extension code can run safely
* Load the payload into the app before booting extensions
* Setup default routes before booting extensions
2018-06-22 10:49:46 +09:30
Toby Zerner
520e1550d1
Merge event listener registration 2018-06-20 23:37:27 +02:00
Toby Zerner
79b00cb94f
Rename and improve FormatterConfiguration extender
In the future we may have multiple Formatters, so by moving the config
callback to its own instance method we can leave the constructor
available to specify which formatter (like Assets and Routes). This
format also allows for other methods to be added.

Additionally, this adds logic to automatically flush the Formatter cache
whenever the extension is enabled or disabled.
2018-06-20 23:37:27 +02:00
Toby Zerner
3f683dd6ee
Webpack (#1367)
* Replace gulp with webpack and npm scripts for JS compilation
* Set up Travis CI to commit compiled JS
* Restructure `js` directory; only one instance of npm, forum/admin are "submodules"
* Refactor JS initializers into Application subclasses
* Maintain partial compatibility API (importing from absolute paths) for extensions
* Remove minification responsibility from PHP asset compiler
* Restructure `less` directory
2018-06-20 13:20:31 +09:30
Daniel Klabbers
2cd77e231f Merge branch 'master' into 1236-database-changes 2018-06-19 09:57:47 +02:00
Toby Zerner
2bc7c4134a Add comment explaining extension boot process 2018-06-15 19:25:40 +09:30
Toby Zerner
050496a20e Make ExtensionManager a singleton 2018-06-15 19:25:15 +09:30
Toby Zerner
3b87778fbb Prevent @ character used in searches from crashing MySQL 🙄 2018-06-15 19:24:23 +09:30
Toby Zerner
569e6c9a92 Escape string used in LIKE query 2018-06-15 19:19:43 +09:30
Toby Zerner
c498e68530 Use imported class name 2018-06-15 19:18:47 +09:30
Toby Zerner
305841ddd4 Add Interface suffix 2018-06-15 19:17:43 +09:30
Sajjad Hashemian
22f2df3670 rename TokenController to CreateTokenController 2018-06-06 09:40:29 +04:30
Franz Liedke
d301d260c1
Simplify interface of migration-related classes
Mostly, we only need a database connection, instead of one of
Laravel's "connection resolvers".

Again, this makes our life easier during installation, where
we already instantiate a database connection. We can now use
that to instantiate our own Migrator class, instead of using
the IoC container to build one.
2018-06-03 23:13:49 +02:00
Franz Liedke
a1c3da9f8f
Migrations: always pass a schema builder
This removes the funky auto-injection capability from migration
closures. While technically removing a feature, this means we do
not need a fully-wired IoC container e.g. during installation.

Instead, all migration closures simply receive a schema builder
object (which is what most of them were already doing anyway).
2018-06-03 23:13:35 +02:00
Daniël Klabbers
26b02adc9d
Merge branch 'master' into 1236-database-changes 2018-06-03 21:51:01 +02:00
Franz Liedke
b3d45fd6f8
Replace ControllerInterface with PSR-15 interface
The custom interface already had the same signature as the
one from the standard (except for the return type hint), so
why not use that one now? :)
2018-05-30 09:49:47 +02:00
Franz Liedke
3680d88fb7
Use PSR-15 middleware standard
This finally adopts the new standardized interfaces instead of the
work-in-progress ones with the `Interop\` prefix.

Since we have now updated to PHP 7.1, we can also use Stratigility
3.0 as the middleware dispatcher.
2018-05-29 00:18:24 +02:00
Daniël Klabbers
c293fdaec0
undo session interface change 2018-05-21 21:19:38 +02:00
Daniel Klabbers
4654c3eb50 Merge branch '1236-database-changes' of github.com:flarum/core into 1236-database-changes 2018-05-16 09:36:25 +02:00
Daniel Klabbers
68d1edb8fd new api tests uncovered more issues, fixed tokens and discussion posts 2018-05-16 09:36:04 +02:00
Daniel Klabbers
30358e98c0 merged api tests into branch 2018-05-16 09:27:01 +02:00
Daniël Klabbers
e226f81515
additional tests for api controllers (#1433)
* added CreatePostControllerTest

* added DeleteDiscussionControllerTest

* added ListDiscussionControllerTest

* added TokenControllerTest

* minor improvement to policy, no need for Carbon object there, added ShowDiscussionControllerTest

* added showDiscussionControllerTest but cant make Guests view the discussion created by a user

* viewing for guests tested, we might need factories
2018-05-16 09:25:48 +02:00
Clark Winkelmann
4c55d278b6
Configure external links before dispatching event
This way extensions can override the link attributes
2018-05-15 00:12:33 +02:00
luceos
808e7a226a Apply fixes from StyleCI
[ci skip] [skip ci]
2018-05-14 11:50:06 +00:00
Daniel Klabbers
3e3e1cbde5 fixed more attributes to match beta 8 2018-05-14 13:49:52 +02:00
Daniel Klabbers
81cb67e87c fixed the created_at issue from the policy caused by the setStartPost setting created_at to null 2018-05-14 11:52:01 +02:00
Daniel Klabbers
fd859e33be fixed several column changes found by tests 2018-05-14 11:34:24 +02:00
Daniel Klabbers
7539c25048 Merge branch 'master' into 1236-database-changes 2018-05-14 09:25:52 +02:00
Daniel Klabbers
0058067b1b merged master 2018-05-14 09:23:06 +02:00
Daniël Klabbers
3c41011548 allowing configurable flood gate (#1411)
* allowing configurable flood gate

* fixed review comments
2018-05-11 19:27:37 +09:30
Charlie
4df0101f56 Update icons to "fas" (#1426)
* Update icons to "fas"

* Install icon change
2018-05-09 08:56:30 +02:00
Daniël Klabbers
b8632d693a
fixes session during installation (#1418)
* fixes session during installation

* Apply fixes from StyleCI

[ci skip] [skip ci]

* styling of commented code, removed unnecessary import
2018-05-08 10:32:28 +02:00
Daniel Klabbers
684985c25c is email confirmed boolean fixed 2018-04-17 14:27:52 +02:00
Daniel Klabbers
a2927b725f went over most of the changed attributes from the other pr 2018-04-17 14:22:38 +02:00
Daniel Klabbers
efa3b62fb8 joined_at renamed to User 2018-04-17 13:25:11 +02:00
Daniel Klabbers
406be427ad tables renamed, auth_tokens and permissions 2018-04-17 12:21:55 +02:00
Daniël Klabbers
c4a501f82a
Improved foundational backend unit tests (#1405)
* part one of adding tests, updating core

* Apply fixes from StyleCI

[ci skip] [skip ci]

* we need xdebug for code coverage, and hhvm was already removed

* forgot about the sidecar for mysql completely 🤦

* gitignore removed this installed json we need to fake that we have extensions

* using reguarded closure
2018-04-17 11:15:28 +02:00
Daniel Klabbers
264664ac79 added the create discussion test, also renamed some classes that seem to have been incorrectly renamed from the other testing branch 2018-04-13 09:06:42 +02:00
Daniel Klabbers
dcb3821777 part one of adding tests, updating core 2018-04-13 07:13:10 +02:00
Daniël Klabbers
043aa0f2d9 fixes log in without remember on master (#1402)
* fixes log in without remember on master

* Fix cookie name by removing prefix from session name rather than in CookieFactory

* Inline temp variable
2018-04-12 06:49:34 +09:30
Toby Zerner
f51e29ff4c Fix absence of variable reference 2018-04-11 10:03:51 +09:30
Franz Liedke
46f80e8d72
Do not load Laravel's SessionServiceProvider 2018-03-31 18:08:35 +02:00
Franz Liedke
f42273e679
Merge pull request #1366 from flarum/illuminate-session
Use Illuminate Session component instead of Symfony
2018-03-24 20:42:58 +01:00
Franz Liedke
2b6ee50c58
Merge pull request #1396 from flarum/writable-path-check-fix
public path should not be writable, but base path should
2018-03-22 08:22:25 +01:00
David Sevilla Martín
baa11acfa8
Fix "Debug mode" in InfoCommand not showing 2018-03-21 20:00:14 -04:00
Daniël Klabbers
c60d6e9dee
public path should not be writable, but base path should 2018-03-21 20:52:49 +01:00
Franz Liedke
0cf351edb9
List debug mode setting in info output 2018-03-19 23:28:05 +01:00
Franz Liedke
fdbf0c86a1
Return empty response
Without this, the new version of Stratigility complained about no
response being returned. Old versions were more graceful here, but
this is certainly more correct.
2018-03-19 23:06:27 +01:00
Franz Liedke
8d2d987680
Split up Locale extender
Now we have two extenders:
- `Extend\LanguagePack` is the "convention over configuration" loader
  for complete language packs.
- `Extend\Locales` can be used to load files (by locale) from a given
  directory - useful for extensions that bring along their own locales
  in multiple different languages.

Refs #851.
2018-03-19 01:07:59 +01:00
Franz Liedke
bb49e24ffe
Bind session handling to request lifecycle
With this change, session objects are no longer instantiated
globally, but instead created within a middleware during the
request lifecycle.

In addition, session garbage collection is integrated with
the already existing middleware for this purpose.
2018-03-18 15:58:31 +01:00
Toby Zerner
5672819549
Use Illuminate Session component instead of Symfony
Symfony's component relies on PHP's native session functionality, which
is not ideal. It automatically sets its own cookie headers, resulting in
this issue: https://github.com/flarum/core/issues/1084#issuecomment-364569953

The Illuminate component is more powerful and has a simpler API for
extension with other drivers and such, and fits in nicely with other
components we use (the majority of which are from Illuminate).
2018-03-18 14:43:44 +01:00
Franz Liedke
5645bcbf9c
Apply fixes from StyleCI (#1391)
[ci skip] [skip ci]
2018-03-18 13:53:44 +01:00
Franz Liedke
9d30be1617
Update Stratigility, use http-interop middleware 2018-03-18 13:52:16 +01:00
Daniël Klabbers
0c5c322cb4
fixes the broken hash & hash.driver ioc binding which is part of 5.6 2018-03-08 14:25:25 +01:00
Clark Winkelmann
aba22b9119
Remove unused $lifetime variable 2018-03-07 01:30:23 +01:00
Franz Liedke
26dfc8ae21
Apply fixes from StyleCI (#1381)
[ci skip] [skip ci]
2018-03-04 01:18:49 +01:00
Franz Liedke
db7cd71f19
Move logic to Extension class
The gathering and execution of extenders can actually be done here
in the `Extension` class. This way, the `ExtensionManager` only
deals with the question of which extensions are enabled, the
`Extension` class actually extends the core application, and the
service provider simply calls a method, without having to know
about internals.
2018-03-04 01:16:50 +01:00
Toby Zerner
2967b5d106 Give Extenders information about which Extension they belong to 2018-03-04 10:13:12 +10:30
Toby Zerner
571938a677 Update core container aliases 2018-02-24 10:37:21 +10:30
AFR
1a2df2d581 FontAwesome v5.0.6 (#1372)
* Update FontAwesome to v5.0.6

* Adapt DiscussionListItem-count icon to match FontAwesome 5 syntax

* Change icon name to match FontAwesome 5.0.6 fas icon

* Add font type prefix parameter to icon helper

* Add Enable Icon Prefix to show icon in Extension Page

* Fix invalid icon behavior

* Change icon name to match FontAwesome 5.0.6 far icon

* Use iconPrefix property on component

* Use full icon class name

* Update icon helper docblock

* Full icon class syntax
2018-02-23 23:42:00 +01:00
Marcel Pokrandt
0f554585ac add message to Dispatch exceptions (#1376)
Exceptions thrown while attempting to dispatch routes are now informing the exact value that was incorrect; url for not found routes and the method when the method was invalid.
2018-02-21 11:28:45 +01:00
Franz Liedke
0b478379fc
Apply fixes from StyleCI (#1371)
[ci skip] [skip ci]
2018-02-15 16:57:18 +01:00
Franz Liedke
ba96f311a9
Refactor MIME type guessing to work without any PHP extension
Closes #1241.
2018-02-15 16:40:41 +01:00
Toby Zerner
34588a74e2
Merge pull request #1363 from clarkwinkelmann/extension-rollback
Add extension rollback command
2018-02-13 07:18:00 +10:30
Clark Winkelmann
58ffa27bfb
Rename to reset and make extension an option 2018-02-11 20:03:54 +01:00
Franz Liedke
f0cea11e79
API: Provide forum info under /
Closes #875.
2018-02-11 16:40:05 +01:00
Toby Zerner
160493e725 fire -> dispatch
As per Illuminate\Contracts\Events\Dispatcher
2018-02-10 12:09:35 +10:30
Clark Winkelmann
5561e28286
Fix formatting 2018-02-09 18:42:43 +01:00
Clark Winkelmann
c9cfcee12a
Fix formatting 2018-02-09 18:41:51 +01:00
Clark Winkelmann
479fafbf5c
Add extension rollback command 2018-02-09 18:32:44 +01:00
Johann Rodríguez
7721288ac6 No slug? Then no '-' separator! (#1351)
* Stop using slug separator when there is no slug

* Changing as per upstream requirements
2018-02-09 07:22:50 +10:30
Toby Zerner
0ab1f2cfe7 Fix regression: set actor before eager loading user state 2018-02-08 07:08:39 +10:30
Toby Zerner
322a84f516
Improve search performance (#1339)
* Improve fulltext gambit

* Only search in visible posts

This change relies on the `visibility-scoping` branch to be merged.

* Change posts table to use InnoDB engine

Doing a JOIN between an InnoDB table (discussions) and a MyISAM table
(posts) is very very (very) bad for performance. FULLTEXT indexes are
fully supported in InnoDB now, and it is a superior engine in every
other way, so there is no longer any reason to be using MyISAM.

* Use ::class

* Only search for comment posts

* Add fulltext index to discussions.title

* Fix migration not working if there is a table prefix

* Update frontend appearance

* Apply fixes from StyleCI

[ci skip] [skip ci]

* Show search result excerpts on mobile
2018-02-08 06:38:08 +10:30
Daniel Klabbers
80ec3b5e17 Improved the console configuring event to support any type of console command to be added 2018-02-07 13:58:31 +01:00
Clark Winkelmann
636e965873 Add console configuration event (#1349)
* Add console configuration event

* Fix comment formatting
2018-02-07 21:49:08 +10:30
Daniel Klabbers
419adb748b validation requires nullable now in order to allow null values to pass the validation 2018-02-02 11:38:06 +01:00
Clark Winkelmann
2eae968a70 Assert permission when updating avatar 2018-01-31 16:36:42 +01:00
Toby Zerner
7651907f56 Don't break compatibility with extensions that return a function name
eg. s9e/mediaembed
2018-01-31 07:20:49 +10:30
Toby Zerner
557a65aadd Grant users permission to view empty discussions if they can edit posts
This fixes an issue where unapproved discussions (via
flarum-ext-approval) that were rejected became invisible to the user.

This solution is imperfect and some more substantial thought into how
flarum-ext-approval works is required in the future.
2018-01-30 11:14:25 +10:30
Toby Zerner
ad4bd3d001
Overhaul model visibility scoping (#1342)
* Overhaul the way model visibility scoping works

- Previously post visibility scoping required concrete knowledge of the
  parent discussion, ie. you needed a Discussion model on which you
  would call `postsVisibleTo($actor)`. This meant that to fetch posts
  from different discussions (eg. when listing user posts), it was a
  convoluted process, ultimately causing #1333.

  Now posts behave like any other model in terms of visibility scoping,
  and you simply call `whereVisibleTo($actor)` on a Post query. This
  scope will automatically apply a WHERE EXISTS clause that scopes the
  query to only include posts whose discussions are visible too. Thus,
  fetching posts from multiple discussions can now be done in a single
  query, simplifying things greatly and fixing #1333.

- As such, the ScopePostVisibility event has been removed. Also, the
  rest of the "Scope" events have been consolidated into a single event,
  ScopeModelVisibility. This event is called whenever a user must have
  a certain $ability in order to see a set of discussions. Typically
  this ability is just "view". But in the case of discussions which have
  been marked as `is_private`, it is "viewPrivate". And in the case of
  discussions which have been hidden, it is "hide". etc.

  The relevant API on AbstractPolicy has been refined, now providing
  `find`, `findPrivate`, `findEmpty`, and `findWithPermission` methods.
  This could probably do with further refinement and we can re-address
  it once we get around to implementing more Extenders.

- An additional change is that Discussion::comments() (the relation
  used to calculate the cached number of replies) now yields "comments
  that are not private", where before it meant "comments that are
  visible to Guests". This was flawed because eg. comments in non-public
  tags are technically not visible to Guests.

  Consequently, the Approval extension must adopt usage of `is_private`,
  so that posts which are not approved are not included in the replies
  count. Fundamentally, `is_private` now indicates that a discussion/
  post should be hidden by default and should only be visible if it
  meets certain criteria. This is in comparison to non-is_private
  entities, which are visible by default and may be hidden if they don't
  meet certain criteria.

Note that these changes have not been extensively tested, but I have
been over the logic multiple times and it seems to check out.

* Add event to determine whether a discussion `is_private`

See https://github.com/flarum/core/pull/1153#issuecomment-292693624

* Don't include hidden posts in the comments count

* Apply fixes from StyleCI (#1350)
2018-01-27 09:57:16 +10:30
Franz Liedke
4b1a299b3c
Convert closures in arrays to Compat extenders as well
Refs #851.
2018-01-21 22:38:06 +01:00
Franz Liedke
fa14be591c
Use cursor() fetching when deleting many posts
Refs #1319.
2018-01-21 21:53:48 +01:00
Franz Liedke
072f4f89cb
Assets extender: Remove defaultAssets() method
See a7821a24a2 (r26990974).
2018-01-21 21:14:08 +01:00
Toby Zerner
ed3e833181 Fix docblocks 2018-01-21 08:28:15 +10:30
Toby Zerner
7f92838225 Fix Laravel 5.5 query scoping 2018-01-21 08:28:08 +10:30
Clark Winkelmann
d357364712 Rename method and attribute, and remove unnecessary attribute filtering 2018-01-11 23:05:26 +01:00
Clark Winkelmann
26449a64fe Merge remote-tracking branch 'upstream/master' into signup-fields-locking 2018-01-11 22:54:41 +01:00
Toby Zerner
ae2e07e94c Remove use of event priorities
Event priorities are no longer in Laravel - see dbbfc62bef

Updated the AbstractPolicy terminology to reflect the new behaviour,
which is that there is no guarantee that the catch-all methods will run
after all specific methods have run globally. This behaviour is only
guaranteed within the policy.
2018-01-11 14:10:37 +10:30
Toby Zerner
801d619a36 Fix docblock return type 2018-01-11 12:11:48 +10:30
Toby Zerner
0befe041c7 Use whereRaw instead of Expression 2018-01-11 11:56:18 +10:30
Toby Zerner
1c87c33d4d Use ::class, update some typehints 2018-01-11 11:55:57 +10:30
Franz Liedke
30a04e7bf9
Don't use invokables with Container::call() 2018-01-10 19:37:18 +01:00
Franz Liedke
0af97c427c
Re-introduce Compat extender
Turns out Container::call() does not work with invokable classes.
Thus, we need to wrap callables in a custom extender class to
support injecting any resolvable type-hint automatically.

Refs #851.
2018-01-10 19:32:57 +01:00
Franz Liedke
c6747b6910
Get rid of Compat extender
Now that we support any form of callable to be returned from the
bootstrap.php files, it is no longer needed.
2018-01-09 22:35:40 +01:00
Franz Liedke
1ce70eeb6e
Turn extenders into callables
This simplifies the API and gives extension developers more
flexibility, for a) maintaining backwards compatibility, and
b) doing advanced stuff that extenders do not allow.

Note that only extenders are guaranteed to work across
different versions of Flarum (once the API surface is stable).

See the discussion in https://github.com/flarum/core/pull/1335.
2018-01-09 20:49:51 +01:00
Daniel Klabbers
714775cfed fixed two typehints on migrations repository 2018-01-09 16:28:50 +01:00
Clark Winkelmann
f3e29ab801 Dispatch user events after password reset
Previously PasswordChanged was never sent
2018-01-09 03:44:06 +01:00
Franz Liedke
26e53fc51b
Tweak route registration extender: Use plural
This makes it more consistent with other existing extenders,
while also making registration of multiple routes more
comfortable for extension developers, and likely slightly
more performant. :-)
2018-01-07 19:50:49 +01:00
Willem de Groot
5af65dede1 Fix StyleCI spacing 2018-01-06 12:03:02 +01:00
Willem de Groot
e774baf32f Remove execute permissions from php/less files 2018-01-06 11:59:25 +01:00
Toby Zerner
2ac04aac8e Merge branch '0.1.0-beta.7' 2018-01-06 20:06:43 +10:30
Clark Winkelmann
c6aeeeb3c1 Always apply attributes from token when registering
The change introduced in #1033 transformed any identification attribute returned from an OAuth provider to just a default value.

When the identification attribute used by the provider is the email or username, this allowed the user to supply a different email or username and still getting an already-enabled account with the credentials he entered.

Skipping attributes with an existing value makes no sense here because it's a always a fresh user and values from AbstractOAuth2Controller::getIdentification() should always be enforced.
2018-01-06 20:04:42 +10:30
Toby Zerner
f247d8c2a6
Merge pull request #1335 from flarum/next-back-extenders
Start of PHP extenders API
2018-01-06 09:17:27 +10:30
Franz Liedke
0380536cb4
Add another newline before custom footer HTML 2018-01-05 23:46:38 +01:00
AFR
6dc96b38af Add Custom Footer HTML (#1315)
* Add Custom Footer HTML

Straight copy from Custom Header HTML

* Move Custom Footer HTML to exactly before `</body>` tag.

* Fix invalid class name

* Append CustomFooterHTML when preparing the view.

* Some consistency in placing the variable
2018-01-05 23:44:11 +01:00
Franz Liedke
8d049126d0
Add Route extender for registering routes with forum, admin or API 2018-01-03 23:19:45 +01:00
Franz Liedke
63be95fb8a
Admin: Set up all event listeners in one place
See discussion in #1273.
2018-01-03 20:23:05 +01:00
Franz Liedke
1d47047d45
Add FormatterConfiguration extender for extensions working with TextFormatter 2018-01-03 09:42:11 +01:00
Franz Liedke
4e30ad5891
Add Assets extender for frontend extensions 2018-01-03 09:42:11 +01:00
Franz Liedke
f4ad227576
Add Locale extender for language pack extensions 2018-01-03 09:42:11 +01:00
Franz Liedke
5b6d043f80
Resolve extenders from ExtensionManager
Loading the activated extensions now means retrieving an array of
extenders (classes that implement a certain type of extension of a core
feature in Flarum).

For now, the only existing extender is the Compat extender which is used
to handle old-style bootstrappers that simply return a closure that
receives all of its dependencies via auto injection.

In the future, extensions will be able to return an array of extender
instances from their bootstrapper instead. These extender classes will
be implemented in the next step.
2018-01-03 09:42:11 +01:00
Franz Liedke
c41e58531a
Deprecate remaining non-namespaced events
These will be replaced by etenders soon.
2018-01-03 09:42:11 +01:00
Franz Liedke
b760d113d2
Installation default data: Use more sensible defaults
Using .dev as a TLD for local development is discouraged, as at
least Chrome now enforces HTTPS for these domains.

As far as I know, by default, the MySQL root user does not have
a password on many platforms. I use it this way on my local
machine, and this makes it convenient to setup a local copy.
2018-01-03 09:41:46 +01:00
Franz Liedke
936f67e953
Use ::class instead of some hardcoded class names
This gives us better refactoring functionality in IDEs like
PhpStorm, and also more quickly surfaces typos through errors
about undefined classes. :)
2018-01-03 09:41:46 +01:00
Franz Liedke
3f7e7520b0
Clean up code, use PHP 7 feature :) 2018-01-03 09:41:46 +01:00
Clark Winkelmann
7ccb263926 Fix array_only usage 2018-01-02 00:27:13 +01:00
Toby Zerner
fe56f57e8f Fix order of array_first arguments
As per https://laravel.com/docs/5.3/upgrade (under "Arrays")
2018-01-02 09:48:50 +10:30
Clark Winkelmann
fa9d89d690 Prevent editing fields in sign up modal according to identification data 2018-01-02 00:13:33 +01:00
Toby Zerner
292fe06001 Re-add missing middleware 2018-01-01 10:45:26 +10:30
Toby Zerner
d807171c44 Fix URL generator usage 2017-12-29 21:29:04 +10:30
Toby Zerner
57a91c966d Fix view paths 2017-12-29 21:28:53 +10:30
Toby Zerner
0525f467c7 Fix class reference 2017-12-29 18:42:31 +10:30
Franz Liedke
b791790d2f
Fix comment 2017-12-28 22:47:13 +01:00
Toby Zerner
ac7d28ca58 Remove unused method 2017-12-27 16:17:35 +10:30
Toby Zerner
8a6344cfcf Fix some class names, clean up imports 2017-12-27 16:17:25 +10:30
Toby Zerner
a0621e85bf Fix order of array_first arguments
As per https://laravel.com/docs/5.3/upgrade (under "Arrays")
2017-12-26 20:38:15 +10:30
Franz Liedke
56231d61be
Move garbage collection into middleware
This prevents garbage collection to randomly break the installer:
before installation, the models that are being accessed have no
database connection.

Now, the middleware is only mounted into the forum's middleware
stack. I want API requests to have stable performance, and the
forum middleware stack is only mounted when Flarum is installed.
2017-12-21 12:23:34 +01:00
Franz Liedke
c8a1a5fcfa
Fix more incompatibilities with Laravel 5.5 2017-12-20 00:20:23 +01:00
Franz Liedke
8d5132fd5a
Disable HandleErrors middleware during installation
Temporary measure until we have a real fix in place.
2017-12-20 00:00:23 +01:00
Franz Liedke
6efe2ee91a
Fix previous commit
Prevent `flarum.config` from being bound in the container when the
software has not been installed yet.
2017-12-19 23:48:38 +01:00
Franz Liedke
bfd98e3371
DRY up loading of config 2017-12-19 23:16:06 +01:00
Toby Zerner
e9da1ba2f5 Remove Listener namespace
We may reverse this in the future, but for now just going for
consistency between domains (the majority do not use a Listener
namespace)
2017-12-19 18:59:14 +10:30
Toby Zerner
2b8c66354d Apply fixes from StyleCI
[ci skip] [skip ci]
2017-12-19 08:24:06 +00:00
Toby Zerner
4cf481355f Fix usage of UrlGenerator in notifications 2017-12-19 18:52:27 +10:30
Toby Zerner
2ec183778c Pick up config when setting a new base path 2017-12-19 18:38:00 +10:30
Daniel Klabbers
1b94ef90ea the admin service provider also has to use the new HandleError logic 2017-12-15 09:35:02 +01:00
Daniel Klabbers
183a22b5c5 - FilesystemInterface no longer needed in User related handlers
- FilesystemInterface conditional ioc binding moved to AvatarUploader
- User::getAvatarAtribute failed to use the UrlGenerator properly
2017-12-15 09:29:20 +01:00
Daniel Klabbers
654fca9c2c fixed the BasicFoo vs FooBasic serializer definition issue, prevented for future using ::class 2017-12-15 08:29:07 +01:00
Daniel Klabbers
7be01119f5 and another.. 2017-12-15 08:15:08 +01:00
Daniel Klabbers
28d4cff156 satisfying sci isnt enough for it, lets please it further 2017-12-15 08:14:15 +01:00
Daniel Klabbers
2aba61668c - satisfying styleci
- cleared the merge conflict in the phpdoc
- changed some string class names to use ::class
2017-12-15 08:10:32 +01:00
Daniël Klabbers
f65e4dcba3
merges 5.5 and master into next-back 2017-12-14 01:00:16 +01:00
Franz Liedke
c6ce172caa
Apply suggestions from StyleCI 2017-12-13 23:08:35 +01:00
Clark Winkelmann
d2f187716e Prevent saving invalid custom less (#1273)
* Prevent saving invalid custom less

* Fix formatting

* Fix formatting again

* Move custom less format check to its own listener

* Move listener to AdminServiceProvider

* Rename listener method
2017-12-13 22:39:09 +01:00
Daniël Klabbers
93aa3d77b5
re-using symfony translator 2017-12-13 21:45:55 +01:00
Toby Zerner
a0c95e6705 Filter out notifications with non-existent subjects
ref #1025 #1238. This should prevent the frontend from crashing when
opening the notifications menu, but we still need to make sure
notifications are deleted properly when subjects are deleted.
2017-12-13 15:54:16 +10:30
Toby Zerner
77c25ab725 Add infinite scrolling in the notifications list 2017-12-13 15:28:54 +10:30
Toby Zerner
3dcfe32b27 Extract admin dashboard statistics from core into an extension 2017-12-10 21:03:48 +10:30
Toby Zerner
617a76dda8 Fix PHP 7.2 warning 2017-12-10 21:02:47 +10:30
Toby Zerner
b806dc3db2 Move view logic into middleware 2017-11-29 22:25:57 +10:30
Toby Zerner
92de751154 Fix last commit 2017-11-29 22:22:14 +10:30
Toby Zerner
5b46ec801d Generate URL in the controller instead of the view 2017-11-29 22:20:06 +10:30
Toby Zerner
1ef9217f4d Basic implementation of dashboard widgets, statistics
Currently not user-customizable. Just needed to display statistics for a
client, so figured I'd make a start at this. Nothing too fancy for now,
but I'm sure some people will be happy to have this information at their
fingertips.
2017-11-29 17:19:20 +10:30
Toby Zerner
79fee3686f More precise permission check for email gambit 2017-11-29 17:02:49 +10:30
Toby Zerner
8edc8223e5 Fix admin error handling 2017-11-29 16:10:22 +10:30
Daniël Klabbers
6280fb2498
reverting translator contract 2017-11-29 06:26:48 +01:00
Toby Zerner
ba769e0c7e Preserve return URL when confirming logout 2017-11-29 13:47:00 +10:30
Toby Zerner
ea2fc1ff8a Add a "return home" link to 404 errors 2017-11-29 13:23:25 +10:30
Toby Zerner
b7c1cc5cef New design for error pages. closes #252 2017-11-29 13:03:55 +10:30