diff --git a/index.js b/index.js index 559f65f..7f8fae5 100644 --- a/index.js +++ b/index.js @@ -1000,18 +1000,27 @@ export default class ActivityPubEndpoint { ); } - // Drop non-sparse indexes if they exist (created by earlier versions), - // then recreate with sparse:true so multiple null values are allowed. - this._collections.ap_muted.dropIndex("url_1").catch(() => {}); - this._collections.ap_muted.dropIndex("keyword_1").catch(() => {}); - this._collections.ap_muted.createIndex( - { url: 1 }, - { unique: true, sparse: true, background: true }, - ); - this._collections.ap_muted.createIndex( - { keyword: 1 }, - { unique: true, sparse: true, background: true }, - ); + // Muted collection — sparse unique indexes (allow multiple null values) + this._collections.ap_muted + .dropIndex("url_1") + .catch(() => {}) + .then(() => + this._collections.ap_muted.createIndex( + { url: 1 }, + { unique: true, sparse: true, background: true }, + ), + ) + .catch(() => {}); + this._collections.ap_muted + .dropIndex("keyword_1") + .catch(() => {}) + .then(() => + this._collections.ap_muted.createIndex( + { keyword: 1 }, + { unique: true, sparse: true, background: true }, + ), + ) + .catch(() => {}); this._collections.ap_blocked.createIndex( { url: 1 }, diff --git a/package.json b/package.json index f5c6739..3173d9d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rmdes/indiekit-endpoint-activitypub", - "version": "2.4.0", + "version": "2.4.1", "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.", "keywords": [ "indiekit",