ci: Remove unnecessary async/await, enable await-thenable linting rule (no-changelog) (#8076)
## Summary We accidentally made some functions `async` in https://github.com/n8n-io/n8n/pull/7846 This PR reverts that change. ## Review / Merge checklist - [x] PR title and summary are descriptive.
This commit is contained in:
committed by
GitHub
parent
a7ffed245a
commit
464b565283
@@ -71,7 +71,7 @@ export class WorkflowService {
|
||||
// Omit user from where if the requesting user has relevant
|
||||
// global workflow permissions. This allows the user to
|
||||
// access workflows they don't own.
|
||||
if (!options.allowGlobalScope || !(await user.hasGlobalScope(options.globalScope))) {
|
||||
if (!options.allowGlobalScope || !user.hasGlobalScope(options.globalScope)) {
|
||||
where.userId = user.id;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ export class WorkflowService {
|
||||
): Promise<WorkflowEntity> {
|
||||
const shared = await this.sharedWorkflowRepository.findOne({
|
||||
relations: ['workflow', 'role'],
|
||||
where: await whereClause({
|
||||
where: whereClause({
|
||||
user,
|
||||
globalScope: 'workflow:update',
|
||||
entityType: 'workflow',
|
||||
@@ -482,7 +482,7 @@ export class WorkflowService {
|
||||
|
||||
const sharedWorkflow = await this.sharedWorkflowRepository.findOne({
|
||||
relations: ['workflow', 'role'],
|
||||
where: await whereClause({
|
||||
where: whereClause({
|
||||
user,
|
||||
globalScope: 'workflow:delete',
|
||||
entityType: 'workflow',
|
||||
|
||||
@@ -21,7 +21,7 @@ export class WorkflowHistoryService {
|
||||
private async getSharedWorkflow(user: User, workflowId: string): Promise<SharedWorkflow | null> {
|
||||
return this.sharedWorkflowRepository.findOne({
|
||||
where: {
|
||||
...(!(await user.hasGlobalScope('workflow:read')) && { userId: user.id }),
|
||||
...(!user.hasGlobalScope('workflow:read') && { userId: user.id }),
|
||||
workflowId,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ EEWorkflowController.put(
|
||||
if (!ownsWorkflow || !workflow) {
|
||||
workflow = undefined;
|
||||
// Allow owners/admins to share
|
||||
if (await req.user.hasGlobalScope('workflow:share')) {
|
||||
if (req.user.hasGlobalScope('workflow:share')) {
|
||||
const sharedRes = await Container.get(WorkflowService).getSharing(req.user, workflowId, {
|
||||
allowGlobalScope: true,
|
||||
globalScope: 'workflow:share',
|
||||
@@ -136,7 +136,7 @@ EEWorkflowController.get(
|
||||
}
|
||||
|
||||
const userSharing = workflow.shared?.find((shared) => shared.user.id === req.user.id);
|
||||
if (!userSharing && !(await req.user.hasGlobalScope('workflow:read'))) {
|
||||
if (!userSharing && !req.user.hasGlobalScope('workflow:read')) {
|
||||
throw new UnauthorizedError(
|
||||
'You do not have permission to access this workflow. Ask the owner to share it with you',
|
||||
);
|
||||
|
||||
@@ -209,7 +209,7 @@ workflowsController.get(
|
||||
|
||||
const shared = await Container.get(SharedWorkflowRepository).findOne({
|
||||
relations,
|
||||
where: await whereClause({
|
||||
where: whereClause({
|
||||
user: req.user,
|
||||
entityType: 'workflow',
|
||||
globalScope: 'workflow:read',
|
||||
|
||||
Reference in New Issue
Block a user