🧹 Propose to remove channels, notifications, knowledge-graph and phpnode (#55)
* Propose to remove channels and notifications * Propose to remove knowledge graph too * Put back tags test * FIxing tests * FIx query builder test
This commit is contained in:
@@ -34,10 +34,6 @@ import { logger, RealtimeSaved } from "../../../core/platform/framework";
|
||||
import { getCompanyRoom, getUserRoom } from "../realtime";
|
||||
import gr from "../../global-resolver";
|
||||
import { localEventBus } from "../../../core/platform/framework/event-bus";
|
||||
import {
|
||||
KnowledgeGraphEvents,
|
||||
KnowledgeGraphGenericEventPayload,
|
||||
} from "../../../core/platform/services/knowledge-graph/types";
|
||||
|
||||
export class CompanyServiceImpl {
|
||||
version: "1";
|
||||
@@ -100,15 +96,6 @@ export class CompanyServiceImpl {
|
||||
await this.externalCompanyRepository.save(extCompany, context);
|
||||
}
|
||||
|
||||
localEventBus.publish<KnowledgeGraphGenericEventPayload<Company>>(
|
||||
KnowledgeGraphEvents.COMPANY_UPSERT,
|
||||
{
|
||||
id: company.id,
|
||||
resource: company,
|
||||
links: [],
|
||||
},
|
||||
);
|
||||
|
||||
return new SaveResult<Company>("company", company, OperationType.UPDATE);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,10 +32,6 @@ import { RealtimeSaved } from "../../../../core/platform/framework";
|
||||
import { getPublicUserRoom, getUserRoom } from "../../realtime";
|
||||
import NodeCache from "node-cache";
|
||||
import gr from "../../../global-resolver";
|
||||
import {
|
||||
KnowledgeGraphEvents,
|
||||
KnowledgeGraphGenericEventPayload,
|
||||
} from "../../../../core/platform/services/knowledge-graph/types";
|
||||
import { formatUser } from "../../../../utils/users";
|
||||
|
||||
export class UserServiceImpl {
|
||||
@@ -121,27 +117,11 @@ export class UserServiceImpl {
|
||||
},
|
||||
];
|
||||
})
|
||||
async save<SaveOptions>(user: User, context?: ExecutionContext): Promise<SaveResult<User>> {
|
||||
async save(user: User, context?: ExecutionContext): Promise<SaveResult<User>> {
|
||||
this.assignDefaults(user);
|
||||
await this.repository.save(user, context);
|
||||
await this.updateExtRepository(user);
|
||||
|
||||
localEventBus.publish<KnowledgeGraphGenericEventPayload<User>>(
|
||||
KnowledgeGraphEvents.USER_UPSERT,
|
||||
{
|
||||
id: user.id,
|
||||
resource: user,
|
||||
links: [
|
||||
{
|
||||
// FIXME: We should provide the company id here
|
||||
id: "",
|
||||
relation: "parent",
|
||||
type: "company",
|
||||
},
|
||||
],
|
||||
},
|
||||
);
|
||||
|
||||
await this.publishPublicUserRealtime(user.id);
|
||||
|
||||
return new SaveResult("user", user, OperationType.UPDATE);
|
||||
|
||||
@@ -35,7 +35,6 @@ import { getCompanyRooms, getUserRooms } from "../realtime";
|
||||
import { formatCompany, getCompanyStats } from "../utils";
|
||||
import { formatUser } from "../../../utils/users";
|
||||
import gr from "../../global-resolver";
|
||||
import { UserChannel, UsersIncludedChannel } from "../../channels/entities";
|
||||
|
||||
export class UsersCrudController
|
||||
implements
|
||||
@@ -282,39 +281,11 @@ export class UsersCrudController
|
||||
}
|
||||
|
||||
async recent(
|
||||
request: FastifyRequest<{ Params: CompanyParameters; Querystring: { limit: 100 } }>,
|
||||
_request: FastifyRequest<{ Params: CompanyParameters; Querystring: { limit: 100 } }>,
|
||||
_reply: FastifyReply,
|
||||
): Promise<ResourceListResponse<UserObject>> {
|
||||
const context = getExecutionContext(request);
|
||||
const userId = context.user.id;
|
||||
const companyId = request.params.id;
|
||||
|
||||
let channels: UserChannel[] = await gr.services.channels.channels
|
||||
.getChannelsForUsersInWorkspace(companyId, "direct", userId, undefined, context)
|
||||
.then(list => list.getEntities());
|
||||
|
||||
channels = channels.sort((a, b) => b.last_activity - a.last_activity);
|
||||
channels = channels.slice(0, 100);
|
||||
|
||||
const userIncludedChannels: UsersIncludedChannel[] = await Promise.all(
|
||||
channels.map(
|
||||
channel =>
|
||||
gr.services.channels.channels.includeUsersInDirectChannel(
|
||||
channel,
|
||||
userId,
|
||||
) as Promise<UsersIncludedChannel>,
|
||||
),
|
||||
);
|
||||
|
||||
const users: UserObject[] = [];
|
||||
for (const channel of userIncludedChannels) {
|
||||
for (const user of channel.users) {
|
||||
if (user.id != request.currentUser.id) users.push(user);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
resources: [...uniq(users).slice(0, request.query.limit)],
|
||||
resources: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user