Skip to content

Commit

Permalink
fix notify_uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnBe committed Nov 13, 2024
1 parent ed821b2 commit d8e6b15
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions bioimageio_collection_backoffice/mailroom/send_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,25 @@


def notify_uploader(rv: Union[RecordDraft, Record], subject_end: str, msg: str):
email, name = rv.get_uploader()
if email is None:
raise ValueError("missing uploader email")
uploader = rv.get_uploader()

subject = f"{STATUS_UPDATE_SUBJECT}{rv.id} {rv.version} {subject_end.strip()}"
if email == BOT_EMAIL:
if uploader.email == BOT_EMAIL:
logger.info("skipping email '{}' to {}", subject, BOT_EMAIL)
return

send_email(
subject=subject,
body=(
f"Dear {name},\n"
f"Dear {uploader.name},\n"
+ f"{msg.strip()}\n"
+ "Kind regards,\n"
+ "The bioimage.io bot 🦒\n"
+ REPLY_HINT
).replace(
"\n", "\n\n" # respect newlines in markdown
),
recipients=[email],
recipients=[uploader.email],
)


Expand Down

0 comments on commit d8e6b15

Please sign in to comment.