ChatMessageReferenceView: Return read status as `unread`.
authorlain <lain@soykaf.club>
Wed, 3 Jun 2020 16:58:58 +0000 (18:58 +0200)
committerlain <lain@soykaf.club>
Wed, 3 Jun 2020 16:58:58 +0000 (18:58 +0200)
lib/pleroma/web/pleroma_api/views/chat_message_reference_view.ex
test/web/pleroma_api/views/chat_message_reference_view_test.exs

index ff170e162f6998acb03bb0323176617f110dded5..f9405aec5ff9508e119eac22ad667b499aa01106 100644 (file)
@@ -30,7 +30,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageReferenceView do
       attachment:
         chat_message["attachment"] &&
           StatusView.render("attachment.json", attachment: chat_message["attachment"]),
-      seen: seen
+      unread: !seen
     }
   end
 
index 00024d52cbb2f36dc96c645784f1c7d83a65e2a1..b53bd349071763fd4e64feec5d1fc8751c4d6e6d 100644 (file)
@@ -40,7 +40,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageReferenceViewTest do
     assert chat_message[:account_id] == user.id
     assert chat_message[:chat_id]
     assert chat_message[:created_at]
-    assert chat_message[:seen] == true
+    assert chat_message[:unread] == false
     assert match?([%{shortcode: "firefox"}], chat_message[:emojis])
 
     {:ok, activity} = CommonAPI.post_chat_message(recipient, user, "gkgkgk", media_id: upload.id)
@@ -57,6 +57,6 @@ defmodule Pleroma.Web.PleromaAPI.ChatMessageReferenceViewTest do
     assert chat_message_two[:account_id] == recipient.id
     assert chat_message_two[:chat_id] == chat_message[:chat_id]
     assert chat_message_two[:attachment]
-    assert chat_message_two[:seen] == false
+    assert chat_message_two[:unread] == true
   end
 end