Sending a private message without cc causes a 500 error
-
@freamon Update: no, Lemmy doesn't understand them either. It rejects Create / Note without a community with the usual "did not match any variant of untagged enum AnnouncableActivities"
-
FYI the next Lemmy version will use
Create/Note
for private messages. You can test it on voyager.lemmy.ml -
FYI the next Lemmy version will use
Create/Note
for private messages. You can test it on voyager.lemmy.ml@[email protected] thanks for the update! That's awesome to hear
-
@julian I've added support to PieFed to successfully receive Create / Note as a PM from NodeBB.
From Nutomic's PR, it looks like you'll continue you get Create / ChatMessage from them, as also you will from PieFed. This currently fails, as I guess that it converts them into a Create / Note, but then complains of there being no 'cc'.
It doesn't make sense for PMs to be 'carbon copied' to anyone, so I'll raise an Issue at your repo.
-
@freamon thanks! Happy to look into handling
Create(ChatMessage)
... I think the error aside, NodeBB would drop it anyway sinceChatMessage
isn't an expected post type. -
@julian Oh, I've just realised I read Nutomic's PR the wrong way around. After 2.0, you'll start getting Notes from them. If 'ChatMessage' processing isn't worth handling by NodeBB, I can change PieFed to send you Notes instead.
-
@freamon As others have said, ChatMessage is non-standard. The Create/Note is not particularly great for private messages, but whatever. Anyway, cc is not a required field of Note nor Create, so any software that would complain has a bug.
-
@rikudou Yeah, sorry, I didn't mean to derail this thread. The GitHub issue was intended to only really be about the 'cc' problem, because it looks like PieFed will have to start sending Create/Note to non-Lemmy platforms anyway, but it'd easier if 'cc' doesn't have to be artificially included to keep NodeBB happy.
-
In a bit of code that is too clever for my own good, I collapse
to
andcc
into a single deduplicated array with:const recipients = new Set([...object.to, ...object.cc]);
Which of course assumes that both properties are iterable. That has now been changed to an even clever-er (and less readable):
const recipients = new Set([...(object.to || []), ...(object.cc || [])]);
-
@julian Wouldn't
??
be better? -
@rikudou maybe? Nullish coalescing sounds really cool, but I've avoided it for years because of browser compatibility.
Node has had support forever (since v14, I've discovered), but I just don't know how to use it is all