Skip to content

Commit

Permalink
Merge pull request #2 from zxy19/dev_discussion_count
Browse files Browse the repository at this point in the history
Dev discussion count
  • Loading branch information
nodeloc authored Oct 1, 2024
2 parents 2b33410 + c9430b6 commit a658181
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 35 deletions.
27 changes: 19 additions & 8 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@
namespace Nodeloc\LeaderBoard;

use Flarum\Api\Serializer\ForumSerializer;
use Flarum\Extend;
use Flarum\Api\Serializer\UserSerializer;
use Flarum\Extend;
use Flarum\Post\Event\Posted;
use Flarum\Discussion\Event\Started;
use Flarum\Post\Event\Deleted as PostDeleted;
use Flarum\Discussion\Event\Deleted as DiscussionDeleted;
use Flarum\Api\Controller\ListUsersController;
use Flarum\User\Filter\UserFilterer;
use Illuminate\Database\Eloquent\Builder;
use Nodeloc\LeaderBoard\Listeners\DateChange;
use Xypp\LocalizeDate\Event\DateChangeEvent;

return [
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js'),
->js(__DIR__ . '/js/dist/admin.js'),

(new Extend\Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js')
->css(__DIR__.'/resources/less/forum.less')
->js(__DIR__ . '/js/dist/forum.js')
->css(__DIR__ . '/resources/less/forum.less')
->route('/leaderboard', 'nodeloc_leaderboard', Content\LeaderBoard::class),

new Extend\Locales(__DIR__.'/resources/locale'),
new Extend\Locales(__DIR__ . '/resources/locale'),

(new Extend\ApiSerializer(ForumSerializer::class))
->attributes(PermissionBasedForumSettings::class),
Expand All @@ -33,17 +36,25 @@
->listen(Posted::class, [Listeners\UpdateCount::class, 'postWasPosted'])
->listen(Started::class, [Listeners\UpdateCount::class, 'discussionWasStarted'])
->listen(PostDeleted::class, [Listeners\UpdateCount::class, 'postWasDeleted'])
->listen(DiscussionDeleted::class, [Listeners\UpdateCount::class, 'discussionWasDeleted']),
->listen(DiscussionDeleted::class, [Listeners\UpdateCount::class, 'discussionWasDeleted'])
->listen(DateChangeEvent::class, DateChange::class),
(new Extend\View())
->namespace('nodeloc.leaderboard', __DIR__.'/resources/views'),
->namespace('nodeloc.leaderboard', __DIR__ . '/resources/views'),
(new Extend\ApiController(ListUsersController::class))
->addSortField('money')
->addSortField('lotteryCount')
->addSortField('bestAnswerCount')
->addSortField('lastCheckinMoney')
->addSortField('monthlyDiscussionCount')
->addSortField('monthlyCommentCount'),
->addSortField('monthlyCommentCount')
->addSortField('lastMonthlyDiscussionCount')
->addSortField('lastMonthlyCommentCount'),
(new Extend\Settings())
->default('nodeloc-leaderboard.admin.settings.link', false)
->default('nodeloc-leaderboard.default-sort', 'default'),

(new Extend\Middleware('api'))
->add(Middleware\BeforeMiddleware::class),
(new Extend\Filter(UserFilterer::class))
->addFilterMutator(Filter\CheckDateFilter::class),
];
2 changes: 1 addition & 1 deletion js/dist/admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/dist/admin.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a658181

Please sign in to comment.