Skip to content

Conversation

@vivekashok1221
Copy link
Member

@vivekashok1221 vivekashok1221 commented Dec 31, 2022

Closes #2329 .

Related site issue: python-discord/site#801
Related site PR: python-discord/site#824

screenshots:

Infraction log:
image

#mod-logs embed:
image

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.

A couple of nit changes here and there but I haven't tested this yet.

@wookie184 wookie184 added a: frontend Related to output and formatting a: moderation Related to community moderation functionality: (moderation, defcon, verification) s: waiting for author Waiting for author to address a review or respond to a comment labels Jan 14, 2023
@vivekashok1221 vivekashok1221 force-pushed the vivek/jump-url-infr-log branch from ac3fdc9 to c6af8bf Compare February 13, 2023 21:19
@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
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

is_in_category(ctx.channel, category)
for category in (Categories.modmail, Categories.appeals, Categories.appeals2)
):
jump_url = "Infraction issued in a ModMail channel."
Copy link
Member

Choose a reason for hiding this comment

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

Either something has a jump link or it doesn't, storing a string in here too means we can't have a validator on the db that it's a valid link.

IMO we should have a validator on site that requires it to be formatted as a link, or null.

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 could be misremembering but Ive read somewhere (django docs or stackoverflow) that using blank strings is recommended by django ORM. I can look for the link later.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe it's just a convention.

Copy link
Member Author

Choose a reason for hiding this comment

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

And regarding the validator, I could use URLField instead of CharField because it has URL validation.

Copy link
Member

Choose a reason for hiding this comment

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

A URLField that can be blank/null sounds good to me

Comment on lines 424 to 429
if jump_url == "":
# Infraction was issued prior to jump urls being stored in the database.
jump_url = "N/A"
elif "discord.com" in jump_url:
jump_url = f"[Click here.]({jump_url})"
# Else, infraction was issued in ModMail category.
Copy link
Member

Choose a reason for hiding this comment

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

This would be simplified if we went with the "it's either a link or null"

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I did think of that.

@Robin5605
Copy link
Contributor

Have we considered a URL button for the embed? Or would that be too big?

@vivekashok1221
Copy link
Member Author

Have we considered a URL button for the embed? Or would that be too big?

Personally, I don't think it's necessary. I'm open to opinions though.

@shtlrs
Copy link
Member

shtlrs commented Mar 10, 2023

That would make two buttons at most in the same message when listing infractions. Then we lose context of which infraction does that button refer to, no? Which might become confusing.

Previously displayed "Infraction issued in modmail" for infractions in ModMail.
@vivekashok1221 vivekashok1221 added s: WIP Work In Progress and removed s: needs review Author is waiting for someone to review and approve labels Mar 11, 2023
@vivekashok1221
Copy link
Member Author

vivekashok1221 commented Mar 11, 2023

I will fix the tests as soon as I get some time but I'm not sure why the tests didn't fail during my earlier pushes. Might be random and may even disappear on re-running the tests- nevertheless, will try fixing.

Passes locally btw

$ poetry run task test

=============================== test session starts ================================
platform linux -- Python 3.10.9, pytest-7.2.0, pluggy-1.0.0
rootdir: /home/vivek/Programs/python/contrib/pydis/bot, configfile: pyproject.toml
plugins: subtests-0.9.0, xdist-3.0.2, cov-4.0.0
gw0 [473] / gw1 [473] / gw2 [473] / gw3 [473] / gw4 [473] / gw5 [473] / gw6 ok / gw7gw0 [473] / gw1 [473] / gw2 [473] / gw3 [473] / gw4 [473] / gw5 [473] / gw6 [473] / gw0 [473] / gw1 [473] / gw2 [473] / gw3 [473] / gw4 [473] / gw5 [473] / gw6 [473] / gw7 [473]
............................................................................ [ 16%]
............................................................................ [ 32%]
............................................................................ [ 48%]
............................................................................ [ 64%]
............................................................s............... [ 80%]
............................................................................ [ 96%]
.................                                                            [100%]
========================= 472 passed, 1 skipped in 20.26s ==========================

I'll retry after updating my branch.

@vivekashok1221 vivekashok1221 removed the s: WIP Work In Progress label Mar 11, 2023
@vivekashok1221 vivekashok1221 added the s: needs review Author is waiting for someone to review and approve label Mar 11, 2023
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.

🧙

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

Labels

a: frontend Related to output and formatting a: moderation Related to community moderation functionality: (moderation, defcon, verification) s: needs review Author is waiting for someone to review and approve

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add link to infaction message in infraction log

6 participants