Skip to content

Commit

Permalink
[Updates📢] Removed sending of emails of newly created recipes to subs…
Browse files Browse the repository at this point in the history
…cribed users, for now.
  • Loading branch information
[esekyi] committed Sep 19, 2024
1 parent 1f2a45b commit 532c65d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/routes/recipe_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ def add_recipe():
user_id = current_user.id
new_recipe = create_recipe(data, user_id, ingredients, instructions, send_url)

domain = request.host_url
recipe_link = url_for('recipe_routes.view_recipe', recipe_id=new_recipe.id, _external=True)

subscribers = Subscriber.query.filter_by(is_active=True).all()
for subscriber in subscribers:
unsubscribe_link = f'{domain}/unsubscribe?email={subscriber.email}'
try:
send_newsletter_email(user=subscriber, recipe=new_recipe, recipe_link=recipe_link, unsubscribe_link=unsubscribe_link)
except Exception as e:
flash(f"Something occured on our side: {str(e)}", "error")
# domain = request.host_url
# recipe_link = url_for('recipe_routes.view_recipe', recipe_id=new_recipe.id, _external=True)

# subscribers = Subscriber.query.filter_by(is_active=True).all()
# for subscriber in subscribers:
# unsubscribe_link = f'{domain}/unsubscribe?email={subscriber.email}'
# try:
# send_newsletter_email(user=subscriber, recipe=new_recipe, recipe_link=recipe_link, unsubscribe_link=unsubscribe_link)
# except Exception as e:
# flash(f"Something occured on our side: {str(e)}", "error")

flash("Recipe created successfully!", 'success')
return redirect(url_for('recipe_routes.list_recipes'))
Expand Down

0 comments on commit 532c65d

Please sign in to comment.