aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/user.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-15 09:17:19 +0200
committerChocobozzz <me@florianbigard.com>2021-06-15 10:40:06 +0200
commiteae0365b5c5468e51e9795b0e894815ebda86b4a (patch)
tree5da54b28c94d43d1715a0c69e35eb1cf3a1a959d /server/lib/user.ts
parent51f636ad0f928bb94069c9143e38df0518f6e4a7 (diff)
downloadPeerTube-eae0365b5c5468e51e9795b0e894815ebda86b4a.tar.gz
PeerTube-eae0365b5c5468e51e9795b0e894815ebda86b4a.tar.zst
PeerTube-eae0365b5c5468e51e9795b0e894815ebda86b4a.zip
Fix missing transactions
Diffstat (limited to 'server/lib/user.ts')
-rw-r--r--server/lib/user.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/lib/user.ts b/server/lib/user.ts
index a2163abb1..91a682a7e 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -44,11 +44,11 @@ async function createUserAccountAndChannelAndPlaylist (parameters: {
44 displayName: userDisplayName, 44 displayName: userDisplayName,
45 userId: userCreated.id, 45 userId: userCreated.id,
46 applicationId: null, 46 applicationId: null,
47 t: t 47 t
48 }) 48 })
49 userCreated.Account = accountCreated 49 userCreated.Account = accountCreated
50 50
51 const channelAttributes = await buildChannelAttributes(userCreated, channelNames) 51 const channelAttributes = await buildChannelAttributes(userCreated, t, channelNames)
52 const videoChannel = await createLocalVideoChannel(channelAttributes, accountCreated, t) 52 const videoChannel = await createLocalVideoChannel(channelAttributes, accountCreated, t)
53 53
54 const videoPlaylist = await createWatchLaterPlaylist(accountCreated, t) 54 const videoPlaylist = await createWatchLaterPlaylist(accountCreated, t)
@@ -203,13 +203,13 @@ function createDefaultUserNotificationSettings (user: MUserId, t: Transaction |
203 return UserNotificationSettingModel.create(values, { transaction: t }) 203 return UserNotificationSettingModel.create(values, { transaction: t })
204} 204}
205 205
206async function buildChannelAttributes (user: MUser, channelNames?: ChannelNames) { 206async function buildChannelAttributes (user: MUser, transaction?: Transaction, channelNames?: ChannelNames) {
207 if (channelNames) return channelNames 207 if (channelNames) return channelNames
208 208
209 let channelName = user.username + '_channel' 209 let channelName = user.username + '_channel'
210 210
211 // Conflict, generate uuid instead 211 // Conflict, generate uuid instead
212 const actor = await ActorModel.loadLocalByName(channelName) 212 const actor = await ActorModel.loadLocalByName(channelName, transaction)
213 if (actor) channelName = uuidv4() 213 if (actor) channelName = uuidv4()
214 214
215 const videoChannelDisplayName = `Main ${user.username} channel` 215 const videoChannelDisplayName = `Main ${user.username} channel`