From d8bed0ff635d99bcd75207e5ee78fac6d3f186a4 Mon Sep 17 00:00:00 2001 From: provable_ascent Date: Thu, 27 Apr 2023 05:22:12 +0000 Subject: [PATCH] Make UserNote comment default to the empty string. This make the behavior consistent between when UserNote doesn't exist and when comment is null. The current behavior may return null in APIs, which misleads some clients doing feature detection into thinking the server does not support comments. For example, see https://codeberg.org/husky/husky/issues/92 --- lib/pleroma/user_note.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/user_note.ex b/lib/pleroma/user_note.ex index 5e82d359f..ff4981cb7 100644 --- a/lib/pleroma/user_note.ex +++ b/lib/pleroma/user_note.ex @@ -31,7 +31,7 @@ def show(%User{} = source, %User{} = target) do UserNote |> where(source_id: ^source.id, target_id: ^target.id) |> Repo.one() do - note.comment + note.comment || "" else _ -> "" end