mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'federation-remove-duplicate-db-query' into federation-expose-privateKey-to-writeHomeCommunity
This commit is contained in:
commit
f6279c528d
@ -214,14 +214,7 @@ async function writeFederatedHomeCommunityEntries(pubKey: string): Promise<Commu
|
|||||||
async function writeHomeCommunityEntry(pubKey: string): Promise<void> {
|
async function writeHomeCommunityEntry(pubKey: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// check for existing homeCommunity entry
|
// check for existing homeCommunity entry
|
||||||
let homeCom = await DbCommunity.findOne({
|
let homeCom = await DbCommunity.findOne({ foreign: false })
|
||||||
foreign: false,
|
|
||||||
publicKey: Buffer.from(pubKey),
|
|
||||||
})
|
|
||||||
if (!homeCom) {
|
|
||||||
// check if a homecommunity with a different publicKey still exists
|
|
||||||
homeCom = await DbCommunity.findOne({ foreign: false })
|
|
||||||
}
|
|
||||||
if (homeCom) {
|
if (homeCom) {
|
||||||
// simply update the existing entry, but it MUST keep the ID and UUID because of possible relations
|
// simply update the existing entry, but it MUST keep the ID and UUID because of possible relations
|
||||||
homeCom.publicKey = Buffer.from(pubKey)
|
homeCom.publicKey = Buffer.from(pubKey)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user