Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.ajax({
- // Get communities' URL
- })
- .then(function (communities) {
- var promises;
- for (var i = 0; i < communities.length; i++) {
- promises.push($.ajax({
- // Get groups with matching title for matching user on community URL
- }));
- }
- return $.when.apply(this, promises);
- })
- .then(function (communityMemberships) {
- var communitiesToAdd = communityMemberships.filter(isMember);
- // Code to perform on communities where user is not a member
- });
- var isMember = function (membership) {
- return membership == 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment