Refactoring following code to make a distinction beween followed and following users.
Also, moving sending messages to the User class.
This commit is contained in:
parent
fd9cb09de6
commit
cd805fab31
4 changed files with 63 additions and 33 deletions
|
@ -152,4 +152,16 @@ export class Group implements Movable {
|
|||
get getSize() {
|
||||
return this.users.size;
|
||||
}
|
||||
|
||||
/**
|
||||
* A group can have at most one person leading the way in it.
|
||||
*/
|
||||
get leader(): User|undefined {
|
||||
for (const user of this.users) {
|
||||
if (user.hasFollowers()) {
|
||||
return user;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue