Merge pull request #3895 from Emile840/master

Add or remove an organization and team from a board
This commit is contained in:
Lauri Ojansivu 2021-07-05 13:38:13 +03:00 committed by GitHub
commit 2a611a8935
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 622 additions and 0 deletions

View file

@ -227,6 +227,56 @@ Boards.attachSchema(
type: String,
allowedValues: ['public', 'private'],
},
orgs: {
/**
* the list of organizations that a board belongs to
*/
type: [Object],
optional: true,
},
'orgs.$.orgId':{
/**
* The uniq ID of the organization
*/
type: String,
},
'orgs.$.orgDisplayName':{
/**
* The display name of the organization
*/
type: String,
},
'orgs.$.isActive': {
/**
* Is the organization active?
*/
type: Boolean,
},
teams: {
/**
* the list of teams that a board belongs to
*/
type: [Object],
optional: true,
},
'teams.$.teamId':{
/**
* The uniq ID of the team
*/
type: String,
},
'teams.$.teamDisplayName':{
/**
* The display name of the team
*/
type: String,
},
'teams.$.isActive': {
/**
* Is the team active?
*/
type: Boolean,
},
color: {
/**
* The color of the board.
@ -695,6 +745,23 @@ Boards.helpers({
return _.where(this.members, { isActive: true });
},
activeOrgs() {
return _.where(this.orgs, { isActive: true });
},
// hasNotAnyOrg(){
// return this.orgs === undefined || this.orgs.length <= 0;
// },
activeteams() {
return _.where(this.teams, { isActive: true });
},
// hasNotAnyTeam(){
// return this.teams === undefined || this.teams.length <= 0;
// },
activeAdmins() {
return _.where(this.members, { isActive: true, isAdmin: true });
},
@ -1459,6 +1526,24 @@ if (Meteor.isServer) {
} else throw new Meteor.Error('error-board-notAMember');
} else throw new Meteor.Error('error-board-doesNotExist');
},
setBoardOrgs(boardOrgsArray, currBoardId){
check(boardOrgsArray, Array);
check(currBoardId, String);
Boards.update(currBoardId, {
$set: {
orgs: boardOrgsArray,
},
});
},
setBoardTeams(boardTeamsArray, currBoardId){
check(boardTeamsArray, Array);
check(currBoardId, String);
Boards.update(currBoardId, {
$set: {
teams: boardTeamsArray,
},
});
},
});
}