Commit Graph

1885 Commits

Author SHA1 Message Date
Daniel Klabbers
be7581c432 fix missing import of container for resolving the queue connection from ioc 2021-05-17 21:13:30 +02:00
Alexander Skvortsov
fede3f9fc7 Fix glitchy group editing
Currently, when groups are edited, the new groups flicker, but the UI soon reverts to the old groups. This is because the returned API response has the old group values. This, in turn, is because we eager load groups, and when we sync the new group relation, that doesn't update the groups saved in memory. By unsetting the relation, we make sure the right groups are returned (and also available to the GroupsChanged event).

See https://github.com/flarum/core/issues/2514
2021-05-15 02:30:03 -04:00
Sami Mazouz
1a19856c0c
Fix version update page (#2862)
* Binding closures only get the container instance as argument
2021-05-14 16:10:05 +01:00
SychO9
0236e1529e Update Application version constant to 1.0.0-dev 2021-05-13 22:19:01 +01:00
Sami Mazouz
7bceda976b
Backend cleanup (#2859)
* Extender docblocks cleanup
* Excplicit type hinting in extenders
* Bring method under constructor
* Mark some classes and methods as internal
* Remove beta references

Co-authored-by: Clark Winkelmann <clark.winkelmann@gmail.com>
2021-05-13 15:26:24 +01:00
Alexander Skvortsov
d64750b3eb
Rename viewDiscussions => viewForum, viewUserList => searchUsers (#2854)
This naming is clearer as to the intended effect. Changes include:

- A migration to rename all permissions
- Updating the seed migration to use the original naming from the start
- Replacing usage of the old names with new names in code
- Throwing warnings when the old names are used.
2021-05-11 15:15:27 -04:00
David Sevilla Martín
765bd59965
Improve discussion page canonical URL (#2853)
* Switch to ?page= discussion page canonical URL & fix no-JS pagination buttons
2021-05-10 19:20:47 -04:00
Alexander Skvortsov
6ecca9565a
Squash core migrations (#2842)
Data migrations (seed default groups, seed default permissions) are deliberately excluded.
This also allows us to remove a lot of now unnecessary public API from the migrator and migration repository.
2021-05-10 18:05:01 -04:00
Alexander Skvortsov
104a31ba30
Run API Client requests through middleware (#2783)
- Add integration tests for login and registration
- Use URL instead of controller
- Add fluent API
- Allow setting parent request, user, session
2021-05-10 17:41:38 -04:00
Alexander Skvortsov
66233ce818 Remove unused variable 2021-05-04 18:15:05 -04:00
Alexander Skvortsov
7d4bd8a845
Centralize permission caching (#2832) 2021-05-04 13:56:14 -04:00
Matt Kilgore
7eea2476ca
Harden Headers (#2721)
* Basic security headers

* Remove XSS Header (not relevent)

* Fix config name

* Use Arr::get()

* Add tests

* Re-fix the StoreConfig step for fresh installs

Co-authored-by: luceos <luceos@users.noreply.github.com>
Co-authored-by: Alexander Skvortsov <askvortsov1@users.noreply.github.com>
2021-05-03 12:42:06 -04:00
Alexander Skvortsov
b45519974a
Switch to ICU MessageFormat (#2759) 2021-04-30 12:44:39 -04:00
Alexander Skvortsov
edaf45d133
Remove unnecessary laravel config (#2796) 2021-04-30 00:31:19 +02:00
Matt Kilgore
6b9e991082
Move Powered By Header to headers config (#2777)
* Move Powered By Header to headers config
* Use Arr::get()
2021-04-30 00:30:01 +02:00
Daniël Klabbers
e337c10bb8
Revision compiler revised (#2805)
- revisions now use <asset>.<type>?v=<revision> instead of <asset>-<revision>.<type>- remove deprecated filename for revision method
- reconsider use of cache differentiator and implement something that
prevents recompiling css every single time
- allow force recompilation
2021-04-29 16:49:36 -04:00
Daniël Klabbers
e0258d2708
error handling when extending flarum from extensions fails (#2740) 2021-04-29 16:17:41 -04:00
Daniël Klabbers
fcb5778705
fixed container bindings use of container (#2807) 2021-04-29 15:33:51 -04:00
Daniël Klabbers
deadd67691
clarify callable arguments for password checker (#2812) 2021-04-29 10:19:06 -04:00
David Wheatley
f9779284e4
Add users list to admin dashboard (#2626)
* Commit initial WIP code

* Fix squashed grid on mobile

* Add pagination support; rename to userList

* Improve grid sizing

* Improve grid row shading

* Move EditUserModal to common

* Add link to profile page in grid

* Use Less styling vars

* Move EditUserModal translations to lib

* Add edit user button to grid

* Fix incorrect profile link priority

* Update profile link translation key

* Add priorities to other columns

* Add group badges to grid

* Add username to profile link tooltip

* Organise imports

* Use variable for header border bottom color

* Fix broken export

* Add total user count to API payload's metadata

* Add new metadata to ApiPayload type

* Implement correct page number

* Remove debug code

* Use function to get the total pages

This allows us to use the raw count elsewhere in the component (pssst... check the next commit!)

* Center profile link in column

* Add profile link header

* Show total users above table

* Use ItemList's itemName property for column data attributes

* Add user email column, hidden by default

This column is hidden by default using a placeholder email and blur filter. These are then removed when the visibility toggle is pressed.

This prevents any over-the-shoulder accidental data leakage, as emails are classed as PII under GDPR.

* Fix incorrect tooltip translation keys

* Add extra padding between email and visibility toggle button

* Prevent selection of blurred email

* Fix incorrect icon state for email toggle

* Update API response type to include metadata (for now)

* Increase number of users per page to 50

* Update compat files with new locations

* Format

* Add @deprecated notices for forum compat export

* Use AdminPayload for user count instead of supplying as REST API metadata

* Make nav look less squashed using bottom margin

* Suppress TS warning

* StyleCI fixes

* Fix TS error

* Update based on review comments

* Rename user list -> users

* Rename internal instances of user_list to users

* Fix formatting

* Use CSS custom properties for the table column count

* Use .Button--icon instead of custom style

* Make fake email more realistic length

* Add a11y attributes

* Use padding bottom instead of margin bottom for page spacing

* Make compatible with new CSS LoadingIndicator

I won't let it break here! :P

* Integrate profile link into username column

* Don't force columns to be 300px

This made the grid look very bloated and intimidating -- lets instead increase the padding between items and make it only the width it needs to be.

* Center edit user button in column

* Increase spacing between email and visibility toggle button

* Rename `statistics` to `modelStatistics` in Admin payload

This prevents any possible conflicts with core and `flarum/statistics`. We might want to consider migrating the stats extension to extend this object in the future.

* Update comments, fix TS error

* Various translation key changes

* Change gmail.com -> example.com

* Stretch 'edit user' button to entire cell size

* Update translations

* Is the YAML formatted right this time? 🙈

* Remove email placeholder

Fixes an issue where the table would jump if an email was unhidden that was longer than the placeholder.

* Re-order lib translations

* Clicking blurred email now unblurs

* Correct header class

* Improve edit user button centring

* Improve vertical row item centering

* Fix incorrect column length in aria attribute

* Use .Button--text!
2021-04-22 23:35:42 +01:00
Sami Mazouz
b62debf031
Add user id slug driver (#2787) 2021-04-20 23:52:53 +01:00
Alexander Skvortsov
1f2411e15e
Fix searching titles in discussions (#2698)
* Fix searching titles in discussions

* Apply fixes from StyleCI

* Fix tests

* Distinct by discussion ID

* Replace distinct with groupBy

Co-authored-by: Alexander Skvortsov <askvortsov1@users.noreply.github.com>
2021-04-20 18:52:14 -04:00
Alexander Skvortsov
5e2340bf10
Fix registering custom searchers, allow searchers without fulltext (#2755) 2021-04-19 16:59:53 -04:00
Alexander Skvortsov
c84939b19c
Filesystem Extender and Tests (#2732) 2021-04-19 16:25:08 -04:00
Alexander Skvortsov
4974c91481
Asset Publish Command (#2731) 2021-04-19 15:51:28 -04:00
Alexander Skvortsov
f67149bb06
Use Laravel filesystem interface for assets and avatars (#2729)
* WIP: Use Laravel filesystem interface where possible
* Drop vendorFilesystem
* Support getting URL of cloud-based logo and favicon
* FilesystemAdapter should always be cloud
* Get base avatar URL from filesystem adapter
* Restore deleted getAsset method

Co-authored-by: Alexander Skvortsov <askvortsov1@users.noreply.github.com>
2021-04-19 21:11:03 +02:00
Alexander Skvortsov
e77365f32f
Add id to migrations table (#2794) 2021-04-19 10:35:21 -04:00
Alexander Skvortsov
c7c456cb3e Remove unused container argument 2021-04-18 17:20:14 -04:00
Alexander Skvortsov
fb51fb4e6d
Drop session from user class (#2790)
This was originally introduced in 3612ca7aca, but has not seen usage, since usually when the session needs to be modified, the request is available.

It causes issues with certain queue drivers, as it can't be serialized.

It's also not entirely accurate, as a user can have multiple sessions at once. Therefore, a given session is a property of the request, not of the user.

The reason this causes issues in the Queue is that when a Job has payload that consists User(s), the Queue will try to serialize that. Serializing the User object will require serializing the session too; this causes a Serialization of Closure is not allowed error, see image.

One can circumvent that in many ways, the most obvious one is adding a __sleep and __wakeup implementation in the User class (or the session handler). But as we aren't really using the session on the User model anywhere in core, bundled or most community extensions it is best to simply detach this from the user.
2021-04-16 15:53:05 -04:00
Sami Mazouz
5b7d364b87
Update laravel docs references to 8.x (#2788) 2021-04-16 13:26:15 +01:00
Sami Mazouz
39a6106854
Add unparse to Formatter extender (#2780) 2021-04-14 11:34:49 +01:00
Sami Mazouz
9e3699ea47
Access request actor in error handler (#2410)
* Add an ActorReference class to store the actor `$request->getAttribute('actorReference')->getActor()`
* Add a middleware to inject the actor reference
* Deprecate `$request->getAttribute('actor')`
2021-04-12 18:42:22 +01:00
Alexander Skvortsov
b6f0b01307
Fix relevance sort (#2773)
- Adds a field to QueryCriteria that determines whether the sort provided is the controller's default sort
- Set this field to true iff sort not in query params. Default it to false
- Override $sort if a new default sort has been set on search state, and the param is true.
- Add tests!
2021-04-11 22:21:56 -04:00
Sami Mazouz
548f1321f1
Require unique route names (#2771) 2021-04-10 20:38:25 +01:00
Adam Hosker
b1f166d82a
Remove MyISAM Requirement (#2442)
- Remove Database Engine Default of InnoDB
- Remove Hard Coded MyISAM requirement
2021-04-09 08:13:47 -04:00
Alexander Skvortsov
94d69fe15f
Introduce RequestUtil to encapsulate getting/setting actor on requests(#2449) 2021-04-07 23:33:05 -04:00
Alexander Skvortsov
da598db376
Allow configuring default enabled extensions as part of installation (#2757)
This is needed for the testing library
2021-04-07 22:47:54 -04:00
Alexander Skvortsov
d31e0573f8
Don't fail silently on cache clear (#2756) 2021-04-07 22:13:08 -04:00
Sami Mazouz
2968341f77
Fix a missed getRouteData() (#2774) 2021-04-07 20:08:21 -04:00
Alexander Skvortsov
40dc6d0feb
Preloaded API document Improvements (#2754)
* Invalidate preloadedApiDocument if URL has changed
* Revert to using `getRouteData()[0]`
2021-04-07 23:25:01 +01:00
Daniël Klabbers
0074f0c984
Removes duplication of cache clearing (#2738) 2021-04-07 17:29:32 +01:00
Sami Mazouz
1c4817a0b3
Eager loading extender (#2724)
* Eager loading extender
* Add tests for the eager loading extender
2021-03-25 15:36:39 +01:00
Alexander Skvortsov
706eaeda41
Use anonymous class for FakeApp (#2725)
It's a better implementation than declaring a second class in the same file, which can confuse IDEs. Furthermore, FakeApp shouldn't be used outside this file.
2021-03-22 19:00:36 +01:00
Sami Mazouz
3cc18c1da2
Eager load ListPostsController needed relations (#2717)
* Eager load ListPostsController needed relations
* Add comment explaining the reason for eagerloading
2021-03-22 09:54:18 +01:00
Alexander Skvortsov
8dd57ffed2 Include task scheduler in core 2021-03-19 18:01:38 -04:00
Alexander Skvortsov
d29495203b Move laravel helpers back in, deprecate perpetually 2021-03-19 18:01:38 -04:00
Alexander Skvortsov
908d087e00
Remove deprecated code from beta 16 (#2705) 2021-03-19 19:13:50 +01:00
sl-kr
374189d48e
Refactor AccountActivationMailer and SendConfirmationEmailController (#2493)
* Add AccountActivationMailerTrait and use in AccountActivationMailer and SendConfirmationEmailController
* Remove prefix

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
2021-03-19 18:06:41 +01:00
Alexander Skvortsov
233b97329c
Drop the generate:migration command (#2686)
Core source code should contain things necessary for core to run. Development tooling like this belongs in external packages, like the upcoming Flarum CLI.
2021-03-16 12:41:07 -04:00
Ian Morland
0e6a60bd5b
Canonical URL: use UrlGenerator in place of extracting the url from request (#2674) 2021-03-15 21:43:59 -04:00