Skip to content

Bug: getting an email template by label #537

Description

@mabiede

When storing the email templates with the additional language argument, it's possible to get an error when using the EmailTemplate.get_by_label function (without passing the language argument).

It allows e.g. creating a template for multiple languages with the same label. But when reading them without the language argument you'd receive a list and not Sihl_email.Template.t option Lwt.t as it is now.

This is an edge case and could be a wanted exception. Either both (create and get) have to use the language argument or neither of them. (Sorry, I missed adding this test)

I'd suggest keeping the signature and writing a warning to the console, that the function was called without the needed language argument (and returning Lwt.return_none).

@joseferben ping

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions