Skip to content

Удаление своего комментария#113

Merged
Zimovchik merged 9 commits intomainfrom
Delete_comment
Apr 21, 2025
Merged

Удаление своего комментария#113
Zimovchik merged 9 commits intomainfrom
Delete_comment

Conversation

@ValeryEstal
Copy link
Copy Markdown
Contributor

Изменения

Детали реализации

Check-List

  • Вы проверили свой код перед отправкой запроса?
  • Вы написали тесты к реализованным функциям?
  • Вы не забыли применить форматирование black и isort для Back-End или Prettier для Front-End?

@github-actions
Copy link
Copy Markdown

💩 Code linting failed, use black and isort to fix it.

Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 28, 2025

Summary

Tests Skipped Failures Errors Time
50 0 💤 0 ❌ 0 🔥 12.613s ⏱️

@github-actions
Copy link
Copy Markdown

💩 Code linting failed, use black and isort to fix it.

Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread .github/workflows/review_code.py
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py Outdated
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py
@ValeryEstal ValeryEstal linked an issue Mar 28, 2025 that may be closed by this pull request
Comment thread rating_api/routes/comment.py
Comment thread rating_api/routes/comment.py Outdated
Comment on lines +310 to +311
if not has_delete_scope:
if comment.is_anonymous:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if not has_delete_scope and comment.is_anonymous:
    raise ForbiddenAction(Comment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Исправлено

Comment thread rating_api/routes/comment.py Outdated
if comment.is_anonymous:
raise ForbiddenAction(Comment)

if not has_delete_scope or comment.user_id != user.id:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Если нет права на удаление, то удалить можно только свой неанонимный комментарий
т.е.
если нет права на удаление и коммент анонимный или не твой то рейзим ошибку

if not has_delete_scope and (comment.is_anonymous or comment.user_id != user.id):
    raise ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

в целом одного этого условия хватит

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Исправлено

@github-project-automation github-project-automation Bot moved this from Backlog to In Progress in Viribus Team Apr 1, 2025
@github-actions
Copy link
Copy Markdown

💩 Code linting failed, use black and isort to fix it.

@github-actions
Copy link
Copy Markdown

💩 Code linting failed, use black and isort to fix it.

@github-actions
Copy link
Copy Markdown

💩 Code linting failed, use black and isort to fix it.

@github-actions
Copy link
Copy Markdown

💩 Code linting failed, use black and isort to fix it.

@Zimovchik Zimovchik merged commit 44c6e1b into main Apr 21, 2025
2 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Viribus Team Apr 21, 2025
@Zimovchik Zimovchik deleted the Delete_comment branch April 21, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Удаление своего комментария

3 participants