Skip to content

Commit

Permalink
Merge pull request #4211 from alkem-io/develop
Browse files Browse the repository at this point in the history
v0.83.0
  • Loading branch information
ccanos authored Jul 5, 2024
2 parents 1250490 + e981c92 commit f640ea0
Show file tree
Hide file tree
Showing 38 changed files with 480 additions and 308 deletions.
3 changes: 1 addition & 2 deletions .build/synapse/homeserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,7 @@ limit_remote_rooms:
#complexity_error: "This room is too complex."

# allow server admins to join complex rooms. Default is false.
#
#admins_can_join: true
# admins_can_join: true

# Whether to require a user to be in the room to add an alias to it.
# Defaults to 'true'.
Expand Down
29 changes: 16 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alkemio-server",
"version": "0.82.9",
"version": "0.83.0",
"description": "Alkemio server, responsible for managing the shared Alkemio platform",
"author": "Alkemio Foundation",
"private": false,
Expand Down Expand Up @@ -51,8 +51,8 @@
}
},
"dependencies": {
"@alkemio/matrix-adapter-lib": "^0.3.6",
"@alkemio/notifications-lib": "^0.9.3",
"@alkemio/matrix-adapter-lib": "^0.4.1",
"@alkemio/notifications-lib": "^0.9.6",
"@apollo/server": "^4.10.2",
"@elastic/elasticsearch": "^8.4.0",
"@golevelup/nestjs-rabbitmq": "^5.3.0",
Expand Down
4 changes: 2 additions & 2 deletions quickstart-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ services:

synapse:
container_name: alkemio_dev_synapse
image: matrixdotorg/synapse:v1.82.0
image: matrixdotorg/synapse:v1.98.0
depends_on:
- postgres
restart: always
Expand Down Expand Up @@ -234,7 +234,7 @@ services:
- 'host.docker.internal:host-gateway'
container_name: alkemio_dev_matrix_adapter
hostname: matrix-adapter
image: alkemio/matrix-adapter:v0.3.1
image: alkemio/matrix-adapter:v0.4.3
platform: linux/x86_64
environment:
- RABBITMQ_HOST
Expand Down
1 change: 1 addition & 0 deletions src/common/enums/search.result.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export enum SearchResultType {
USERGROUP = 'usergroup',
POST = 'post',
CALLOUT = 'callout',
WHITEBOARD = 'whiteboard',
}

registerEnumType(SearchResultType, {
Expand Down
14 changes: 2 additions & 12 deletions src/domain/community/community/community.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ import { ICommunity } from '@domain/community/community/community.interface';
import { AuthorizableEntity } from '@domain/common/entity/authorizable-entity';
import { Application } from '@domain/community/application/application.entity';
import { Communication } from '@domain/communication/communication/communication.entity';
import {
TINY_TEXT_LENGTH,
UUID_LENGTH,
} from '@src/common/constants/entity.field.length.constants';
import { UUID_LENGTH } from '@src/common/constants/entity.field.length.constants';
import { CommunityPolicy } from '../community-policy/community.policy.entity';
import { Form } from '@domain/common/form/form.entity';
import { Invitation } from '../invitation/invitation.entity';
import { CommunityGuidelines } from '../community-guidelines/community.guidelines.entity';
import { SpaceType } from '@common/enums/space.type';
import { PlatformInvitation } from '@platform/invitation';

@Entity()
Expand Down Expand Up @@ -96,19 +92,13 @@ export class Community
})
parentCommunity?: Community;

@Column({
length: TINY_TEXT_LENGTH,
})
type!: SpaceType;

@Column({
length: UUID_LENGTH,
})
parentID!: string;

constructor(type: SpaceType) {
constructor() {
super();
this.type = type;
this.parentID = '';
}
}
2 changes: 0 additions & 2 deletions src/domain/community/community/community.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ICommunityPolicy } from '../community-policy/community.policy.interface
import { IForm } from '@domain/common/form/form.interface';
import { IInvitation } from '../invitation/invitation.interface';
import { ICommunityGuidelines } from '../community-guidelines/community.guidelines.interface';
import { SpaceType } from '@common/enums/space.type';
import { IPlatformInvitation } from '@platform/invitation';

