Coursemology/coursemology2

View on GitHub
app/views/notifiers/course/forum/post_notifier/replied/user_notifications/email.html.slim

Summary

Maintainability
Test Coverage
- post = @object
- topic = post.topic.actable
- course = topic.course
- course_user = CourseUser.find_by(course: course, user: post.creator)
- host = course.instance.host
- unsubscribe_url = course_forum_topic_url(course, topic.forum, topic, host: host, subscribe_topic: false)

- course_title = format_inline_text(course.title)
- topic_title = format_inline_text(topic.title)
- post_author = post.is_anonymous ? t('notifiers.course.anonymous_user') : format_inline_text(post.author_name)

- message.subject = t('.subject', course: course_title, topic: topic_title)
- message.subject += ' ' + t('notifiers.course.phantom') if course_user&.phantom?

= format_html(t('.message',
                topic: link_to(topic_title,
                               course_forum_topic_url(course, topic.forum, topic, host: host)),
                post: post.text_to_email,
                post_author: post_author))

= simple_format(t('.unsubscribe.message',
                unsubscribe_link: link_to(t('.unsubscribe.tag'), unsubscribe_url)))