-
Notifications
You must be signed in to change notification settings - Fork 61
fix: removed the 10 white space infront of the issue's text #779
Conversation
✅ Deploy Preview for ubiquibot-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't seem to implement ignore-children
like it was stated in the issue
src/handlers/payout/post.ts
Outdated
@@ -398,7 +398,7 @@ const calculateRewardValue = (comments: Record<string, string[]>, incentives: In | |||
const reward = wordReward.mul(value.map((str) => str.trim().split(" ").length).reduce((totalWords, wordCount) => totalWords + wordCount, 0)); | |||
sum = sum.add(reward); | |||
} else { | |||
if (!incentives.comment.elements[key]) { | |||
if (!incentives.comment.elements[key] || incentives.comment.ignore_children.includes(key)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not desired functionality. this will only stop processing that particular item, but we want stop recursing when we encounter that item during parsing the markdown.
it basically replaces hardcoded variable:
ubiquibot/src/handlers/payout/post.ts
Line 18 in dba8308
const ItemsToExclude: string[] = [MarkdownItem.BlockQuote]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not desired functionality. this will only stop processing that particular item, but we want stop recursing when we encounter that item during parsing the markdown. it basically replaces hardcoded variable:
ubiquibot/src/handlers/payout/post.ts
Line 18 in dba8308
const ItemsToExclude: string[] = [MarkdownItem.BlockQuote];
ohhh my bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it basically replaces hardcoded variable:
Shouldn't we remove the hardcoded variable if we can handle from the config @whilefoo? If so, would you mind creating a new issue for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it basically replaces hardcoded variable:
Shouldn't we remove the hardcoded variable if we can handle from the config @whilefoo? If so, would you mind creating a new issue for that?
should i remove it? will replace it with incentive ignore children
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes more sense to handle in a new issue if whilefoo thinks its necessary. That way this one can be merged in faster, most likely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes more sense to handle in a new issue if whilefoo thinks its necessary. That way this one can be merged in faster, most likely.
sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we remove the hardcoded variable if we can handle from the config @whilefoo? If so, would you mind creating a new issue for that?
This issue is about this hardcoded variable, it stops recursing when it encounters one of the tags in this variable. So we just need to move it the config as ignore-children
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ubiquibot/src/helpers/comment.ts
Line 10 in 628c222
const traverse = (result: Record<string, string[]>, node: Node, itemsToExclude: string[]): Record<string, string[]> => { |
you should modify this function to still parse the element but not its children. For example currently if it's
ignore-children: code
it won't include code
item and its children, but we still want to include code
. Don't forget to resolve conflicts
@pavlovcik do we want to set some sensible default like ignore-children: blockquote, code, pre, a
Sensible defaults sounds like a good idea! |
sure |
src/helpers/comment.ts
Outdated
@@ -9,6 +9,7 @@ type Node = { | |||
|
|||
const traverse = (result: Record<string, string[]>, node: Node, itemsToExclude: string[]): Record<string, string[]> => { | |||
if (itemsToExclude.includes(node.nodeName)) { | |||
result[node.nodeName].push(node.nodeName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will cause an error if nodeName is not in the object yet
ubiquibot/src/helpers/comment.ts
Line 21 in 02deb96
if (node.childNodes && node.childNodes.length > 0) { |
I recommend to just adding a condition here like !itemsToExclude.includes(node.nodeName)
@whilefoo going to open a new pull req and push the changes in one commit its kinda messy rn |
4b1a374
to
02deb96
Compare
Resolves #772