mattfeldman/nullchat

View on GitHub
client/views/popups/user/user-profile-card-content.es6.js

Summary

Maintainability
B
4 hrs
Test Coverage
Template.userProfileCardContent.events({
    'click .direct-message'(event, template) {
        const authorId = template.data;
        if (!authorId || authorId === Meteor.userId()) return;
        Meteor.call('getDirectMessageRoom', authorId, (err, data) => {
            if (!err && data && !Session.equals('currentRoom', data)) {
                Client.setCurrentRoom(data);
            }
        });
    }
});
Template.userProfileCardContent.helpers({
    shouldShowMessageButton() {
        return !!this && this.toString() !== Meteor.userId();
    }
});