Add error message for invalid Newsletter user segment

Instead of the name of the User Segment we'll display an error message
This commit is contained in:
Bertocq
2018-02-21 01:02:51 +01:00
parent 7dfa056fe0
commit 38f7a222f5
5 changed files with 12 additions and 2 deletions

View File

@@ -4,4 +4,12 @@ module UserSegmentsHelper
[t("admin.segment_recipient.#{user_segment_name}"), user_segment_name]
end
end
def segment_name(user_segment)
if user_segment && UserSegments.respond_to?(user_segment)
I18n.t("admin.segment_recipient.#{user_segment}")
else
I18n.t("admin.segment_recipient.invalid_recipients_segment")
end
end
end