Skip to content

Commit 8087f35

Browse files
committed
feat: flarum 2.0 compatibility
1 parent 0df1cb8 commit 8087f35

File tree

8 files changed

+234
-141
lines changed

8 files changed

+234
-141
lines changed

.github/workflows/backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [workflow_dispatch, push, pull_request]
44

55
jobs:
66
run:
7-
uses: flarum/framework/.github/workflows/REUSABLE_backend.yml@main
7+
uses: flarum/framework/.github/workflows/REUSABLE_backend.yml@2.x
88
with:
99
enable_backend_testing: false
1010

.github/workflows/frontend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [workflow_dispatch, push, pull_request]
44

55
jobs:
66
run:
7-
uses: flarum/framework/.github/workflows/REUSABLE_frontend.yml@main
7+
uses: flarum/framework/.github/workflows/REUSABLE_frontend.yml@2.x
88
with:
99
enable_bundlewatch: false
1010
enable_prettier: true

extend.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
use Flectar\Fancybox\WrapImagesInGallery;
1616
use Flectar\Fancybox\DefineGalleryTemplate;
1717
use Flectar\Fancybox\AddExcerptToDiscussion;
18-
use Flarum\Api\Context;
19-
use Flarum\Api\Endpoint;
20-
use Flarum\Api\Resource;
21-
use Flarum\Api\Schema;
18+
use Flarum\Discussion\Discussion;
2219

2320
return [
2421
(new Extend\Frontend('forum'))
@@ -29,10 +26,9 @@
2926
->configure(DefineGalleryTemplate::class)
3027
->configure(AddExcerptToDiscussion::class)
3128
->render(WrapImagesInGallery::class),
32-
33-
// @TODO: Replace with the new implementation https://docs.flarum.org/2.x/extend/api#extending-api-resources
34-
(new Extend\ApiSerializer(\Flarum\Api\Serializer\DiscussionSerializer::class))
35-
->attribute('excerpt', function ($serializer, $discussion) {
29+
30+
(new Extend\Model(Discussion::class))
31+
->attribute('excerpt', function (Discussion $discussion) {
3632
return $discussion->firstPost ? $discussion->firstPost->formatContent() : null;
3733
}),
3834
];

js/dist/forum.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/dist/forum.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)