Skip to content

Commit

Permalink
Merge pull request #1909 from DSD-DBS/shared-contact-feedback-fix
Browse files Browse the repository at this point in the history
fix: Fix an issue where feedback that shared contact info was not sent
  • Loading branch information
MoritzWeber0 authored Oct 15, 2024
2 parents ce0f9de + 2ddf467 commit ac738c4
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 5 additions & 1 deletion backend/capellacollab/feedback/routes.py
Original file line number Diff line number Diff line change
@@ -73,7 +73,11 @@ def submit_feedback(
util.send_feedback_email,
db,
feedback,
feedback_user,
(
users_models.User.model_validate(feedback_user)
if feedback_user
else None
),
user_agent,
logger,
)
12 changes: 8 additions & 4 deletions backend/capellacollab/feedback/util.py
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ def check_if_feedback_is_allowed(db: orm.Session):

def format_email(
feedback: models.Feedback,
user: users_models.DatabaseUser | None,
user: users_models.User | None,
user_agent: str | None,
) -> email_models.EMailContent:
rating = feedback.rating.value
@@ -76,7 +76,7 @@ def format_email(

message_list.append("---")
message_list.append(
f"You receive this email because you're registered as feedback recipient in the "
f"You received this email because you're registered as feedback recipient in the "
f"Capella Collaboration Manager ({config.general.scheme}://{config.general.host}:{config.general.port})."
)
message_list.append(
@@ -105,14 +105,18 @@ def format_email(
def send_feedback_email(
db: orm.Session,
feedback: models.Feedback,
user: users_models.DatabaseUser | None,
user: users_models.User | None,
user_agent: str | None,
logger: logging.LoggerAdapter,
):
check_if_feedback_is_allowed(db)
assert config.smtp # Already checked in previous function
cfg = config_core.get_global_configuration(db)

email_text = format_email(feedback, user, user_agent)
try:
email_text = format_email(feedback, user, user_agent)
except Exception:
logger.exception("Error while formatting email.")
raise

email_send.send_email(cfg.feedback.recipients, email_text, logger)

0 comments on commit ac738c4

Please sign in to comment.