@rmdes/indiekit-endpoint-activitypub 2.0.14 → 2.0.16

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
@@ -952,8 +952,8 @@ export default class ActivityPubEndpoint {
952
952
 
953
953
  // Drop non-sparse indexes if they exist (created by earlier versions),
954
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 {}
955
+ this._collections.ap_muted.dropIndex("url_1").catch(() => {});
956
+ this._collections.ap_muted.dropIndex("keyword_1").catch(() => {});
957
957
  this._collections.ap_muted.createIndex(
958
958
  { url: 1 },
959
959
  { unique: true, sparse: true, background: true },
@@ -126,7 +126,10 @@ export function readerController(mountPath) {
126
126
  item._moderated = true;
127
127
  item._moderationReason = isMutedActor
128
128
  ? "muted_account"
129
- : `muted_keyword:${matchedKeyword}`;
129
+ : "muted_keyword";
130
+ if (matchedKeyword) {
131
+ item._moderationKeyword = matchedKeyword;
132
+ }
130
133
  return true;
131
134
  }
132
135
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-activitypub",
3
- "version": "2.0.14",
3
+ "version": "2.0.16",
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",
@@ -9,11 +9,10 @@
9
9
  <article class="ap-card{% if item.type %} ap-card--{{ item.type }}{% endif %}{% if item.inReplyTo %} ap-card--reply{% endif %}{% if item._moderated %} ap-card--moderated{% endif %}">
10
10
  {# Moderation content warning wrapper #}
11
11
  {% if item._moderated %}
12
- {% set modReason = item._moderationReason %}
13
- {% if modReason == "muted_account" %}
12
+ {% if item._moderationReason == "muted_account" %}
14
13
  {% set modLabel = __("activitypub.moderation.cwMutedAccount") %}
15
- {% elif modReason.startsWith("muted_keyword:") %}
16
- {% set modLabel = __("activitypub.moderation.cwMutedKeyword") + " \"" + modReason.replace("muted_keyword:", "") + "\"" %}
14
+ {% elif item._moderationReason == "muted_keyword" and item._moderationKeyword %}
15
+ {% set modLabel = __("activitypub.moderation.cwMutedKeyword") + ' "' + item._moderationKeyword + '"' %}
17
16
  {% else %}
18
17
  {% set modLabel = __("activitypub.moderation.cwFiltered") %}
19
18
  {% endif %}
@@ -201,6 +200,11 @@
201
200
  </a>
202
201
  <div x-show="error" x-text="error" class="ap-card__action-error" x-transition></div>
203
202
  </footer>
203
+ {# Close moderation content warning wrapper #}
204
+ {% if item._moderated %}
205
+ </div>{# /x-show="shown" #}
206
+ </div>{# /ap-card__moderation-cw #}
207
+ {% endif %}
204
208
  </article>
205
209
 
206
210
  {% endif %}{# end hasCardContent/hasCardTitle/hasCardMedia guard #}