Skip to content

Conversation

@rosset-nocpes
Copy link
Contributor

@rosset-nocpes rosset-nocpes commented Jul 6, 2024

Генерує логи модерації

Tasklist

@rosset-nocpes rosset-nocpes marked this pull request as ready for review July 7, 2024 21:16
@rosset-nocpes
Copy link
Contributor Author

Тести не пройшли через не до кінця видалену роль ROLE_RESTRICTED

@kuyugama
Copy link
Member

kuyugama commented Feb 7, 2025

Тести не пройшли через не до кінця видалену роль ROLE_RESTRICTED

Можна знов залити зміни з main в цю гілку, тепер ця роль остаточно видалена. Також, варто виправити проблеми із сумісністю з main гілкою

@rosset-nocpes
Copy link
Contributor Author

@kuyugama Тепер немає конфліктів, буду вдячний якщо зробиш code review

"bad-backup-token": ["Bad backup token", 401],
},
"moderation-log": {
"no-access": ["You do not have permission to access", 400],
Copy link
Member

Choose a reason for hiding this comment

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

There are permission check in auth_requied dependency with its permission error, why creating new?

async def validate_moderation_role(
author: User = Depends(auth_required(optional=False)),
):
if author.role not in ["admin", "moderator"]:
Copy link
Member

Choose a reason for hiding this comment

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

Instead of checking roles, you should add permission and check by it using auth_required. If you need custom error, you can add parameter for it into auth_required

Comment on lines +26 to +39
async def get_edit(session, content_id):
return await session.scalar(select(Edit).filter(Edit.id == content_id))


async def get_comment(session, content_id):
return await session.scalar(
select(Comment).filter(Comment.id == content_id)
)


async def get_collection(session, content_id):
return await session.scalar(
select(Collection).filter(Collection.id == content_id)
)
Copy link
Member

Choose a reason for hiding this comment

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

You need to load author fields using options method on select query object

@kuyugama kuyugama changed the title feat(moderation-log) Moderation logs Feb 8, 2025
@kuyugama kuyugama added the enhancement New feature or request label Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants