This commit is contained in:
Bryan Ashby 2023-02-06 22:45:01 -07:00
parent c9b3c9bc41
commit 39a49f00be
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
3 changed files with 14 additions and 3 deletions

View File

@ -457,7 +457,7 @@ module.exports = class Collection extends ActivityPubObject {
); );
} }
static removeById(collectionName, owningUser, objectId, cb) { static removeOwnedById(collectionName, owningUser, objectId, cb) {
const actorId = owningUser.getProperty(UserProps.ActivityPubActorId); const actorId = owningUser.getProperty(UserProps.ActivityPubActorId);
if (!actorId) { if (!actorId) {
return cb( return cb(
@ -476,6 +476,17 @@ module.exports = class Collection extends ActivityPubObject {
); );
} }
static removeById(collectionName, objectId, cb) {
apDb.run(
`DELETE FROM collection
WHERE name = ? AND object_id = ?;`,
[collectionName, objectId],
err => {
return cb(err);
}
);
}
static _rowToObjectInfo(row) { static _rowToObjectInfo(row) {
return { return {
name: row.name, name: row.name,

View File

@ -47,7 +47,7 @@ function profile(webServer, user) {
} }
function avatar(webServer, user, filename) { function avatar(webServer, user, filename) {
return makeUserUrl(this.webServer, user, '/users/') + `/avatar/${filename}`; return makeUserUrl(webServer, user, '/users/') + `/avatar/${filename}`;
} }
function sharedInbox(webServer) { function sharedInbox(webServer) {

View File

@ -654,7 +654,7 @@ exports.getModule = class ActivityPubWebHandler extends WebHandlerModule {
return this.webServer.notImplemented(resp); return this.webServer.notImplemented(resp);
} }
Collection.removeById('followers', localUser, remoteActor.id, err => { Collection.removeOwnedById('followers', localUser, remoteActor.id, err => {
if (err) { if (err) {
return this.webServer.internalServerError(resp, err); return this.webServer.internalServerError(resp, err);
} }