fix
This commit is contained in:
parent
082bd1e4a7
commit
67e58c2dda
32
tasks.ipynb
32
tasks.ipynb
@ -69,20 +69,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"async def notify_in_profile(item: NotifyItem):\n",
|
||||
" user = await users_collection.find_one({'_id': ObjectId(str(item.user_id))},{'email':1})\n",
|
||||
" login_link = f'{FULL_DOMAIN}/login/{await token_create(str(user['_id']), url=f'/profile')}'\n",
|
||||
" if PROD:\n",
|
||||
" email_task.notify.delay(user['email'], {\n",
|
||||
" 'text': item.text,\n",
|
||||
" 'list': [[]],\n",
|
||||
" 'primary': {\n",
|
||||
" 'href': login_link,\n",
|
||||
" 'text': 'Войти и посмотреть'\n",
|
||||
" },\n",
|
||||
" 'title': item.title,\n",
|
||||
" 'login_link': login_link,\n",
|
||||
" }, 'Уведомление', 'main.html')\n",
|
||||
" return await notify_collection.update_one(\n",
|
||||
" doc = await notify_collection.update_one(\n",
|
||||
" {\n",
|
||||
" \"user_id\": item.user_id,\n",
|
||||
" \"type\": item.type_item,\n",
|
||||
@ -102,7 +89,22 @@
|
||||
" }\n",
|
||||
" },\n",
|
||||
" upsert=True,\n",
|
||||
" )\n"
|
||||
" )\n",
|
||||
" if doc.upserted_id:\n",
|
||||
" user = await users_collection.find_one({'_id': ObjectId(str(item.user_id))},{'email':1})\n",
|
||||
" login_link = f'{FULL_DOMAIN}/login/{await token_create(str(user['_id']), url=f'/profile')}'\n",
|
||||
" if PROD:\n",
|
||||
" email_task.notify.delay(user['email'], {\n",
|
||||
" 'text': item.text,\n",
|
||||
" 'list': [[]],\n",
|
||||
" 'primary': {\n",
|
||||
" 'href': login_link,\n",
|
||||
" 'text': 'Войти и посмотреть'\n",
|
||||
" },\n",
|
||||
" 'title': item.title,\n",
|
||||
" 'login_link': login_link,\n",
|
||||
" }, 'Уведомление', 'main.html')\n",
|
||||
" return doc\n"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
},
|
||||
|
||||
30
tasks.py
30
tasks.py
@ -12,20 +12,7 @@ import asyncio
|
||||
|
||||
|
||||
async def notify_in_profile(item: NotifyItem):
|
||||
user = await users_collection.find_one({'_id': ObjectId(str(item.user_id))},{'email':1})
|
||||
login_link = f'{FULL_DOMAIN}/login/{await token_create(str(user['_id']), url=f'/profile')}'
|
||||
if PROD:
|
||||
email_task.notify.delay(user['email'], {
|
||||
'text': item.text,
|
||||
'list': [[]],
|
||||
'primary': {
|
||||
'href': login_link,
|
||||
'text': 'Войти и посмотреть'
|
||||
},
|
||||
'title': item.title,
|
||||
'login_link': login_link,
|
||||
}, 'Уведомление', 'main.html')
|
||||
return await notify_collection.update_one(
|
||||
doc = await notify_collection.update_one(
|
||||
{
|
||||
"user_id": item.user_id,
|
||||
"type": item.type_item,
|
||||
@ -46,6 +33,21 @@ async def notify_in_profile(item: NotifyItem):
|
||||
},
|
||||
upsert=True,
|
||||
)
|
||||
if doc.upserted_id:
|
||||
user = await users_collection.find_one({'_id': ObjectId(str(item.user_id))},{'email':1})
|
||||
login_link = f'{FULL_DOMAIN}/login/{await token_create(str(user['_id']), url=f'/profile')}'
|
||||
if PROD:
|
||||
email_task.notify.delay(user['email'], {
|
||||
'text': item.text,
|
||||
'list': [[]],
|
||||
'primary': {
|
||||
'href': login_link,
|
||||
'text': 'Войти и посмотреть'
|
||||
},
|
||||
'title': item.title,
|
||||
'login_link': login_link,
|
||||
}, 'Уведомление', 'main.html')
|
||||
return doc
|
||||
|
||||
|
||||
async def email_new_post(new_post: Dict):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user