Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev discussion count #2

Merged
merged 3 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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