1
0
mirror of https://github.com/flarum/core.git synced 2025-08-13 11:54:32 +02:00

Compare commits

..

13 Commits

Author SHA1 Message Date
StyleCI Bot
453d272874 Apply fixes from StyleCI 2024-06-16 11:53:11 +00:00
Daniël Klabbers
f04542e8fb feat: adds ability for blueprints to ignore user emai; verification 2024-06-16 13:52:45 +02:00
flarum-bot
64cd6d1988 Bundled output for commit 51bd7a7e32
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2023-05-27 09:37:18 +00:00
Darkle
51bd7a7e32 Update the scheduler info link in admin (#3826) 2023-05-27 11:29:56 +02:00
Sami Mazouz
b6a6248dff chore: prepare v2.0 development
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
2023-05-24 08:52:14 +01:00
Sami Mazouz
5437bf5c23 chore: prepare v1.8.1 release
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
2023-05-23 19:24:51 +01:00
flarum-bot
717af13bb1 Bundled output for commit e72541e35d
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2023-05-22 21:58:15 +00:00
Sami Mazouz
e72541e35d fix: recover temporary solution for html entities in browser title
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
2023-05-22 22:49:20 +01:00
Sami Mazouz
577890d89c fix: custom contrast color affected by parents
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
2023-05-22 22:23:11 +01:00
Sami Mazouz
253a3d281d fix: reply placeholder wrong positioning
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
2023-05-22 21:58:38 +01:00
flarum-bot
d27f952584 Bundled output for commit e5abffc75b
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2023-05-20 16:46:42 +00:00
Sami Mazouz
e5abffc75b chore: v1.8 preparations
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
2023-05-20 16:08:42 +01:00
Sami Mazouz
d1059c1cc7 fix: improve avatar upload functionality
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
2023-05-20 15:15:53 +01:00
63 changed files with 236 additions and 158 deletions

View File

@@ -1,5 +1,55 @@
# Changelog
## [v1.8.1](https://github.com/flarum/framework/compare/v1.8.0...v1.8.1)
### Fixed
* recover temporary solution for html entities in browser title (e72541e35de4f71f9d870bbd9bb46ddf586bdf1d)
* custom contrast color affected by parents (577890d89c593ae5b6cb96083fab69e2f1ae600c)
* reply placeholder wrong positioning (253a3d281dbf5ce3fa712b629b80587cf67e7dbe)
## [v1.8.0](https://github.com/flarum/framework/compare/v1.7.1...v1.8.0)
### Fixed
- (a11y) reply placeholder not accessible [#3793]
- (bbcode) highlight.js does not work after changing post content [#3817]
- (bbcode) localize quote `wrote` string [#3809]
- (mentions) mentions XHR fired even after mentioning is done [#3806]
- (package-manager) available core updates cause an error in the dashboard ([fab71f2](fab71f2d01fa20ce9b3002833339dc5ea3ea6301))
- (tags) not all tags are loaded in the permission grid [#3804]
- (tags) tag discussion modal filters with exact matches only after first index [#3786]
- (testing) always clear cache in integration test's tearDown [#3818]
- `UserSecurityPage` not exported ([232618a](232618aba604ab003425df38b895208c863d3260))
- `isDark()` utility can receive null value [#3774]
- approving a post does not bump user `comment_count` [#3790]
- circular dependencies disable all involved extensions [#3785]
- color input overflowing the input box [#3796]
- deleting a discussion from the profile does not visually remove it [#3799]
- discussion page showing horizontal scroll on iOS [#3821]
- empty string displayed as SelectDropdown title [#3773]
- filter values are not validated [#3795]
- infinite scroll not initialized for notifications on big screens [#3733]
- notification subject discussion eager loading fails [#3788]
- null as 2nd param in `preg_match` is deprecated [#3801]
- unread count in post stream not visible [#3791]
- unreadable badge icon on certain colors [#3810]
- integrity constraint violation [#3772]
### Changed
- (core,mentions) limit `mentionedBy` post relation results [#3780]
- (likes) limit `likes` relationship results [#3781]
- Change some methods from private to protected, to be able to extend the affected classes [#3802]
- Do not catch exceptions when testing Console commands [#3813]
- drop usage of jquery in `install` and `update` interfaces [#3797]
- extensibility improvements [#3729]
- major frontend JS cleanup [#3609]
- revert ineffective code for encoding of page title [#3768]
- speed up post creation time [#3808]
### Added
- (mentions,tags) tag mentions [#3769]
- add delete own posts permission [#3784]
- add a trait to flush the formatter cache in tests [#3811]
- add user creation to users list page [#3744]
- cli command for enabling or disabling an extension [#3816]
- conditional extenders [#3759]
- provide old content to `Revised` event [#3789]
## [v1.7.1](https://github.com/flarum/framework/compare/v1.7.0...v1.7.1)
### Fixed
- (tags) composer tag selection modal using wrong primary max & min numbers (abc9670659426b765274376945b818b70d84848c)

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7",
"flarum/core": "^1.8",
"flarum/approval": "^1.7"
},
"autoload": {

View File

@@ -50,7 +50,7 @@ class Akismet
$client = new Client();
return $client->request('POST', "$this->apiUrl/$type", [
'headers' => [
'headers' => [
'User-Agent' => "Flarum/$this->flarumVersion | Akismet/$this->extensionVersion",
],
'form_params' => $this->params,

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7",
"flarum/core": "^1.8",
"flarum/flags": "^1.7"
},
"autoload": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"extra": {
"branch-alias": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -40,6 +40,7 @@ class AddCanFlagAttribute
// If $actor is the post author, check to see if the setting is enabled
return (bool) $this->settings->get('flarum-flags.can_flag_own');
}
// $actor is not the post author
return true;
}

View File

@@ -31,10 +31,10 @@ class FlagSerializer extends AbstractSerializer
}
return [
'type' => $flag->type,
'reason' => $flag->reason,
'type' => $flag->type,
'reason' => $flag->reason,
'reasonDetail' => $flag->reason_detail,
'createdAt' => $this->formatDate($flag->created_at),
'createdAt' => $this->formatDate($flag->created_at),
];
}

View File

@@ -7,7 +7,7 @@
],
"license": "MIT",
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"extra": {
"branch-alias": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"extra": {
"branch-alias": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -22,7 +22,7 @@
"source": "https://github.com/flarum/package-manager"
},
"require": {
"flarum/core": "^1.5.0",
"flarum/core": "^1.8",
"composer/composer": "^2.3"
},
"require-dev": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7",
"flarum/core": "^1.8",
"pusher/pusher-php-server": "^2.2"
},
"require-dev": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.7"
"flarum/core": "^1.8"
},
"autoload": {
"psr-4": {

View File

@@ -47,19 +47,19 @@ class TagSerializer extends AbstractSerializer
}
$attributes = [
'name' => $tag->name,
'description' => $tag->description,
'slug' => $this->slugManager->forResource(Tag::class)->toSlug($tag),
'color' => $tag->color,
'backgroundUrl' => $tag->background_path,
'backgroundMode' => $tag->background_mode,
'icon' => $tag->icon,
'discussionCount' => (int) $tag->discussion_count,
'position' => $tag->position === null ? null : (int) $tag->position,
'defaultSort' => $tag->default_sort,
'isChild' => (bool) $tag->parent_id,
'isHidden' => (bool) $tag->is_hidden,
'lastPostedAt' => $this->formatDate($tag->last_posted_at),
'name' => $tag->name,
'description' => $tag->description,
'slug' => $this->slugManager->forResource(Tag::class)->toSlug($tag),
'color' => $tag->color,
'backgroundUrl' => $tag->background_path,
'backgroundMode' => $tag->background_mode,
'icon' => $tag->icon,
'discussionCount' => (int) $tag->discussion_count,
'position' => $tag->position === null ? null : (int) $tag->position,
'defaultSort' => $tag->default_sort,
'isChild' => (bool) $tag->parent_id,
'isHidden' => (bool) $tag->is_hidden,
'lastPostedAt' => $this->formatDate($tag->last_posted_at),
'canStartDiscussion' => $this->actor->can('startDiscussion', $tag),
'canAddToDiscussion' => $this->actor->can('addToDiscussion', $tag)
];

View File

@@ -27,7 +27,7 @@ trait RetrievesRepresentativeTags
['id' => 11, 'name' => 'Secondary Restricted', 'slug' => 'secondary-restricted', 'position' => null, 'parent_id' => null, 'is_restricted' => true],
['id' => 12, 'name' => 'Primary Restricted 2', 'slug' => 'primary-2-restricted', 'position' => 100, 'parent_id' => null, 'is_restricted' => true],
['id' => 13, 'name' => 'Primary Restricted 2 Child 1', 'slug' => 'primary-2-restricted-child-1', 'position' => 101, 'parent_id' => 12],
['id' => 14, 'name' => 'Primary Restricted 3', 'slug' => 'primary-3-restricted', 'position' => 102, 'parent_id' =>null, 'is_restricted' => true],
['id' => 14, 'name' => 'Primary Restricted 3', 'slug' => 'primary-3-restricted', 'position' => 102, 'parent_id' => null, 'is_restricted' => true],
];
}
}

View File

@@ -1 +1 @@
export default function textContrastClass(hexcolor: string | null): string;
export default function textContrastClass(hexcolor: string | null | undefined): string;

View File

@@ -72,7 +72,7 @@ export default class AvatarEditor extends Component<import("../../common/Compone
remove(): void;
/**
* After a successful upload/removal, push the updated user data into the
* store, and force a recomputation of the user's avatar color.
* store, and force a re-computation of the user's avatar color.
*
* @param {object} response
* @protected

2
framework/core/js/dist/admin.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
framework/core/js/dist/forum.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -40,7 +40,7 @@ export default class StatusWidget extends DashboardWidget {
[
<span>
<strong>{app.translator.trans('core.admin.dashboard.status.headers.scheduler-status')}</strong>{' '}
<LinkButton href="https://discuss.flarum.org/d/24118" external={true} target="_blank" icon="fas fa-info-circle" />
<LinkButton href="https://docs.flarum.org/scheduler" external={true} target="_blank" icon="fas fa-info-circle" />
</span>,
<br />,
app.data.schedulerStatus,

View File

@@ -411,12 +411,23 @@ export default class Application {
pageNumber: 1,
};
const title =
let title =
onHomepage || !this.title
? extractText(app.translator.trans('core.lib.meta_titles.without_page_title', params))
: extractText(app.translator.trans('core.lib.meta_titles.with_page_title', params));
document.title = count + title;
title = count + title;
// We pass the title through a DOMParser to allow HTML entities
// to be rendered correctly, while still preventing XSS attacks
// from user input by using a script-disabled environment.
// https://github.com/flarum/framework/issues/3514
// https://github.com/flarum/framework/pull/3684
// This is only a temporary solution for 1.x,
// and the actual source of the issue will be fixed in 2.x
// Actual source of the issue: https://github.com/flarum/framework/issues/3685
const parser = new DOMParser();
document.title = parser.parseFromString(title, 'text/html').body.innerText;
}
protected transformRequestOptions<ResponseType>(flarumOptions: FlarumRequestOptions<ResponseType>): InternalFlarumRequestOptions<ResponseType> {

View File

@@ -28,7 +28,7 @@ export default class Badge<CustomAttrs extends IBadgeAttrs = IBadgeAttrs> extend
view() {
const { type, icon: iconName, label, color, style = {}, ...attrs } = this.attrs;
const className = classList('Badge', [type && `Badge--${type}`], attrs.className, color && textContrastClass(color));
const className = classList('Badge', [type && `Badge--${type}`], attrs.className, textContrastClass(color));
const iconChild = iconName ? icon(iconName, { className: 'Badge-icon' }) : m.trust('&nbsp;');

View File

@@ -1,5 +1,7 @@
import isDark from '../utils/isDark';
export default function textContrastClass(hexcolor: string | null): string {
export default function textContrastClass(hexcolor: string | null | undefined): string {
if (!hexcolor) return 'text-contrast--unchanged';
return isDark(hexcolor) ? 'text-contrast--light' : 'text-contrast--dark';
}

View File

@@ -204,7 +204,7 @@ export default class AvatarEditor extends Component {
/**
* After a successful upload/removal, push the updated user data into the
* store, and force a recomputation of the user's avatar color.
* store, and force a re-computation of the user's avatar color.
*
* @param {object} response
* @protected

View File

@@ -176,4 +176,10 @@ blockquote ol:last-child {
--contrast-color: var(--text-on-dark);
color: var(--contrast-color);
}
// This exists to prevent inheriting the contrast color from a parent element.
// Like when a badge is inside a tag hero.
&--unchanged {
--contrast-color: var(--unchanged-color);
}
}

View File

@@ -441,7 +441,7 @@
color: var(--muted-color);
border-radius: 10px;
background-color: transparent;
width: 100%;
width: calc(~"100% + 20px * 2");
display: flex;
.Post-header {

View File

@@ -62,7 +62,7 @@ class UploadFaviconController extends UploadImageController
]);
}
$encodedImage = $this->imageManager->make($file->getStream())->resize(64, 64, function ($constraint) {
$encodedImage = $this->imageManager->make($file->getStream()->getMetadata('uri'))->resize(64, 64, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
})->encode('png');

View File

@@ -38,7 +38,7 @@ class UploadLogoController extends UploadImageController
*/
protected function makeImage(UploadedFileInterface $file): Image
{
$encodedImage = $this->imageManager->make($file->getStream())->heighten(60, function ($constraint) {
$encodedImage = $this->imageManager->make($file->getStream()->getMetadata('uri'))->heighten(60, function ($constraint) {
$constraint->upsize();
})->encode('png');

View File

@@ -46,7 +46,7 @@ class BasicDiscussionSerializer extends AbstractSerializer
return [
'title' => $discussion->title,
'slug' => $this->slugManager->forResource(Discussion::class)->toSlug($discussion),
'slug' => $this->slugManager->forResource(Discussion::class)->toSlug($discussion),
];
}

View File

@@ -53,8 +53,8 @@ class BasicPostSerializer extends AbstractSerializer
}
$attributes = [
'number' => (int) $post->number,
'createdAt' => $this->formatDate($post->created_at),
'number' => (int) $post->number,
'createdAt' => $this->formatDate($post->created_at),
'contentType' => $post->type
];

View File

@@ -45,10 +45,10 @@ class BasicUserSerializer extends AbstractSerializer
}
return [
'username' => $user->username,
'username' => $user->username,
'displayName' => $user->display_name,
'avatarUrl' => $user->avatar_url,
'slug' => $this->slugManager->forResource(User::class)->toSlug($user)
'avatarUrl' => $user->avatar_url,
'slug' => $this->slugManager->forResource(User::class)->toSlug($user)
];
}

View File

@@ -20,13 +20,13 @@ class CurrentUserSerializer extends UserSerializer
$attributes = parent::getDefaultAttributes($user);
$attributes += [
'isEmailConfirmed' => (bool) $user->is_email_confirmed,
'email' => $user->email,
'markedAllAsReadAt' => $this->formatDate($user->marked_all_as_read_at),
'unreadNotificationCount' => (int) $user->getUnreadNotificationCount(),
'newNotificationCount' => (int) $user->getNewNotificationCount(),
'preferences' => (array) $user->preferences,
'isAdmin' => $user->isAdmin(),
'isEmailConfirmed' => (bool) $user->is_email_confirmed,
'email' => $user->email,
'markedAllAsReadAt' => $this->formatDate($user->marked_all_as_read_at),
'unreadNotificationCount' => (int) $user->getUnreadNotificationCount(),
'newNotificationCount' => (int) $user->getNewNotificationCount(),
'preferences' => (array) $user->preferences,
'isAdmin' => $user->isAdmin(),
];
return $attributes;

View File

@@ -19,15 +19,15 @@ class DiscussionSerializer extends BasicDiscussionSerializer
protected function getDefaultAttributes($discussion)
{
$attributes = parent::getDefaultAttributes($discussion) + [
'commentCount' => (int) $discussion->comment_count,
'participantCount' => (int) $discussion->participant_count,
'createdAt' => $this->formatDate($discussion->created_at),
'lastPostedAt' => $this->formatDate($discussion->last_posted_at),
'lastPostNumber' => (int) $discussion->last_post_number,
'canReply' => $this->actor->can('reply', $discussion),
'canRename' => $this->actor->can('rename', $discussion),
'canDelete' => $this->actor->can('delete', $discussion),
'canHide' => $this->actor->can('hide', $discussion)
'commentCount' => (int) $discussion->comment_count,
'participantCount' => (int) $discussion->participant_count,
'createdAt' => $this->formatDate($discussion->created_at),
'lastPostedAt' => $this->formatDate($discussion->last_posted_at),
'lastPostNumber' => (int) $discussion->last_post_number,
'canReply' => $this->actor->can('reply', $discussion),
'canRename' => $this->actor->can('rename', $discussion),
'canDelete' => $this->actor->can('delete', $discussion),
'canHide' => $this->actor->can('hide', $discussion)
];
if ($discussion->hidden_at) {

View File

@@ -89,7 +89,7 @@ class ForumSerializer extends AbstractSerializer
'headerHtml' => $this->settings->get('custom_header'),
'footerHtml' => $this->settings->get('custom_footer'),
'allowSignUp' => (bool) $this->settings->get('allow_sign_up'),
'defaultRoute' => $this->settings->get('default_route'),
'defaultRoute' => $this->settings->get('default_route'),
'canViewForum' => $this->actor->can('viewForum'),
'canStartDiscussion' => $this->actor->can('startDiscussion'),
'canSearchUsers' => $this->actor->can('searchUsers'),

View File

@@ -49,10 +49,10 @@ class GroupSerializer extends AbstractSerializer
return [
'nameSingular' => $this->translateGroupName($group->name_singular),
'namePlural' => $this->translateGroupName($group->name_plural),
'color' => $group->color,
'icon' => $group->icon,
'isHidden' => $group->is_hidden
'namePlural' => $this->translateGroupName($group->name_plural),
'color' => $group->color,
'icon' => $group->icon,
'isHidden' => $group->is_hidden
];
}

View File

@@ -43,9 +43,9 @@ class NotificationSerializer extends AbstractSerializer
return [
'contentType' => $notification->type,
'content' => $notification->data,
'createdAt' => $this->formatDate($notification->created_at),
'isRead' => (bool) $notification->read_at
'content' => $notification->data,
'createdAt' => $this->formatDate($notification->created_at),
'isRead' => (bool) $notification->read_at
];
}

View File

@@ -45,9 +45,9 @@ class PostSerializer extends BasicPostSerializer
}
$attributes += [
'canEdit' => $canEdit,
'canEdit' => $canEdit,
'canDelete' => $this->actor->can('delete', $post),
'canHide' => $this->actor->can('hide', $post)
'canHide' => $this->actor->can('hide', $post)
];
return $attributes;

View File

@@ -20,13 +20,13 @@ class UserSerializer extends BasicUserSerializer
$attributes = parent::getDefaultAttributes($user);
$attributes += [
'joinTime' => $this->formatDate($user->joined_at),
'discussionCount' => (int) $user->discussion_count,
'commentCount' => (int) $user->comment_count,
'canEdit' => $this->actor->can('edit', $user),
'joinTime' => $this->formatDate($user->joined_at),
'discussionCount' => (int) $user->discussion_count,
'commentCount' => (int) $user->comment_count,
'canEdit' => $this->actor->can('edit', $user),
'canEditCredentials' => $this->actor->can('editCredentials', $user),
'canEditGroups' => $this->actor->can('editGroups', $user),
'canDelete' => $this->actor->can('delete', $user),
'canEditGroups' => $this->actor->can('editGroups', $user),
'canDelete' => $this->actor->can('delete', $user),
];
if ($user->getPreference('discloseOnline') || $this->actor->can('viewLastSeenAt', $user)) {
@@ -38,7 +38,7 @@ class UserSerializer extends BasicUserSerializer
if ($attributes['canEditCredentials'] || $this->actor->id === $user->id) {
$attributes += [
'isEmailConfirmed' => (bool) $user->is_email_confirmed,
'email' => $user->email
'email' => $user->email
];
}

View File

@@ -510,15 +510,15 @@ class Extension implements Arrayable
public function toArray()
{
return (array) array_merge([
'id' => $this->getId(),
'version' => $this->getVersion(),
'path' => $this->getPath(),
'icon' => $this->getIcon(),
'hasAssets' => $this->hasAssets(),
'hasMigrations' => $this->hasMigrations(),
'id' => $this->getId(),
'version' => $this->getVersion(),
'path' => $this->getPath(),
'icon' => $this->getIcon(),
'hasAssets' => $this->hasAssets(),
'hasMigrations' => $this->hasMigrations(),
'extensionDependencyIds' => $this->getExtensionDependencyIds(),
'optionalDependencyIds' => $this->getOptionalDependencyIds(),
'links' => $this->getLinks(),
'optionalDependencyIds' => $this->getOptionalDependencyIds(),
'links' => $this->getLinks(),
], $this->composerJson);
}

View File

@@ -36,14 +36,14 @@ class FilesystemServiceProvider extends AbstractServiceProvider
return [
'flarum-assets' => function (Paths $paths, UrlGenerator $url) {
return [
'root' => "$paths->public/assets",
'url' => $url->to('forum')->path('assets')
'root' => "$paths->public/assets",
'url' => $url->to('forum')->path('assets')
];
},
'flarum-avatars' => function (Paths $paths, UrlGenerator $url) {
return [
'root' => "$paths->public/assets/avatars",
'url' => $url->to('forum')->path('assets/avatars')
'root' => "$paths->public/assets/avatars",
'url' => $url->to('forum')->path('assets/avatars')
];
},
];

View File

@@ -21,7 +21,7 @@ class Application
*
* @var string
*/
const VERSION = '1.8.0-dev';
const VERSION = '2.0-dev';
/**
* The IoC container for the Flarum application.
@@ -336,22 +336,22 @@ class Application
public function registerCoreContainerAliases()
{
$aliases = [
'app' => [\Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class],
'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class],
'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class],
'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class],
'db' => [\Illuminate\Database\DatabaseManager::class],
'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class],
'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class],
'files' => [\Illuminate\Filesystem\Filesystem::class],
'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class],
'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class],
'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class],
'hash' => [\Illuminate\Contracts\Hashing\Hasher::class],
'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class],
'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class],
'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class],
'app' => [\Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class],
'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class],
'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class],
'config' => [\Illuminate\Config\Repository::class, \Illuminate\Contracts\Config\Repository::class],
'db' => [\Illuminate\Database\DatabaseManager::class],
'db.connection' => [\Illuminate\Database\Connection::class, \Illuminate\Database\ConnectionInterface::class],
'events' => [\Illuminate\Events\Dispatcher::class, \Illuminate\Contracts\Events\Dispatcher::class],
'files' => [\Illuminate\Filesystem\Filesystem::class],
'filesystem' => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class],
'filesystem.disk' => [\Illuminate\Contracts\Filesystem\Filesystem::class],
'filesystem.cloud' => [\Illuminate\Contracts\Filesystem\Cloud::class],
'hash' => [\Illuminate\Contracts\Hashing\Hasher::class],
'mailer' => [\Illuminate\Mail\Mailer::class, \Illuminate\Contracts\Mail\Mailer::class, \Illuminate\Contracts\Mail\MailQueue::class],
'validator' => [\Illuminate\Validation\Factory::class, \Illuminate\Contracts\Validation\Factory::class],
'view' => [\Illuminate\View\Factory::class, \Illuminate\Contracts\View\Factory::class],
];
foreach ($aliases as $key => $aliases) {

View File

@@ -136,19 +136,19 @@ class FrontendServiceProvider extends AbstractServiceProvider
$this->container->singleton('flarum.less.config', function (Container $container) {
return [
'config-primary-color' => [
'config-primary-color' => [
'key' => 'theme_primary_color',
],
'config-secondary-color' => [
'key' => 'theme_secondary_color',
],
'config-dark-mode' => [
'config-dark-mode' => [
'key' => 'theme_dark_mode',
'callback' => function ($value) {
return $value ? 'true' : 'false';
},
],
'config-colored-header' => [
'config-colored-header' => [
'key' => 'theme_colored_header',
'callback' => function ($value) {
return $value ? 'true' : 'false';

View File

@@ -37,17 +37,17 @@ class DatabaseConfig implements Arrayable
public function toArray()
{
return [
'driver' => $this->driver,
'host' => $this->host,
'port' => $this->port,
'database' => $this->database,
'username' => $this->username,
'password' => $this->password,
'charset' => 'utf8mb4',
'driver' => $this->driver,
'host' => $this->host,
'port' => $this->port,
'database' => $this->database,
'username' => $this->username,
'password' => $this->password,
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => $this->prefix,
'strict' => false,
'engine' => 'InnoDB',
'prefix' => $this->prefix,
'strict' => false,
'engine' => 'InnoDB',
'prefix_indexes' => true
];
}

View File

@@ -53,12 +53,12 @@ class StoreConfig implements ReversibleStep
private function buildConfig()
{
return [
'debug' => $this->debugMode,
'debug' => $this->debugMode,
'database' => $this->dbConfig->toArray(),
'url' => (string) $this->baseUrl,
'paths' => $this->getPathsConfig(),
'headers' => [
'poweredByHeader' => true,
'url' => (string) $this->baseUrl,
'paths' => $this->getPathsConfig(),
'headers' => [
'poweredByHeader' => true,
'referrerPolicy' => 'same-origin',
]
];
@@ -67,7 +67,7 @@ class StoreConfig implements ReversibleStep
private function getPathsConfig()
{
return [
'api' => 'api',
'api' => 'api',
'admin' => 'admin',
];
}

View File

@@ -24,33 +24,40 @@ interface BlueprintInterface
*
* @return User|null
*/
public function getFromUser();
public function getFromUser(): ?User;
/**
* Get the model that is the subject of this activity.
*
* @return AbstractModel|null
*/
public function getSubject();
public function getSubject(): ?AbstractModel;
/**
* Get the data to be stored in the notification.
*
* @return mixed
*/
public function getData();
public function getData(): mixed;
/**
* Get the serialized type of this activity.
*
* @return string
*/
public static function getType();
public static function getType(): string;
/**
* Get the name of the model class for the subject of this activity.
*
* @return string
*/
public static function getSubjectModel();
public static function getSubjectModel(): string;
/**
* Whether the blueprint ignores that a user has not verified their email address.
*
* @return bool
*/
public function ignoresUserVerification(): bool;
}

View File

@@ -87,7 +87,7 @@ class AvatarValidator extends AbstractValidator
}
try {
$this->imageManager->make($file->getStream());
$this->imageManager->make($file->getStream()->getMetadata('uri'));
} catch (NotReadableException $_e) {
$this->raise('image');
}

View File

@@ -74,7 +74,7 @@ class UploadAvatarHandler
$this->validator->assertValid(['avatar' => $command->file]);
$image = $this->imageManager->make($command->file->getStream());
$image = $this->imageManager->make($command->file->getStream()->getMetadata('uri'));
$this->events->dispatch(
new AvatarSaving($user, $actor, $image)

View File

@@ -186,7 +186,7 @@ class CreateTest extends TestCase
'username' => 'test',
'email' => 'test@machine.local',
'is_email_confirmed' => 1,
'avatar_url' => 'file://localhost/etc/passwd'
'avatar_url' => 'file://localhost/etc/passwd'
], []),
'scheme' => 'file'
];
@@ -251,28 +251,28 @@ class CreateTest extends TestCase
'username' => 'test',
'email' => 'test@machine.local',
'is_email_confirmed' => 1,
'avatar_url' => 'https://127.0.0.1/image.png'
'avatar_url' => 'https://127.0.0.1/image.png'
], []);
$regTokens[] = RegistrationToken::generate('flarum', '1', [
'username' => 'test',
'email' => 'test@machine.local',
'is_email_confirmed' => 1,
'avatar_url' => 'https://192.168.0.1/image.png'
'avatar_url' => 'https://192.168.0.1/image.png'
], []);
$regTokens[] = RegistrationToken::generate('flarum', '1', [
'username' => 'test',
'email' => 'test@machine.local',
'is_email_confirmed' => 1,
'avatar_url' => '../image.png'
'avatar_url' => '../image.png'
], []);
$regTokens[] = RegistrationToken::generate('flarum', '1', [
'username' => 'test',
'email' => 'test@machine.local',
'is_email_confirmed' => 1,
'avatar_url' => 'image.png'
'avatar_url' => 'image.png'
], []);
// Test each reg token
@@ -325,28 +325,28 @@ class CreateTest extends TestCase
'username' => 'test1',
'email' => 'test1@machine.local',
'is_email_confirmed' => 1,
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png'
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png'
], []);
$regTokens[] = RegistrationToken::generate('flarum', '2', [
'username' => 'test2',
'email' => 'test2@machine.local',
'is_email_confirmed' => 1,
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.jpg'
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.jpg'
], []);
$regTokens[] = RegistrationToken::generate('flarum', '3', [
'username' => 'test3',
'email' => 'test3@machine.local',
'is_email_confirmed' => 1,
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.gif'
'avatar_url' => 'https://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.gif'
], []);
$regTokens[] = RegistrationToken::generate('flarum', '4', [
'username' => 'test4',
'email' => 'test4@machine.local',
'is_email_confirmed' => 1,
'avatar_url' => 'http://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png'
'avatar_url' => 'http://raw.githubusercontent.com/flarum/framework/main/framework/core/tests/fixtures/assets/avatar.png'
], []);
/**

View File

@@ -45,7 +45,7 @@ class FilesystemTest extends TestCase
$this->extend((new Extend\Filesystem)->disk('flarum-uploads', function (Paths $paths, UrlGenerator $url) {
return [
'root' => "$paths->public/assets/uploads",
'url' => $url->to('forum')->path('assets/uploads')
'url' => $url->to('forum')->path('assets/uploads')
];
}));
@@ -137,7 +137,7 @@ class UploadsDisk
{
return [
'root' => "$paths->public/assets/uploads",
'url' => $url->to('forum')->path('assets/uploads')
'url' => $url->to('forum')->path('assets/uploads')
];
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "flarum-webpack-config",
"version": "2.0.1",
"version": "2.0.2",
"description": "Webpack config for Flarum JS and TS transpilation.",
"main": "index.js",
"author": "Flarum Team",

View File

@@ -192,6 +192,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
protected function database(): ConnectionInterface
{
$this->app();
// Set in `BeginTransactionAndSetDatabase` extender.
return $this->database;
}