Fix process abuse transactions
This commit is contained in:
parent
e7812bf091
commit
a77c7327a2
|
@ -49,13 +49,12 @@ async function processCreateAbuse (activity: ActivityCreate | ActivityFlag, byAc
|
||||||
logger.debug('Reporting remote abuse for object %s.', uri)
|
logger.debug('Reporting remote abuse for object %s.', uri)
|
||||||
|
|
||||||
await sequelizeTypescript.transaction(async t => {
|
await sequelizeTypescript.transaction(async t => {
|
||||||
|
const video = await VideoModel.loadByUrlAndPopulateAccount(uri, t)
|
||||||
const video = await VideoModel.loadByUrlAndPopulateAccount(uri)
|
|
||||||
let videoComment: MCommentOwnerVideo
|
let videoComment: MCommentOwnerVideo
|
||||||
let flaggedAccount: MAccountDefault
|
let flaggedAccount: MAccountDefault
|
||||||
|
|
||||||
if (!video) videoComment = await VideoCommentModel.loadByUrlAndPopulateAccountAndVideo(uri)
|
if (!video) videoComment = await VideoCommentModel.loadByUrlAndPopulateAccountAndVideo(uri, t)
|
||||||
if (!videoComment) flaggedAccount = await AccountModel.loadByUrl(uri)
|
if (!videoComment) flaggedAccount = await AccountModel.loadByUrl(uri, t)
|
||||||
|
|
||||||
if (!video && !videoComment && !flaggedAccount) {
|
if (!video && !videoComment && !flaggedAccount) {
|
||||||
logger.warn('Cannot flag unknown entity %s.', object)
|
logger.warn('Cannot flag unknown entity %s.', object)
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
import { AccessDeniedError } from 'oauth2-server'
|
|
||||||
import { logger } from '../helpers/logger'
|
|
||||||
import { UserModel } from '../models/account/user'
|
|
||||||
import { OAuthClientModel } from '../models/oauth/oauth-client'
|
|
||||||
import { OAuthTokenModel } from '../models/oauth/oauth-token'
|
|
||||||
import { LRU_CACHE, OAUTH_LIFETIME } from '../initializers/constants'
|
|
||||||
import { Transaction } from 'sequelize'
|
|
||||||
import { CONFIG } from '../initializers/config'
|
|
||||||
import * as LRUCache from 'lru-cache'
|
import * as LRUCache from 'lru-cache'
|
||||||
|
import { AccessDeniedError } from 'oauth2-server'
|
||||||
|
import { Transaction } from 'sequelize'
|
||||||
|
import { PluginManager } from '@server/lib/plugins/plugin-manager'
|
||||||
|
import { ActorModel } from '@server/models/activitypub/actor'
|
||||||
import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
|
import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
|
||||||
import { MUser } from '@server/types/models/user/user'
|
import { MUser } from '@server/types/models/user/user'
|
||||||
import { UserAdminFlag } from '@shared/models/users/user-flag.model'
|
import { UserAdminFlag } from '@shared/models/users/user-flag.model'
|
||||||
import { createUserAccountAndChannelAndPlaylist } from './user'
|
|
||||||
import { UserRole } from '@shared/models/users/user-role'
|
import { UserRole } from '@shared/models/users/user-role'
|
||||||
import { PluginManager } from '@server/lib/plugins/plugin-manager'
|
import { logger } from '../helpers/logger'
|
||||||
import { ActorModel } from '@server/models/activitypub/actor'
|
import { CONFIG } from '../initializers/config'
|
||||||
|
import { LRU_CACHE } from '../initializers/constants'
|
||||||
|
import { UserModel } from '../models/account/user'
|
||||||
|
import { OAuthClientModel } from '../models/oauth/oauth-client'
|
||||||
|
import { OAuthTokenModel } from '../models/oauth/oauth-token'
|
||||||
|
import { createUserAccountAndChannelAndPlaylist } from './user'
|
||||||
|
|
||||||
type TokenInfo = { accessToken: string, refreshToken: string, accessTokenExpiresAt: Date, refreshTokenExpiresAt: Date }
|
type TokenInfo = { accessToken: string, refreshToken: string, accessTokenExpiresAt: Date, refreshTokenExpiresAt: Date }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue