mirror of https://gitgud.io/fatchan/jschan.git
modlog records for non-delete actions now link to posts closes #193
parent
c2c29f1ce1
commit
1f7e670c7c
12 changed files with 134 additions and 19 deletions
@ -0,0 +1,35 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
const hashIp = require(__dirname+'/../helpers/haship.js'); |
||||||
|
|
||||||
|
module.exports = async(db, redis) => { |
||||||
|
console.log('update moglog postids to postlinks'); |
||||||
|
await db.collection('modlog').updateMany({}, |
||||||
|
[{ |
||||||
|
$addFields: { |
||||||
|
postLinks: [ |
||||||
|
{ |
||||||
|
$arrayToObject: { |
||||||
|
$map: { |
||||||
|
input: "$postIds", |
||||||
|
as: 'postId', |
||||||
|
in: { |
||||||
|
k: 'postId', |
||||||
|
v: '$$postId' |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
} |
||||||
|
} |
||||||
|
]); |
||||||
|
await db.collection('modlog').updateMany({}, { |
||||||
|
'$unset': { |
||||||
|
'postIds': '' |
||||||
|
}, |
||||||
|
'$set': { |
||||||
|
'showLinks': false |
||||||
|
} |
||||||
|
}); |
||||||
|
}; |
Loading…
Reference in new issue