Skip to content

Commit

Permalink
Remove activity code leftovers (#6386)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela authored Jan 21, 2025
1 parent 781b140 commit d19229f
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 448 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-news-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hive': patch
---

Remove the code leftovers related to activities (no longer a thing)
2 changes: 0 additions & 2 deletions packages/services/api/src/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import {
SchemaServiceConfig,
} from './modules/schema/providers/orchestrators/tokens';
import { sharedModule } from './modules/shared';
import { ActivityManager } from './modules/shared/providers/activity-manager';
import { CryptoProvider, encryptionSecretProvider } from './modules/shared/providers/crypto';
import { DistributedCache } from './modules/shared/providers/distributed-cache';
import { Emails, EMAILS_ENDPOINT } from './modules/shared/providers/emails';
Expand Down Expand Up @@ -209,7 +208,6 @@ export function createRegistry({

const providers: Provider[] = [
AuditLogRecorder,
ActivityManager,
HttpClient,
IdTranslator,
Mutex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { ProjectAccessScope } from '../../auth/providers/project-access';
import { TargetAccessScope } from '../../auth/providers/target-access';
import { BillingProvider } from '../../billing/providers/billing.provider';
import { OIDCIntegrationsProvider } from '../../oidc-integrations/providers/oidc-integrations.provider';
import { ActivityManager } from '../../shared/providers/activity-manager';
import { Emails, mjml } from '../../shared/providers/emails';
import { IdTranslator } from '../../shared/providers/id-translator';
import { Logger } from '../../shared/providers/logger';
Expand Down Expand Up @@ -66,7 +65,6 @@ export class OrganizationManager {
private authManager: AuthManager,
private auditLog: AuditLogRecorder,
private tokenStorage: TokenStorage,
private activityManager: ActivityManager,
private billingProvider: BillingProvider,
private oidcIntegrationProvider: OIDCIntegrationsProvider,
private emails: Emails,
Expand Down Expand Up @@ -221,17 +219,6 @@ export class OrganizationManager {
organizationId: organizationId,
});

await this.activityManager.create({
type: 'MEMBER_LEFT',
selector: {
organizationId: organizationId,
},
user: user,
meta: {
email: user.email,
},
});

// Because we checked the access before, it's stale by now
this.authManager.resetAccessCache();
this.session.reset();
Expand Down Expand Up @@ -338,22 +325,13 @@ export class OrganizationManager {
});

if (result.ok) {
await Promise.all([
this.activityManager.create({
type: 'ORGANIZATION_CREATED',
selector: {
organizationId: result.organization.id,
},
user,
}),
this.auditLog.record({
eventType: 'ORGANIZATION_CREATED',
organizationId: result.organization.id,
metadata: {
organizationSlug: result.organization.id,
},
}),
]);
await this.auditLog.record({
eventType: 'ORGANIZATION_CREATED',
organizationId: result.organization.id,
metadata: {
organizationSlug: result.organization.id,
},
});
}

return result;
Expand Down Expand Up @@ -415,17 +393,6 @@ export class OrganizationManager {
organizationId: organization.id,
});

await this.activityManager.create({
type: 'ORGANIZATION_PLAN_UPDATED',
selector: {
organizationId: organization.id,
},
meta: {
newPlan: plan,
previousPlan: organization.billingPlan,
},
});

await this.auditLog.record({
eventType: 'ORGANIZATION_PLAN_UPDATED',
organizationId: organization.id,
Expand Down Expand Up @@ -521,26 +488,17 @@ export class OrganizationManager {
reservedSlugs: reservedOrganizationSlugs,
});

await this.auditLog.record({
eventType: 'ORGANIZATION_SLUG_UPDATED',
organizationId: organization.id,
metadata: {
previousSlug: organization.slug,
newSlug: slug,
},
});

if (result.ok) {
await this.activityManager.create({
type: 'ORGANIZATION_ID_UPDATED',
selector: {
organizationId: organization.id,
},
meta: {
value: result.organization.slug,
await this.auditLog.record({
eventType: 'ORGANIZATION_SLUG_UPDATED',
organizationId: organization.id,
metadata: {
previousSlug: organization.slug,
newSlug: slug,
},
});
}

return result;
}

Expand Down Expand Up @@ -730,23 +688,15 @@ export class OrganizationManager {
organizationId: organization.id,
step: 'invitingMembers',
}),
this.activityManager.create({
type: 'MEMBER_ADDED',
selector: {
organizationId: organization.id,
userId: user.id,
this.auditLog.record({
eventType: 'USER_JOINED',
organizationId: organization.id,
metadata: {
inviteeEmail: user.email,
},
}),
]);

await this.auditLog.record({
eventType: 'USER_JOINED',
organizationId: organization.id,
metadata: {
inviteeEmail: user.email,
},
});

return organization;
}

Expand Down Expand Up @@ -940,18 +890,6 @@ export class OrganizationManager {
organizationId: organization,
});

if (member) {
await this.activityManager.create({
type: 'MEMBER_DELETED',
selector: {
organizationId: organization,
},
meta: {
email: member.user.email,
},
});
}

// Because we checked the access before, it's stale by now
this.authManager.resetAccessCache();
this.session.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { Organization, Project, ProjectType } from '../../../shared/entitie
import { share } from '../../../shared/helpers';
import { AuditLogRecorder } from '../../audit-logs/providers/audit-log-recorder';
import { Session } from '../../auth/lib/authz';
import { ActivityManager } from '../../shared/providers/activity-manager';
import { Logger } from '../../shared/providers/logger';
import { OrganizationSelector, ProjectSelector, Storage } from '../../shared/providers/storage';
import { TokenStorage } from '../../token/providers/token-storage';
Expand All @@ -26,7 +25,6 @@ export class ProjectManager {
private storage: Storage,
private session: Session,
private tokenStorage: TokenStorage,
private activityManager: ActivityManager,
private auditLog: AuditLogRecorder,
) {
this.logger = logger.child({ source: 'ProjectManager' });
Expand Down Expand Up @@ -68,16 +66,6 @@ export class ProjectManager {
organizationId: organization,
step: 'creatingProject',
}),
this.activityManager.create({
type: 'PROJECT_CREATED',
selector: {
organizationId: organization,
projectId: result.project.id,
},
meta: {
projectType: type,
},
}),
this.auditLog.record({
eventType: 'PROJECT_CREATED',
organizationId: organization,
Expand Down Expand Up @@ -121,17 +109,6 @@ export class ProjectManager {
});
await this.tokenStorage.invalidateTokens(deletedProject.tokens);

await this.activityManager.create({
type: 'PROJECT_DELETED',
selector: {
organizationId: organization,
},
meta: {
name: deletedProject.name,
cleanId: deletedProject.slug,
},
});

return deletedProject;
}

Expand Down Expand Up @@ -250,16 +227,6 @@ export class ProjectManager {
});

if (result.ok) {
await this.activityManager.create({
type: 'PROJECT_ID_UPDATED',
selector: {
organizationId: organization,
projectId: project,
},
meta: {
value: slug,
},
});
await this.auditLog.record({
eventType: 'PROJECT_SLUG_UPDATED',
organizationId: organization,
Expand Down
Loading

0 comments on commit d19229f

Please sign in to comment.