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:
कारतोफ्फेलस्क्रिप्ट™
2023-12-19 13:52:42 +01:00
committed by GitHub
parent a7ffed245a
commit 464b565283
27 changed files with 47 additions and 57 deletions

View File

@@ -50,7 +50,7 @@ EECredentialsController.get(
const userSharing = credential.shared?.find((shared) => shared.user.id === req.user.id);
if (!userSharing && !(await req.user.hasGlobalScope('credential:read'))) {
if (!userSharing && !req.user.hasGlobalScope('credential:read')) {
throw new UnauthorizedError('Forbidden.');
}
@@ -130,7 +130,7 @@ EECredentialsController.put(
if (!ownsCredential || !credential) {
credential = undefined;
// Allow owners/admins to share
if (await req.user.hasGlobalScope('credential:share')) {
if (req.user.hasGlobalScope('credential:share')) {
const sharedRes = await EECredentials.getSharing(req.user, credentialId, {
allowGlobalScope: true,
globalScope: 'credential:share',

View File

@@ -163,7 +163,7 @@ credentialsController.patch(
);
}
if (sharing.role.name !== 'owner' && !(await req.user.hasGlobalScope('credential:update'))) {
if (sharing.role.name !== 'owner' && !req.user.hasGlobalScope('credential:update')) {
Container.get(Logger).info(
'Attempt to update credential blocked due to lack of permissions',
{
@@ -232,7 +232,7 @@ credentialsController.delete(
);
}
if (sharing.role.name !== 'owner' && !(await req.user.hasGlobalScope('credential:delete'))) {
if (sharing.role.name !== 'owner' && !req.user.hasGlobalScope('credential:delete')) {
Container.get(Logger).info(
'Attempt to delete credential blocked due to lack of permissions',
{

View File

@@ -40,7 +40,7 @@ export class EECredentialsService extends CredentialsService {
// Omit user from where if the requesting user has relevant
// global credential permissions. This allows the user to
// access credentials they don't own.
if (!options.allowGlobalScope || !(await user.hasGlobalScope(options.globalScope))) {
if (!options.allowGlobalScope || !user.hasGlobalScope(options.globalScope)) {
where.userId = user.id;
}

View File

@@ -88,7 +88,7 @@ export class CredentialsService {
) {
const findManyOptions = this.toFindManyOptions(options.listQueryOptions);
const returnAll = (await user.hasGlobalScope('credential:list')) && !options.onlyOwn;
const returnAll = user.hasGlobalScope('credential:list') && !options.onlyOwn;
const isDefaultSelect = !options.listQueryOptions?.select;
if (returnAll) {
@@ -150,7 +150,7 @@ export class CredentialsService {
// Omit user from where if the requesting user has relevant
// global credential permissions. This allows the user to
// access credentials they don't own.
if (!options.allowGlobalScope || !(await user.hasGlobalScope(options.globalScope))) {
if (!options.allowGlobalScope || !user.hasGlobalScope(options.globalScope)) {
Object.assign(where, {
userId: user.id,
role: { name: 'owner' },