Skip to content

Conversation

@vivekashok1221
Copy link
Member

@vivekashok1221 vivekashok1221 commented Dec 31, 2022

Closes #801 .

Related bot issue: python-discord/bot#2329
Related bot PR: python-discord/bot#2372

@netlify
Copy link

netlify bot commented Dec 31, 2022

Deploy Preview for pydis-static ready!

Name Link
🔨 Latest commit ed35776
🔍 Latest deploy log https://app.netlify.com/sites/pydis-static/deploys/640b6fe1a57d180007a36b9e
😎 Deploy Preview https://deploy-preview-824--pydis-static.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@coveralls
Copy link

coveralls commented Dec 31, 2022

Coverage Status

Coverage: 100.0%. Remained the same when pulling ed35776 on vivek/add-jump-url-field into 646b346 on main.

Copy link
Member

@shtlrs shtlrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is purely a code review, will test later!
Thanks for the PR vivek ! :D

('api', '0085_infraction_jump_url_text'),
]

operations = [
Copy link
Member

@shtlrs shtlrs Dec 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file supposed to exist ?
It looks like it came from a merge, but it's strange since the two dependencies have the same identifier.
I think deleting these 2 & making a new migration would be cleaner

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file's the result of running python manage.py makemigrations --merge.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, I didn't know this existed.
Don't you think it'd be cleaner to have a separate one, with a different id ? instead of this merged format ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar merged migration files already exist in the project so imo it's fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that's one way to view this.
Even though I don't fully agree, since having something that can or could've been improved doesn't mean we should do it again.
I think the conflict happened because of the migration I did on the nominations table, which has already been merged into main 2 days ago.
And the conflict happened just on the naming, and not on the model itself, and I still think it should be done on its own.

We can wait for others to see what they think about this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration files are not for humans anyway. However, I've gone ahead and generated a new migration file.

help_text="Whether a DM was sent to the user when infraction was applied."
)

jump_url_text = models.CharField(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to store the raw URL in the database ? And do the formatting on the bot's side ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was initially doing what you described but changed to this because it looked cleaner bot-side. But I'll do what you're suggesting because it will be more modular.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@wookie184 wookie184 added area: API Related to or causes API changes type: feature New feature or request s: waiting for author Waiting for author to address a review or respond to a comment area: moderation Related to community moderation functionality: (moderation, defcon, verification) labels Jan 14, 2023
@vivekashok1221 vivekashok1221 force-pushed the vivek/add-jump-url-field branch from 9efa584 to 8a95402 Compare February 17, 2023 06:13
@vivekashok1221 vivekashok1221 added s: needs review Author is waiting for someone to review and approve and removed s: waiting for author Waiting for author to address a review or respond to a comment labels Feb 17, 2023
@vivekashok1221 vivekashok1221 changed the title Add jump_url_text field to infraction model Add jump_url field to infraction model Feb 17, 2023
Copy link
Contributor

@wookie184 wookie184 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


jump_url = models.CharField(
default='',
max_length=88,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty tight, I can't think of any valid reason it should be longer than this so I guess it's fine though...

)

jump_url = models.CharField(
default='',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason behind using an empty string here, rather than making it nullable?

Copy link
Member Author

@vivekashok1221 vivekashok1221 Feb 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@vivekashok1221 vivekashok1221 Mar 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now replaced CharField with URLField and added null=True in ed35776.

Copy link
Member

@jchristgit jchristgit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 🇮🇹

@shtlrs shtlrs merged commit 306855f into main Mar 12, 2023
@shtlrs shtlrs deleted the vivek/add-jump-url-field branch March 12, 2023 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: API Related to or causes API changes area: moderation Related to community moderation functionality: (moderation, defcon, verification) s: needs review Author is waiting for someone to review and approve type: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add field to Infraction model for jump link to infraction message.

7 participants