umputun / remark42

comment engine
https://remark42.com
MIT License
4.84k stars 376 forks source link

RSS: Fix snippet generation for parent comment #1643

Closed koteyur closed 1 year ago

koteyur commented 1 year ago

PR fixes the following issues with snippet generation for parent comments in RSS (couldn't find existing issues to tag them...):

1) Current implementation simply removes the last word, without truncating up to limit length. 2) In case if even the first word (e.g. magnet link or some base64) is too long don't add extra space.

STR: 1) Run dev version (https://remark42.com/docs/contributing/backend/) 2) Write very long comment (chatgpt helps :)) 3) Reply to the comment 4) Check RSS

ER: Text of original comment in reply item is truncated to 300 chars.

AR: Only the last word is truncated.

koteyur commented 1 year ago

It looks like new version of golangci-lint found some issues in existing code:

  Error: httpNoBody: http.NoBody should be preferred to the nil request body (gocritic)
  Error: httpNoBody: http.NoBody should be preferred to the nil request body (gocritic)
  Error: httpNoBody: http.NoBody should be preferred to the nil request body (gocritic)