@rmdes/indiekit-endpoint-activitypub 2.0.13 → 2.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -950,6 +950,10 @@ export default class ActivityPubEndpoint {
950
950
  );
951
951
  }
952
952
 
953
+ // Drop non-sparse indexes if they exist (created by earlier versions),
954
+ // then recreate with sparse:true so multiple null values are allowed.
955
+ try { await this._collections.ap_muted.dropIndex("url_1"); } catch {}
956
+ try { await this._collections.ap_muted.dropIndex("keyword_1"); } catch {}
953
957
  this._collections.ap_muted.createIndex(
954
958
  { url: 1 },
955
959
  { unique: true, sparse: true, background: true },
@@ -22,11 +22,11 @@ export async function addMuted(collections, { url, keyword }) {
22
22
  throw new Error("Cannot mute both url and keyword in same entry");
23
23
  }
24
24
 
25
- const entry = {
26
- url: url || null,
27
- keyword: keyword || null,
28
- mutedAt: new Date().toISOString(),
29
- };
25
+ // Only include the field that's set — avoids null values that conflict
26
+ // with sparse unique indexes
27
+ const entry = { mutedAt: new Date().toISOString() };
28
+ if (url) entry.url = url;
29
+ if (keyword) entry.keyword = keyword;
30
30
 
31
31
  // Upsert to avoid duplicates
32
32
  const filter = url ? { url } : { keyword };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "2.0.13",
3
+ "version": "2.0.14",
4
4
  "description": "ActivityPub federation endpoint for Indiekit via Fedify. Adds full fediverse support: actor, inbox, outbox, followers, following, syndication, and Mastodon migration.",
5
5
  "keywords": [
6
6
  "indiekit",