Skip to content

Commit

Permalink
Merge pull request #3996 from thematters/feat/truncate-link
Browse files Browse the repository at this point in the history
feat(editor): truncate long link text on put comment
  • Loading branch information
robertu7 authored Jun 14, 2024
2 parents 448f48b + f30708b commit a708222
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@keyv/redis": "^2.6.1",
"@matters/apollo-response-cache": "^2.0.0-alpha.0",
"@matters/ipns-site-generator": "^0.1.6",
"@matters/matters-editor": "^0.2.5-alpha.6",
"@matters/matters-editor": "^0.2.5-alpha.7",
"@matters/passport-likecoin": "^1.0.0",
"@matters/slugify": "^0.7.3",
"@sendgrid/helpers": "^7.7.0",
Expand Down
9 changes: 8 additions & 1 deletion src/mutations/comment/putComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
COMMENT_TYPE,
DB_NOTICE_TYPE,
MAX_ARTICLE_COMMENT_LENGTH,
MAX_CONTENT_LINK_TEXT_LENGTH,
NODE_TYPES,
USER_STATE,
} from 'common/enums'
Expand Down Expand Up @@ -77,7 +78,13 @@ const resolver: GQLMutationResolvers['putComment'] = async (
sanitizeHTML(content, {
maxHardBreaks: 0,
maxSoftBreaks: 1,
})
}),
{
truncate: {
maxLength: MAX_CONTENT_LINK_TEXT_LENGTH,
keepProtocol: false,
},
}
),
authorId: viewer.id,
}
Expand Down

0 comments on commit a708222

Please sign in to comment.