framework/js/forum/src/initializers/components.js
Toby Zerner 3c7078b423 New user activity feed API.
Originally the user activity feed was implemented using UNIONs. I was
looking at make an API to add activity “sources”, or extra UNION
queries (select from posts, mentions, etc.) but quickly realised that
this is too slow and there’s no way to make it scale.

So I’ve implemented an API which is very similar to how notifications
work (see previous commit). The `activity` table is an aggregation of
stuff that happens, and it’s kept in sync by an ActivitySyncer which is
used whenever a post it created/edited/deleted, a user is
mentioned/unmentioned, etc.

Again, the API is very simple (see Core\Activity\PostedActivity +
Core\Handlers\Events\UserActivitySyncer)
2015-05-20 12:30:27 +09:30

23 lines
749 B
JavaScript

import CommentPost from 'flarum/components/comment-post';
import DiscussionRenamedPost from 'flarum/components/discussion-renamed-post';
import PostedActivity from 'flarum/components/posted-activity';
import JoinedActivity from 'flarum/components/joined-activity';
import DiscussionRenamedNotification from 'flarum/components/discussion-renamed-notification';
export default function(app) {
app.postComponentRegistry = {
'comment': CommentPost,
'discussionRenamed': DiscussionRenamedPost
};
app.activityComponentRegistry = {
'posted': PostedActivity,
'startedDiscussion': PostedActivity,
'joined': JoinedActivity
};
app.notificationComponentRegistry = {
'discussionRenamed': DiscussionRenamedNotification
};
}