MaazAli/phanime

View on GitHub
lib/routes/user/userFollowing.js

Summary

Maintainability
D
1 day
Test Coverage
UserFollowingController = RouteController.extend({

    onAfterAction: function () {
        if (this.ready()) {
            var user = this.data();

            SEO.set({
                title: siteSettings.getFullTitle(user.displayName() + "'s Followees"),
                meta: {
                    'description' : (user.profile) ? user.profile.about : ''
                },
                og: {
                    'title' : siteSettings.getFullTitle(user.displayName() + "'s Library"),
                    'description' : (user.profile) ? user.profile.about : '',
                    'type' : 'profile',
                    'image' : user.avatarImageUrl(),
                }
            });
        }
    },

    waitOn: function () {
        return Meteor.subscribe('userWithFollowing', this.params.username.toLowerCase());
    },

    data: function () {
        var user = Meteor.users.findOne({username: this.params.username.toLowerCase()});
        
        if (this.ready()) {
            
            if (user.following)
                user.followingFull = Meteor.users.find({_id: {$in: user.following}});

        }

        return user;
    }

});