Merge branch 'fix/safe-render-notifications' into 'develop'
authorrinpatch <rinpatch@sdf.org>
Thu, 5 Sep 2019 05:47:06 +0000 (05:47 +0000)
committerrinpatch <rinpatch@sdf.org>
Thu, 5 Sep 2019 05:47:06 +0000 (05:47 +0000)
Do not crash if one notification failed to render

See merge request pleroma/pleroma!1630

CHANGELOG.md
Dockerfile
config/docker.exs
docs/api/differences_in_mastoapi_responses.md
lib/pleroma/web/mastodon_api/views/status_view.ex
test/web/mastodon_api/views/status_view_test.exs

index 80aed34912d4ece94ec25f8049102359bc22e33c..3f4e7a132f182362773f5b6b4fe40163f263aeb8 100644 (file)
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - **Breaking:** `/api/pleroma/notifications/read` is moved to `/api/v1/pleroma/notifications/read` and now supports `max_id` and responds with Mastodon API entities.
 - Configuration: OpenGraph and TwitterCard providers enabled by default
 - Configuration: Filter.AnonymizeFilename added ability to retain file extension with custom text
+- Mastodon API: `pleroma.thread_muted` key in the Status entity
 - Federation: Return 403 errors when trying to request pages from a user's follower/following collections if they have `hide_followers`/`hide_follows` set
 - NodeInfo: Return `skipThreadContainment` in `metadata` for the `skip_thread_containment` option
 - NodeInfo: Return `mailerEnabled` in `metadata`
index 268ec61dc27ba3cbe977831cfce2070d0f6743bb..c61dcfde91251915289159b6663fe51b944c2bd9 100644 (file)
@@ -1,4 +1,4 @@
-FROM rinpatch/elixir:1.9.0-rc.0-alpine as build
+FROM elixir:1.9-alpine as build
 
 COPY . .
 
@@ -12,7 +12,7 @@ RUN apk add git gcc g++ musl-dev make &&\
        mkdir release &&\
        mix release --path release
 
-FROM alpine:latest
+FROM alpine:3.9
 
 ARG HOME=/opt/pleroma
 ARG DATA=/var/lib/pleroma
index 63ab4cdeefebe3d8756bf09f8f9e5f15ba815a1c..f9f27d141511ea8c3836a880869c38c670953075 100644 (file)
@@ -10,7 +10,7 @@ config :pleroma, :instance,
   notify_email: System.get_env("NOTIFY_EMAIL"),
   limit: 5000,
   registrations_open: false,
-  dynamic_configuration: true
+  healthcheck: true
 
 config :pleroma, Pleroma.Repo,
   adapter: Ecto.Adapters.Postgres,
index f34e3dd72bfcc5b5f9b65884296a73de93d24739..02f90f3e89dd294e30a8adeb91af6f64fe05bb13 100644 (file)
@@ -26,6 +26,7 @@ Has these additional fields under the `pleroma` object:
 - `content`: a map consisting of alternate representations of the `content` property with the key being it's mimetype. Currently the only alternate representation supported is `text/plain`
 - `spoiler_text`: a map consisting of alternate representations of the `spoiler_text` property with the key being it's mimetype. Currently the only alternate representation supported is `text/plain`
 - `expires_at`: a datetime (iso8601) that states when the post will expire (be deleted automatically), or empty if the post won't expire
+- `thread_muted`: true if the thread the post belongs to is muted
 
 ## Attachments
 
index a4ee0b5ddc9bb0e2d67ac139a6727138187b2c8f..4c3c8c564210e6fa3800b5ec7a31f29acf45f8ee 100644 (file)
@@ -299,7 +299,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
         content: %{"text/plain" => content_plaintext},
         spoiler_text: %{"text/plain" => summary_plaintext},
         expires_at: expires_at,
-        direct_conversation_id: direct_conversation_id
+        direct_conversation_id: direct_conversation_id,
+        thread_muted: thread_muted?
       }
     }
   end
index 1b6beb6d29437d2354ceccdf734f6c5f54f4d195..90451cbdc757ba8bfeee89113c9c6d991bfe956a 100644 (file)
@@ -150,7 +150,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
         content: %{"text/plain" => HtmlSanitizeEx.strip_tags(object_data["content"])},
         spoiler_text: %{"text/plain" => HtmlSanitizeEx.strip_tags(object_data["summary"])},
         expires_at: nil,
-        direct_conversation_id: nil
+        direct_conversation_id: nil,
+        thread_muted: false
       }
     }
 
@@ -173,6 +174,24 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
     assert status.muted == true
   end
 
+  test "tells if the message is thread muted" do
+    user = insert(:user)
+    other_user = insert(:user)
+
+    {:ok, user} = User.mute(user, other_user)
+
+    {:ok, activity} = CommonAPI.post(other_user, %{"status" => "test"})
+    status = StatusView.render("status.json", %{activity: activity, for: user})
+
+    assert status.pleroma.thread_muted == false
+
+    {:ok, activity} = CommonAPI.add_mute(user, activity)
+
+    status = StatusView.render("status.json", %{activity: activity, for: user})
+
+    assert status.pleroma.thread_muted == true
+  end
+
   test "tells if the status is bookmarked" do
     user = insert(:user)