mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
[web] update notification preferences on ownership transfer (#33854)
GitOrigin-RevId: c20c7f992d9dbdd6e9f80feafc7b53587c122dd7
This commit is contained in:
@@ -14,6 +14,7 @@ import TagsHandler from '../Tags/TagsHandler.mjs'
|
||||
import { promiseMapWithLimit } from '@overleaf/promise-utils'
|
||||
import LimitationsManager from '../Subscription/LimitationsManager.mjs'
|
||||
import AsyncLocalStorage from '../../infrastructure/AsyncLocalStorage.mjs'
|
||||
import Modules from '../../infrastructure/Modules.mjs'
|
||||
|
||||
export default {
|
||||
promises: {
|
||||
@@ -142,6 +143,21 @@ async function transferOwnership(projectId, newOwnerId, options = {}) {
|
||||
pendingPrivilegeLevel
|
||||
)
|
||||
|
||||
// Update notification preferences for both new and previous owner
|
||||
try {
|
||||
await Modules.promises.hooks.fire(
|
||||
'projectOwnershipTransferred',
|
||||
projectId,
|
||||
previousOwnerId,
|
||||
newOwnerId
|
||||
)
|
||||
} catch (err) {
|
||||
logger.error(
|
||||
{ err, projectId, previousOwnerId, newOwnerId },
|
||||
'failed to update notification preferences on ownership transfer'
|
||||
)
|
||||
}
|
||||
|
||||
// Flush project to TPDS
|
||||
await TpdsProjectFlusher.promises.flushProjectToTpds(projectId)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user