Ensure AP setup for user if not already at toggle time

This commit is contained in:
Bryan Ashby 2023-03-19 13:50:44 -06:00
parent 94842afd7e
commit 35c97f7035
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
2 changed files with 11 additions and 6 deletions

View File

@ -36,18 +36,22 @@ module.exports = class ActivityPubSettings {
return user.activityPubSettings;
}
persistToUserProperties(user, cb = null) {
persistToUserProperties(user, cb) {
return user.persistProperty(
UserProps.ActivityPubSettings,
JSON.stringify(this),
err => {
if (!err) {
// drop from cache
delete user.activityPubSettings;
}
if (cb) {
if (err) {
return cb(err);
}
// drop from cache - force re-cache
delete user.activityPubSettings;
const { prepareLocalUserAsActor } = require('./util');
prepareLocalUserAsActor(user, { force: false }, err => {
return cb(err);
});
}
);
}

View File

@ -137,6 +137,7 @@ exports.getModule = class ActivityPubUserConfig extends MenuModule {
`Failed saving ActivityPub settings for user "${user.username}"`
);
}
return this.prevMenu(cb);
});
}