refactor: Delete a lot of unused and duplicate code in Server and WebhookServer (#5080)
* store n8n version string in a const and use that everywhere * reduce code duplication between Server and WebhookServer * unify redis checks * fix linting
This commit is contained in:
committed by
GitHub
parent
b67f803cbe
commit
8b19fdd5f0
@@ -23,7 +23,8 @@ import {
|
||||
import { Telemetry } from '@/telemetry';
|
||||
import { RoleService } from './role/role.service';
|
||||
import { eventBus } from './eventbus';
|
||||
import { User } from './databases/entities/User';
|
||||
import type { User } from '@db/entities/User';
|
||||
import { N8N_VERSION } from '@/constants';
|
||||
|
||||
function userToPayload(user: User): {
|
||||
userId: string;
|
||||
@@ -42,19 +43,11 @@ function userToPayload(user: User): {
|
||||
}
|
||||
|
||||
export class InternalHooksClass implements IInternalHooksClass {
|
||||
private versionCli: string;
|
||||
|
||||
private nodeTypes: INodeTypes;
|
||||
|
||||
constructor(
|
||||
private telemetry: Telemetry,
|
||||
private instanceId: string,
|
||||
versionCli: string,
|
||||
nodeTypes: INodeTypes,
|
||||
) {
|
||||
this.versionCli = versionCli;
|
||||
this.nodeTypes = nodeTypes;
|
||||
}
|
||||
private nodeTypes: INodeTypes,
|
||||
) {}
|
||||
|
||||
async onServerStarted(
|
||||
diagnosticInfo: IDiagnosticInfo,
|
||||
@@ -174,7 +167,7 @@ export class InternalHooksClass implements IInternalHooksClass {
|
||||
node_graph_string: JSON.stringify(nodeGraph),
|
||||
notes_count_overlapping: overlappingCount,
|
||||
notes_count_non_overlapping: notesCount - overlappingCount,
|
||||
version_cli: this.versionCli,
|
||||
version_cli: N8N_VERSION,
|
||||
num_tags: workflow.tags?.length ?? 0,
|
||||
public_api: publicApi,
|
||||
sharing_role: userRole,
|
||||
@@ -249,7 +242,7 @@ export class InternalHooksClass implements IInternalHooksClass {
|
||||
const properties: IExecutionTrackProperties = {
|
||||
workflow_id: workflow.id,
|
||||
is_manual: false,
|
||||
version_cli: this.versionCli,
|
||||
version_cli: N8N_VERSION,
|
||||
success: false,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user