Skip to content

Commit

Permalink
Fix add admin email notification for lesson changes (#212)
Browse files Browse the repository at this point in the history
Co-authored-by: Konstantin Raikhert <[email protected]>
  • Loading branch information
anastasia-D and KonstantinRaikhert authored Aug 15, 2024
1 parent 59e5d08 commit 2e8768b
Show file tree
Hide file tree
Showing 14 changed files with 532 additions and 413 deletions.
7 changes: 4 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
EMAIL_HOST=smtp.yandex.ru
EMAIL_PORT=465
# реквизиты для аутентификации в почтовом сервисе
EMAIL_ACCOUNT=[email protected]
EMAIL_PASSWORD=your_yandex_smtp_password
EMAIL_HOST_USER=[email protected]
EMAIL_HOST_PASSWORD=your_yandex_smtp_password
EMAIL_USE_SSL=True
# в настройках аккаунта откуда отправляется письмо подключите протокол IMAP
# адрес по умолчанию для отправки вопросов от пользователей
DEFAULT_EMAIL_ADDRESS=NOT_SET
# Запустить бота
RUN_BOT=true
RUN_BOT=true
74 changes: 37 additions & 37 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: no-commit-to-branch
name: Check to see if a commit is pushed to a safe branch
- id: check-toml
name: Check the files with `.toml` format
- id: check-yaml
name: Check the files with `.yaml` format
args: ['--allow-multiple-documents']
- id: end-of-file-fixer
name: Check for an empty line at the end of a file
- id: trailing-whitespace
name: Check for unnecessary white space
args: ['--markdown-linebreak-ext=md']
- id: check-docstring-first
name: Check docstrings location in python files
- id: check-merge-conflict
name: Сheck for no conflicts in the branch

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.2
hooks:
- id: ruff
types_or: [ python ]
#TODO К ruff подключить одинарные кавычки
# - id: ruff-format
# types_or: [ python ]

- repo: local
hooks:
- id: export-dev-dependencies
name: Export development dependencies
language: system
pass_filenames: false
entry: poetry lock
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: no-commit-to-branch
name: Check to see if a commit is pushed to a safe branch
- id: check-toml
name: Check the files with `.toml` format
- id: check-yaml
name: Check the files with `.yaml` format
args: ['--allow-multiple-documents']
- id: end-of-file-fixer
name: Check for an empty line at the end of a file
- id: trailing-whitespace
name: Check for unnecessary white space
args: ['--markdown-linebreak-ext=md']
- id: check-docstring-first
name: Check docstrings location in python files
- id: check-merge-conflict
name: Сheck for no conflicts in the branch

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.2
hooks:
- id: ruff
types_or: [ python ]
#TODO К ruff подключить одинарные кавычки
# - id: ruff-format
# types_or: [ python ]

- repo: local
hooks:
- id: export-dev-dependencies
name: Export development dependencies
language: system
pass_filenames: false
entry: poetry lock
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/bot/handlers/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ async def feedback(update: Update, context: CallbackContext):

if user:
context.user_data['current_user'] = user
telegram_username = update.effective_chat.username
if telegram_username:
context.user_data[
'current_user_telegram_username'
] = telegram_username
await update.message.reply_text(
text=FEEDBACK_REMOVE_SUPPORT_KEYBOARD_MSG,
reply_markup=ReplyKeyboardRemove(),
Expand All @@ -51,8 +56,12 @@ async def body(update: Update, context: CallbackContext):
subject = context.user_data['subject']
body = context.user_data['body']
user = context.user_data['current_user']
if 'current_user_telegram_username' in context.user_data:
telegram_username = context.user_data['current_user_telegram_username']
else:
telegram_username = None

await send_feedback_email(subject, body, user)
await send_feedback_email(subject, body, user, telegram_username)

await update.message.reply_text(FEEDBACK_SUCCESS_MSG)
return UserStates.START
Expand Down
Loading

0 comments on commit 2e8768b

Please sign in to comment.