ckolderup / postmarks

a single-user bookmarking website designed to live on the Fediverse

Home Page:https://postmarks.glitch.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Replies to bookmarks not being stored in database

jeffsikes opened this issue · comments

Hi! Really enjoying this platform and it's been a great way to learn more about ActivityPub.

When someone replies to my bookmark post, I noticed I wasn't getting any comments in the approval section. In fact, they weren't getting added at all.

No one else has mentioned this, but I've searched through other postmarkie sites and I don't see any publicly approved comments, at least.

After some debugging, I found that the ActvitiyPub inbox received the replies, but it was returning the response “couldn't find a bookmark this message is related to”.

This is what I found.

In the ActivityPub SqlLite database, the Guids were getting saved with the "m/" part of the url path along with the Guid in the messages.guid column. For example, m/ebff578a49b2095e94e8aa64c4c5d347

When a new comment comes in, it wasn't looking for the "m/" part and therefore failing to find the related post and get attached to.

It came down to this regex pattern in the src/activitypub.js file. When I updated it, new bookmarks now get saved excluding the “m/“, and the replies are matching to an entry and applied correctly. Below is the updated version.

return urlString.match(/m\/([a-zA-Z0-9+/]+)/)[1];

The updated version:

function getGuidFromPermalink(urlString) {

return urlString.match(/(?:\/m\/)([a-zA-Z0-9+/]+)/)[1];

}

I've made this change and will attach this issue to the pull request.

fixed by #142.