@ObjectType('Community', {
Expand All @@ -29,7 +28,6 @@ export abstract class ICommunity extends IAuthorizable {
guidelines?: ICommunityGuidelines;

communication?: ICommunication;
type!: SpaceType;

parentID!: string;
}
8 changes: 6 additions & 2 deletions src/domain/community/community/community.service.events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import { ActivityInputMemberJoined } from '@services/adapters/activity-adapter/d
import { ActivityAdapter } from '@services/adapters/activity-adapter/activity.adapter';
import { SpaceType } from '@common/enums/space.type';
import { IContributor } from '../contributor/contributor.interface';
import { CommunityResolverService } from '@services/infrastructure/entity-resolver/community.resolver.service';

@Injectable()
export class CommunityEventsService {
constructor(
private contributionReporter: ContributionReporterService,
private notificationAdapter: NotificationAdapter,
private activityAdapter: ActivityAdapter
private activityAdapter: ActivityAdapter,
private communityResolverService: CommunityResolverService
) {}

public async registerCommunityNewMemberActivity(
Expand Down Expand Up @@ -47,7 +49,9 @@ export class CommunityEventsService {
await this.notificationAdapter.communityNewMember(notificationInput);

// Record the contribution events
switch (community.type) {
const space =
await this.communityResolverService.getSpaceForCommunityOrFail(spaceID);
switch (space.type) {
case SpaceType.SPACE:
this.contributionReporter.spaceJoined(
{
Expand Down
4 changes: 2 additions & 2 deletions src/domain/community/community/community.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class CommunityService {
communityData: CreateCommunityInput,
storageAggregator: IStorageAggregator
): Promise<ICommunity> {
const community: ICommunity = new Community(communityData.type);
const community: ICommunity = new Community();
community.authorization = new AuthorizationPolicy();
const policy = communityData.policy as ICommunityPolicyDefinition;
community.policy = await this.communityPolicyService.createCommunityPolicy(
Expand Down Expand Up @@ -189,7 +189,7 @@ export class CommunityService {
throw new EntityNotFoundException(
`Unable to find group with ID: '${groupID}'`,
LogContext.COMMUNITY,
{ communityId: community.id, communityType: community.type }
{ communityId: community.id }
);
}
return result;
Expand Down
2 changes: 0 additions & 2 deletions src/domain/community/community/dto/community.dto.create.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { SpaceType } from '@common/enums/space.type';
import { CreateFormInput } from '@domain/common/form/dto/form.dto.create';
import { CreateCommunityGuidelinesInput } from '@domain/community/community-guidelines/dto/community.guidelines.dto.create';
import { ICommunityPolicyDefinition } from '@domain/community/community-policy/community.policy.definition';
Expand All @@ -7,7 +6,6 @@ export class CreateCommunityInput {
guidelines!: CreateCommunityGuidelinesInput;

name!: string;
type!: SpaceType;
policy!: ICommunityPolicyDefinition;
applicationForm!: CreateFormInput;
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,11 @@ export class InvitationAuthorizationService {
});
break;
case CommunityContributorType.VIRTUAL:
const vcWithHost =
await this.virtualContributorService.getVirtualContributorOrFail(
contributor.id,
{
relations: {
account: true,
},
}
const vcHostCriterias =
await this.virtualContributorService.getAccountHostCredentials(
contributor.id
);
criterias.push({
type: AuthorizationCredential.ACCOUNT_HOST,
resourceID: vcWithHost.account.id,
});
criterias.push(...vcHostCriterias);
break;
}

Expand Down
6 changes: 4 additions & 2 deletions src/domain/space/account.host/account.host.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { ContributorModule } from '@domain/community/contributor/contributor.mod
import { Module } from '@nestjs/common';
import { AccountHostService } from './account.host.service';
import { AgentModule } from '@domain/agent/agent/agent.module';
import { ContributorService } from '@domain/community/contributor/contributor.service';
import { ContributorLookupModule } from '@services/infrastructure/contributor-lookup/contributor.lookup.module';

@Module({
imports: [ContributorModule, AgentModule],
providers: [AccountHostService],
imports: [ContributorModule, AgentModule, ContributorLookupModule],
providers: [AccountHostService, ContributorService],
exports: [AccountHostService],
})
export class AccountHostModule {}
4 changes: 4 additions & 0 deletions src/domain/space/account/account.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { AccountHostModule } from '../account.host/account.host.module';
import { LicenseEngineModule } from '@core/license-engine/license.engine.module';
import { StorageAggregatorModule } from '@domain/storage/storage-aggregator/storage.aggregator.module';
import { CommunityPolicyModule } from '@domain/community/community-policy/community.policy.module';
import { NotificationAdapterModule } from '@services/adapters/notification-adapter/notification.adapter.module';
import { CommunityModule } from '@domain/community/community/community.module';

@Module({
imports: [
Expand All @@ -46,6 +48,8 @@ import { CommunityPolicyModule } from '@domain/community/community-policy/commun
NameReporterModule,
CommunityPolicyModule,
TypeOrmModule.forFeature([Account]),
NotificationAdapterModule,
CommunityModule,
],
providers: [
AccountService,
Expand Down
28 changes: 3 additions & 25 deletions src/domain/space/account/account.resolver.fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
} from '@domain/community/virtual-contributor';
import { AccountHostService } from '../account.host/account.host.service';
import { LicensePrivilege } from '@common/enums/license.privilege';
import { LicensePlanType } from '@common/enums/license.plan.type';

@Resolver(() => IAccount)
export class AccountResolverFields {
Expand Down Expand Up @@ -163,36 +162,15 @@ export class AccountResolverFields {
nullable: true,
description: 'The "highest" subscription active for this Account.',
})
async activeSubscription(@Parent() account: Account) {
const licensingFramework =
await this.licensingService.getDefaultLicensingOrFail();

const today = new Date();
const plans = await this.licensingService.getLicensePlans(
licensingFramework.id
);

return (await this.accountService.getSubscriptions(account))
.filter(
subscription => !subscription.expires || subscription.expires > today
)
.map(subscription => {
return {
subscription,
plan: plans.find(
plan => plan.licenseCredential === subscription.name
),
};
})
.filter(item => item.plan?.type === LicensePlanType.SPACE_PLAN)
.sort((a, b) => b.plan!.sortOrder - a.plan!.sortOrder)?.[0].subscription;
async activeSubscription(@Parent() account: IAccount) {
return this.accountService.activeSubscription(account);
}

@ResolveField('subscriptions', () => [IAccountSubscription], {
nullable: false,
description: 'The subscriptions active for this Account.',
})
async subscriptions(@Parent() account: Account) {
async subscriptions(@Parent() account: IAccount) {
return await this.accountService.getSubscriptions(account);
}

Expand Down
Loading

0 comments on commit f640ea0

Please sign in to comment.