★ wanayoo — archive 1999 https://github.com/python-discord/site/pull/289Nouvelle recherche | Portail wanayoo
Skip to content
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

Improvements to Admin pages for the API Section #289

Open
wants to merge 11 commits into
base: master
from

Conversation

@scragly
Copy link
Member

scragly commented Oct 19, 2019

I've added some QOL adjustments to the admin pages by defining ModelAdmin objects for most of the API section's models:

Message Deletion

Deleted Messages can now be searched by:

  • message content and id
  • author name and id
  • actor name and id

Fields have been made read-only, as they're logs, not a setting to be changed. This also speeds up load time as there's no user dropboxes to populate.

The log view on the staff subdomain is linked now in both the context page and the individual message page.

Embed data is now more cleanly formatted for readability.

Deleted message page screenshot:
image

Context page screenshot:
image

Infractions

Infractions list now shows details in each listing; type, user, actor, inserted_at, expires_at, reason and active.

You can search infractions by:

  • infraction id
  • target name and id
  • actor name and id
  • reason content
  • type

The list can be filtered now by:

  • type
  • hidden
  • active status

The following fields have been made read-only on the page:

  • user
  • actor
  • type
  • inserted_at

You can still edit on the page:

  • reason
  • expiry
  • active
  • hidden

The reason for doing this is to avoid accidents, improve loading by not having to populate two member dropdowns and to improve appearance a bit.

Infractions list screenshot:
image

Infractions item page screenshot:
image

Nominations

Nominations now show additional info on the list view: user, active, reason, actor, inserted_at and ended_at.

You can search the list by:

  • actor name and id
  • user name and id
  • reason content

You can now filter the list by active status.

On the item page, the ordering of items has been tweaked, and the following items have been made read-only:

  • user
  • active
  • actor
  • inserted_at
  • ended_at

Both reason and end_reason are still editable on the page.

Nomination list screenshot:
image

Nomination item page screenshot:
image

Off-Topic Names

Off topic names can now be searched by name.

Roles

Roles are now sorted by position, same as in discord.

They can now be searched by role name or role id.

All the role fields are set to read-only to avoid mistakes as it's only meant to be changed by the bot on sync or edit.

I've adjusted the order of fields in the item page a bit for presentation.

The permissions value link to the Discord API Permissions Calc page to show all the permissions (example: https://discordapi.com/permissions.html#104308297).

The colour field now shows both int and #hex, while also being styled as the set colour.

Role item page screenshot:
image

Tags

Tags can now be searched by tag name and tag content.

The tag item page now shows a preview of the tag with rendered markdown.

Tag item page screenshot:
image

API User

Users are now able to be searched by:

  • id
  • name
  • role name
  • role id

The user list can be filtered by "in guild" status, or by certain staff roles; owners, admins, moderators, core developers, helpers.

All fields in the user item page are now read-only, as they should be changed only by bot on sync or edit.

Roles are now viewed as a comma separated list, ordered by highest position to lowest.

User list screenshot:
image

User item page screenshot:
image

Copy link
Member

SebastiaanZ left a comment

Is there a way to make certain fields optional in the Admin back-end? If you, say, edit a note infraction, you won't be able to save your changes unless you set an expiry date.

2019-10-25_17-15

I think that would be an improvement as well.

@fiskenslakt
Copy link
Member

fiskenslakt commented Oct 27, 2019

I'm in the middle of thoroughly testing this branch as I populate my local database, and I've run into an odd bug. Please tell me if you can reproduce it.

Steps to reproduce:

  1. Go to /admin/api/tag/f-strings/change/ on production site and copy the JSON content inside the embed field.
  2. Go to /admin/api/tag/ on your local development site and create a new tag with the ADD TAG + button
  3. Enter a title for the tag
  4. Paste in the copied JSON into the embed field
  5. Click the Save and continue editing button

Expected behavior:

  1. Tag is saved
  2. Edit tag screen is displayed and tag markdown is rendered

What I got instead:

  1. Tag is saved
  2. Django raises a KeyError: snake
@jb3 jb3 requested review from python-discord/core-developers, AnonGuy and MrHemlock and removed request for python-discord/core-developers Feb 2, 2020
@lemonsaurus
Copy link
Member

lemonsaurus commented Mar 10, 2020

@scragly any idea when you'll be able to address the reviews here?

@scragly
Copy link
Member Author

scragly commented Mar 10, 2020

Tonight maybe. I only just got the local copy going again today.

@lemonsaurus
Copy link
Member

lemonsaurus commented Mar 10, 2020

excellent. thanks for the quick reply.

@lemonsaurus
Copy link
Member

lemonsaurus commented Aug 26, 2020

@scragly This pull request is very stale. It looks like it's like 98% done, so it'd be a shame to have to close it. I really wish you'd find some time to finish it, but otherwise I'm considering whether we should just merge it even with the reviews unaddressed. I mean, having this feature with a few bugs is probably better than never having it.

@scragly
Copy link
Member Author

scragly commented Aug 26, 2020

I should have a bit of time today to address the reviews and to bring the changes up to date with master. I'll try jump on after breakfast too get it sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.