matrix-org / matrix-hookshot

A bridge between Matrix and multiple project management services, such as GitHub, GitLab and JIRA.
https://matrix-org.github.io/matrix-hookshot/
Apache License 2.0
289 stars 68 forks source link

[RSS bot] Support <comments> #887

Open opk12 opened 9 months ago

opk12 commented 9 months ago

While <link> is the main news URL, <comments> is the optional URL of the comments associated with the news. https://www.rssboard.org/rss-specification#ltcommentsgtSubelementOfLtitemgt

What about a variable $COMMENTS to expose it?

Additional context

Lemmy is like Reddit, a forum that associates a discussion thread with an optional (external, non-Lemmy) news URL. I have not checked Reddit yet, but in Lemmy

  1. the URL of a discussion thread with a news goes into <comments> and the news URL goes into <link>;
  2. the URL of a discussion thread without a news goes into <comments> and <link>.

This is an explicit decision at Lemmy, in light of the RSS spec linked above.

For example, today this community has È online l'Archivio... for case 1 and Sono stati pubblicati gli Atti... for case 2, and its RSS is here.

Use case

At our community (OpenStreetMap Italia), we want Matrix to always see the discussion thread. It provides context and clarification, and the news URL itself may already have been mentioned in the chat anyway. The Lemmy interface makes it easy to reach the news article from the discussion thread (just click the thread title) but clearly the inverse is not possible (the news artcle is not aware of Lemmy).

Half-Shot commented 8 months ago

Thanks for creating an issue, this should be trivial to do. Essentially this is modifying https://github.com/matrix-org/matrix-hookshot/blob/main/src/feeds/parser.rs to return a comments entry (and https://github.com/matrix-org/matrix-hookshot/blob/main/src/feeds/FeedReader.ts#L51), and then a switch in https://github.com/matrix-org/matrix-hookshot/blob/main/src/Connections/FeedConnection.ts#L150.

If someone wants to pick this up as a PR, then it would be massively appreciated. Otherwise, it'll be whenever I next have a window to work on Hookshot.