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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
<script>
import { mapState } from 'vuex';
import { MEMBER_TYPES } from '../../constants';
import {
isGroup,
isDirectMember,
isCurrentUser,
canRemove,
canResend,
canUpdate,
} from '../../utils';
export default {
name: 'MembersTableCell',
props: {
member: {
type: Object,
required: true,
},
},
computed: {
...mapState(['currentUserId']),
isGroup() {
return isGroup(this.member);
},
isInvite() {
return Boolean(this.member.invite);
},
isAccessRequest() {
return Boolean(this.member.requestedAt);
},
memberType() {
if (this.isGroup) {
return MEMBER_TYPES.group;
} else if (this.isInvite) {
return MEMBER_TYPES.invite;
} else if (this.isAccessRequest) {
return MEMBER_TYPES.accessRequest;
}
return MEMBER_TYPES.user;
},
isDirectMember() {
return isDirectMember(this.member);
},
isCurrentUser() {
return isCurrentUser(this.member, this.currentUserId);
},
canRemove() {
return canRemove(this.member);
},
canResend() {
return canResend(this.member);
},
canUpdate() {
return canUpdate(this.member, this.currentUserId);
},
},
render() {
return this.$scopedSlots.default({
memberType: this.memberType,
isDirectMember: this.isDirectMember,
isCurrentUser: this.isCurrentUser,
permissions: {
canRemove: this.canRemove,
canResend: this.canResend,
canUpdate: this.canUpdate,
},
});
},
};
</script>
|