Client: Guilds Discovery (#8529)

* wip: add guilds discovery page

* add public guilds page

* fix and add tests for the groups utilities mixin
This commit is contained in:
Matteo Pagliazzi
2017-03-03 19:38:17 +01:00
committed by GitHub
parent 3629f7f8a5
commit dc8598ae81
15 changed files with 209 additions and 30 deletions

View File

@@ -0,0 +1,25 @@
// TODO if we only have a single method here, move it to an utility
// a full mixin is not needed
import { TAVERN_ID } from '../../common/script/constants';
export default {
methods: {
isMemberOfGroup (user, group) {
if (group._id === TAVERN_ID) return true;
// If the group is a guild, just check for an intersection with the
// current user's guilds, rather than checking the members of the group.
if (group.type === 'guild') {
return user.guilds.indexOf(group._id) !== -1;
}
// Similarly, if we're dealing with the user's current party, return true.
if (group.type === 'party') {
return user.party._id === group._id;
}
return false;
},
},
};