-
Notifications
You must be signed in to change notification settings - Fork 6
/
azeirah:friendHelpers.js
55 lines (52 loc) · 1.5 KB
/
azeirah:friendHelpers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Template.registerHelper('areFriends', function (friendId) {
if (validations.hasFriend(Meteor.userId(), friendId)) {
return validations.validateUserRelations({
userId: Meteor.userId(),
status: STATUSES.friend
}, {
userId: friendId,
status: STATUSES.friend
});
} else {
return false;
}
});
Template.registerHelper('friendRequest', function (friendId) {
if (validations.hasFriend(Meteor.userId(), friendId)) {
return validations.validateUserRelations({
userId: Meteor.userId(),
status: STATUSES.request
}, {
userId: friendId,
status: STATUSES.pending
});
} else {
return false;
}
});
Template.registerHelper('friendPending', function (friendId) {
if (validations.hasFriend(Meteor.userId(), friendId)) {
return validations.validateUserRelations({
userId: Meteor.userId(),
status: STATUSES.pending
}, {
userId: friendId,
status: STATUSES.request
});
} else {
return false;
}
});
Template.registerHelper('wereFriends', function (friendId) {
if (validations.hasFriend(Meteor.userId(), friendId)) {
return validations.validateUserRelations({
userId: Meteor.userId(),
status: STATUSES.request
}, {
userId: friendId,
status: STATUSES.pending
});
} else {
return false;
}
});