-
-
Notifications
You must be signed in to change notification settings - Fork 247
Limit issue body to 500 characters #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you for contributing to Python Discord! Please check out the following documents:
|
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.
Looks good to me, thanks for the contribution!
@@ -103,7 +103,7 @@ def format_embed(issue: Dict) -> discord.Embed: | |||
labels = [label["name"] for label in issue["labels"]] | |||
|
|||
embed = discord.Embed(title=title) | |||
embed.description = body | |||
embed.description = body[:500] + '....' if len(body) > 500 else body |
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’m being very picky, but would it be possible to use only 3 dots here? That’s what we usually use.
embed.description = body[:500] + '....' if len(body) > 500 else body | |
embed.description = body[:500] + '...' if len(body) > 500 else body |
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.
You should just use textwrap.shorten
instead.
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.
What is the motivation for 500
? The issue discusses that the embed description can be up to 2048
characters in length.
@kwzrd 500 is just a short number which I think is decent amount characters for embed descriptions. I agree this is opinionated, (large embeds just don't look good to me/I feel it's bad UX). So being pointed out, I'll limit it back to 2048 characters if that's agreeable. |
It's not necessarily a bad choice, if you think that |
@kwzrd Here are the screenshots you requested- |
@quanta-kt Thanks for the examples, I agree that 500 is a more sane value, especially since you can just click the link to read more. @Den4200 @Akarys42 Are you sure that If we just slice the string, we get to retain the newlines, e.g. this issue: |
Ahh right, I forgot that `textwrap.shorten` removes newlines. Good catch,
sorry @quanta-kt.
…On Tue, Oct 6, 2020 at 3:08 PM kwzrd ***@***.***> wrote:
@quanta-kt <https://github.com/quanta-kt> Thanks for the examples, I
agree that 500 is a more sane value, especially since you can just click
the link to read more.
------------------------------
@Den4200 <https://github.com/Den4200> @Akarys42
<https://github.com/Akarys42> Are you sure that textwrap.shorten is the
better choice here? The problem with it is that it removes newlines.
Consider this issue
<vJechsmayr/PythonAlgorithms#382>, which gets
formatted like so:
[image: image]
<https://user-images.githubusercontent.com/44734341/95248481-a3c81180-0817-11eb-93af-db65a0e07172.png>
If we just slice the string, we get to maintain the newlines, e.g. this
issue <BitByte-TPC/beginners-byte#3>:
[image: image]
<https://user-images.githubusercontent.com/44734341/95248661-e853ad00-0817-11eb-8d51-31a5426ba2dc.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#488 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMRF7T4OXNYECADS6BOKT63SJNTLLANCNFSM4SGFPGEQ>
.
|
TextWrapper apparently has a replace_whitespace keyword-arg but |
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.
Thanks for the contribution, it works great!
Before we merge this, we would be interested in cleaning up the history because there are 5 commits for a 1-line change. In practice, what we would want to do is only keep the first 2 commits, and drop the last 3. This is not your fault, as we told you to make a change and then asked you to revert it.
Are you familiar with git rebase
and would you feel confident trying to do this? If not, that's ok, a core dev can help you or do it for you.
Yes I am familiar with rebasing but still a little hesitant to do it, can you check this dummy PR here and confirm if that is how it should be looking like?
Also, shouldn't it get squashed into a single commit automatically if one chooses to "Squash and merge" on GitHub? |
Your dummy PR looks good, but you would want to keep the 2nd commit as well (reducing the dots from 4 to 3). I think there is an easier way, we actually don't need to rebase because we only need to drop the last 3 commits:
You can use
Yeah, we had a chat internally and we wanted to give you a chance to do it as it's both a good learning opportunity and also makes sure that the actual commits that get merged are authored by you, rather than the person who squashed them. |
Lovely, thank you! |
Relevant Issues
Closes #486
Description
This PR puts a limit on how long the response sent by the
.hacktoberissues
is going to be by limiting the issue body up to it's first 500 characters. This avoids http 400 errors (see #486 ) when dealing with issues with very long body.Did you:
pipenv lock
?pipenv run lint
)?