module ActivityHelper def activity_truncate(message, len = Constants::NAME_TRUNCATION_LENGTH) activity_title = message.match(/(.*?)<\/strong>/)[1] if activity_title.length > Constants::NAME_TRUNCATION_LENGTH title = "" else title = truncate(activity_title, length: len) end message = message.gsub(/#{activity_title}/, title ) sanitize_input(message) if message end def days_since_1970(dt) dt.to_i / 86400 end end