summaryrefslogtreecommitdiffstats
path: root/client/components/users/userAvatar.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/users/userAvatar.js')
-rw-r--r--client/components/users/userAvatar.js27
1 files changed, 8 insertions, 19 deletions
diff --git a/client/components/users/userAvatar.js b/client/components/users/userAvatar.js
index 04add0a6..1e531882 100644
--- a/client/components/users/userAvatar.js
+++ b/client/components/users/userAvatar.js
@@ -22,8 +22,11 @@ Template.userAvatar.helpers({
},
presenceStatusClassName() {
+ const user = Users.findOne(this.userId);
const userPresence = presences.findOne({ userId: this.userId });
- if (!userPresence)
+ if (user && user.isInvitedTo(Session.get('currentBoard')))
+ return 'pending';
+ else if (!userPresence)
return 'disconnected';
else if (Session.equals('currentBoard', userPresence.state.currentBoardId))
return 'active';
@@ -82,11 +85,7 @@ BlazeComponent.extendComponent({
},
setAvatar(avatarUrl) {
- Meteor.users.update(Meteor.userId(), {
- $set: {
- 'profile.avatarUrl': avatarUrl,
- },
- });
+ Meteor.user().setAvatarUrl(avatarUrl);
},
setError(error) {
@@ -151,19 +150,9 @@ Template.cardMembersPopup.helpers({
Template.cardMembersPopup.events({
'click .js-select-member'(evt) {
- const cardId = Template.parentData(2).data._id;
+ const card = Cards.findOne(Session.get('currentCard'));
const memberId = this.userId;
- let operation;
- if (Cards.find({ _id: cardId, members: memberId}).count() === 0)
- operation = '$addToSet';
- else
- operation = '$pull';
-
- Cards.update(cardId, {
- [operation]: {
- members: memberId,
- },
- });
+ card.toggleMember(memberId);
evt.preventDefault();
},
});
@@ -176,7 +165,7 @@ Template.cardMemberPopup.helpers({
Template.cardMemberPopup.events({
'click .js-remove-member'() {
- Cards.update(this.cardId, {$pull: {members: this.userId}});
+ Cards.findOne(this.cardId).unassignMember(this.userId);
Popup.close();
},
'click .js-edit-profile': Popup.open('editProfile'),