fix: have options.update also trigger handle and search updates on actor assertion

This commit is contained in:
Julian Lam
2024-12-11 12:53:09 -05:00
parent 546ffed24f
commit 050acb4f85

View File

@@ -169,7 +169,7 @@ Actors.assert = async (ids, options = {}) => {
const queries = profiles.reduce((memo, profile, idx) => {
const { username, fullname } = current[idx];
if (username !== profile.username) {
if (options.update || username !== profile.username) {
if (uidsForCurrent[idx] !== 0) {
memo.searchRemove.push(['ap.preferredUsername:sorted', `${username.toLowerCase()}:${profile.uid}`]);
memo.handleRemove.push(username.toLowerCase());
@@ -179,7 +179,7 @@ Actors.assert = async (ids, options = {}) => {
memo.handleAdd[profile.username.toLowerCase()] = profile.uid;
}
if (profile.fullname && fullname !== profile.fullname) {
if (options.update || profile.fullname && fullname !== profile.fullname) {
if (fullname && uidsForCurrent[idx] !== 0) {
memo.searchRemove.push(['ap.name:sorted', `${fullname.toLowerCase()}:${profile.uid}`]);
}