mentioning
This commit is contained in:
@@ -223,7 +223,9 @@
|
|||||||
"overflow-x" : "hidden",
|
"overflow-x" : "hidden",
|
||||||
"line-height" : $(data.ta).css("line-height"),
|
"line-height" : $(data.ta).css("line-height"),
|
||||||
"overflow-y" : "hidden",
|
"overflow-y" : "hidden",
|
||||||
"z-index" : -10
|
"z-index" : -10,
|
||||||
|
"color" : "transparent",
|
||||||
|
"visibility" : "hidden"
|
||||||
});
|
});
|
||||||
|
|
||||||
//console.log("createClone: ta width=",$(data.ta).css("width")," ta clientWidth=",data.ta.clientWidth, "scrollWidth=",data.ta.scrollWidth," offsetWidth=",data.ta.offsetWidth," jquery.width=",$(data.ta).width());
|
//console.log("createClone: ta width=",$(data.ta).css("width")," ta clientWidth=",data.ta.clientWidth, "scrollWidth=",data.ta.scrollWidth," offsetWidth=",data.ta.offsetWidth," jquery.width=",$(data.ta).width());
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class BlogpostsController < ApplicationController
|
|||||||
@post = Blogpost.new(post_params)
|
@post = Blogpost.new(post_params)
|
||||||
@post.user_author = current_user
|
@post.user_author = current_user
|
||||||
if @post.save
|
if @post.save
|
||||||
|
@post.send_new_mention_mail
|
||||||
redirect_to @post, notice: 'Post has been created.'
|
redirect_to @post, notice: 'Post has been created.'
|
||||||
else
|
else
|
||||||
flash[:alert] = "Error creating blogpost"
|
flash[:alert] = "Error creating blogpost"
|
||||||
@@ -32,7 +33,9 @@ class BlogpostsController < ApplicationController
|
|||||||
def update
|
def update
|
||||||
@post.user_editor = current_user
|
@post.user_editor = current_user
|
||||||
@post.attributes = post_params([:user_editor])
|
@post.attributes = post_params([:user_editor])
|
||||||
|
old_content = @post.content_was
|
||||||
if @post.save
|
if @post.save
|
||||||
|
@post.send_new_mention_mail(old_content)
|
||||||
redirect_to @post, notice: 'Post has been updated.'
|
redirect_to @post, notice: 'Post has been updated.'
|
||||||
else
|
else
|
||||||
flash[:alert] = "There was a problem while updating the post"
|
flash[:alert] = "There was a problem while updating the post"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class CommentsController < ApplicationController
|
|||||||
@comment.blogpost = Blogpost.find(params[:blogpost_id])
|
@comment.blogpost = Blogpost.find(params[:blogpost_id])
|
||||||
if @comment.save
|
if @comment.save
|
||||||
@comment.send_new_comment_mail
|
@comment.send_new_comment_mail
|
||||||
|
@comment.send_new_mention_mail
|
||||||
redirect_to blogpost_path(@comment.blogpost) + "#comment-#{@comment.id}", notice: 'Comment created!'
|
redirect_to blogpost_path(@comment.blogpost) + "#comment-#{@comment.id}", notice: 'Comment created!'
|
||||||
else
|
else
|
||||||
flash[:alert] = "Could not create comment."
|
flash[:alert] = "Could not create comment."
|
||||||
@@ -34,7 +35,9 @@ class CommentsController < ApplicationController
|
|||||||
if mod? || @comment.author.is?(current_user)
|
if mod? || @comment.author.is?(current_user)
|
||||||
@comment.user_editor = current_user
|
@comment.user_editor = current_user
|
||||||
@comment.attributes = comment_params
|
@comment.attributes = comment_params
|
||||||
|
old_content = @comment.content_was
|
||||||
if @comment.save
|
if @comment.save
|
||||||
|
@comment.send_new_mention_mail(old_content)
|
||||||
flash[:notice] = "Comment updated!"
|
flash[:notice] = "Comment updated!"
|
||||||
redirect_to blogpost_path(@comment.blogpost) + "#comment-#{@comment.id}"
|
redirect_to blogpost_path(@comment.blogpost) + "#comment-#{@comment.id}"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -9,22 +9,6 @@ class ForumthreadsController < ApplicationController
|
|||||||
def show
|
def show
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
|
||||||
if mod? || @thread.author.is?(current_user)
|
|
||||||
@thread.user_editor = current_user
|
|
||||||
@thread.attributes = (mod? ? thread_params([:sticky, :locked, :forum_id]) : thread_params)
|
|
||||||
if @thread.save
|
|
||||||
redirect_to @thread, notice: 'Post has been updated.'
|
|
||||||
else
|
|
||||||
flash[:alert] = "There was a problem while updating the post"
|
|
||||||
render action: "edit"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
flash[:alert] = "You are not allowed to edit this thread!"
|
|
||||||
redirect_to @thread
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -41,6 +25,7 @@ class ForumthreadsController < ApplicationController
|
|||||||
if @thread.can_write?(current_user)
|
if @thread.can_write?(current_user)
|
||||||
@thread.user_author = current_user
|
@thread.user_author = current_user
|
||||||
if @thread.save
|
if @thread.save
|
||||||
|
@thread.send_new_mention_mail
|
||||||
flash[:notice] = "Thread created!"
|
flash[:notice] = "Thread created!"
|
||||||
redirect_to forumthread_path( @thread)
|
redirect_to forumthread_path( @thread)
|
||||||
return
|
return
|
||||||
@@ -55,6 +40,23 @@ class ForumthreadsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if mod? || @thread.author.is?(current_user)
|
||||||
|
@thread.user_editor = current_user
|
||||||
|
@thread.attributes = (mod? ? thread_params([:sticky, :locked, :forum_id]) : thread_params)
|
||||||
|
old_content = @thread.content_was
|
||||||
|
if @thread.save
|
||||||
|
@thread.send_new_mention_mail(old_content)
|
||||||
|
redirect_to @thread, notice: 'Post has been updated.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "There was a problem while updating the post"
|
||||||
|
render action: "edit"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
flash[:alert] = "You are not allowed to edit this thread!"
|
||||||
|
redirect_to @thread
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if mod? || @thread.author.is?(current_user)
|
if mod? || @thread.author.is?(current_user)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class ThreadrepliesController < ApplicationController
|
|||||||
@reply.forumthread = thread
|
@reply.forumthread = thread
|
||||||
if @reply.save
|
if @reply.save
|
||||||
@reply.send_new_reply_mail
|
@reply.send_new_reply_mail
|
||||||
|
@reply.send_new_mention_mail
|
||||||
redirect_to forumthread_path(@reply.thread) + "#reply-#{@reply.id}", notice: 'Reply created!'
|
redirect_to forumthread_path(@reply.thread) + "#reply-#{@reply.id}", notice: 'Reply created!'
|
||||||
else
|
else
|
||||||
flash[:alert] = "Could not create reply."
|
flash[:alert] = "Could not create reply."
|
||||||
@@ -31,7 +32,9 @@ class ThreadrepliesController < ApplicationController
|
|||||||
def update
|
def update
|
||||||
@reply = Threadreply.find(params[:id])
|
@reply = Threadreply.find(params[:id])
|
||||||
if mod? || @reply.author.is?(current_user)
|
if mod? || @reply.author.is?(current_user)
|
||||||
|
old_content = @reply.content_was
|
||||||
if @reply.update_attributes(reply_params)
|
if @reply.update_attributes(reply_params)
|
||||||
|
@reply.send_new_mention_mail(old_content)
|
||||||
flash[:notice] = "Reply updated!"
|
flash[:notice] = "Reply updated!"
|
||||||
redirect_to forumthread_path(@reply.thread) + "#reply-#{@reply.id}"
|
redirect_to forumthread_path(@reply.thread) + "#reply-#{@reply.id}"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
module UsersHelper
|
module UsersHelper
|
||||||
require "open-uri"
|
require "open-uri"
|
||||||
|
|
||||||
|
def mentions(content)
|
||||||
|
words = content.scan(/@[a-zA-Z0-9_]{1,16}/)
|
||||||
|
words.map! do |w|
|
||||||
|
w[0] = ""
|
||||||
|
w
|
||||||
|
end
|
||||||
|
User.where(ign: words).uniq!
|
||||||
|
end
|
||||||
|
|
||||||
def get_youtube(yt_name)
|
def get_youtube(yt_name)
|
||||||
yt = {channel: yt_name}
|
yt = {channel: yt_name}
|
||||||
|
|||||||
@@ -16,18 +16,42 @@ class RedstonerMailer < ActionMailer::Base
|
|||||||
mail(to: "redstonerserver@gmail.com", subject: "#{@user.name} registered on Redstoner")
|
mail(to: "redstonerserver@gmail.com", subject: "#{@user.name} registered on Redstoner")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def new_thread_mention_mail(user, thread)
|
||||||
|
@user = user
|
||||||
|
@thread = thread
|
||||||
|
mail(to: @user.email, subject: "#{thread.author.name} mentioned you in '#{thread.title}' on Redstoner")
|
||||||
|
end
|
||||||
|
|
||||||
def new_thread_reply_mail(user, reply)
|
def new_thread_reply_mail(user, reply)
|
||||||
@user = user
|
@user = user
|
||||||
@reply = reply
|
@reply = reply
|
||||||
mail(to: @user.email, subject: "#{reply.author.name} replied to '#{reply.thread.title}' on Redstoner")
|
mail(to: @user.email, subject: "#{reply.author.name} replied to '#{reply.thread.title}' on Redstoner")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def new_thread_reply_mention_mail(user, reply)
|
||||||
|
@user = user
|
||||||
|
@reply = reply
|
||||||
|
mail(to: @user.email, subject: "#{reply.author.name} mentioned you in '#{reply.thread.title}' on Redstoner")
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_post_mention_mail(user, post)
|
||||||
|
@user = user
|
||||||
|
@post = post
|
||||||
|
mail(to: @user.email, subject: "#{post.author.name} mentioned you in '#{post.title}' on Redstoner")
|
||||||
|
end
|
||||||
|
|
||||||
def new_post_comment_mail(user, comment)
|
def new_post_comment_mail(user, comment)
|
||||||
@user = user
|
@user = user
|
||||||
@comment = comment
|
@comment = comment
|
||||||
mail(to: @user.email, subject: "#{comment.author.name} replied to '#{comment.blogpost.title}' on Redstoner")
|
mail(to: @user.email, subject: "#{comment.author.name} replied to '#{comment.blogpost.title}' on Redstoner")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def new_post_comment_mention_mail(user, comment)
|
||||||
|
@user = user
|
||||||
|
@comment = comment
|
||||||
|
mail(to: @user.email, subject: "#{comment.author.name} mentioned you in '#{comment.blogpost.title}' on Redstoner")
|
||||||
|
end
|
||||||
|
|
||||||
def email_change_confirm_mail(user)
|
def email_change_confirm_mail(user)
|
||||||
@user = user
|
@user = user
|
||||||
mail(to: @user.email, subject: "Email change on Redstoner.com")
|
mail(to: @user.email, subject: "Email change on Redstoner.com")
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
class Blogpost < ActiveRecord::Base
|
class Blogpost < ActiveRecord::Base
|
||||||
|
|
||||||
|
include MailerHelper
|
||||||
|
include UsersHelper
|
||||||
|
|
||||||
validates_presence_of :title, :content, :author
|
validates_presence_of :title, :content, :author
|
||||||
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
|
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
|
||||||
belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id"
|
belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id"
|
||||||
@@ -23,4 +26,20 @@ class Blogpost < ActiveRecord::Base
|
|||||||
!!user_editor_id
|
!!user_editor_id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_new_mention_mail(old_content = "")
|
||||||
|
new_mentions = mentions(content) - mentions(old_content)
|
||||||
|
mails = []
|
||||||
|
new_mentions.each do |user|
|
||||||
|
begin
|
||||||
|
mails << RedstonerMailer.new_post_mention_mail(user, self)
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.error "---"
|
||||||
|
Rails.logger.error "WARNING: Failed to create new_post_mention_mail (view) for post#: #{@self.id}, user: #{@user.name}, #{@user.email}"
|
||||||
|
Rails.logger.error e.message
|
||||||
|
Rails.logger.error "---"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
background_mailer(mails)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Comment < ActiveRecord::Base
|
class Comment < ActiveRecord::Base
|
||||||
|
|
||||||
include MailerHelper
|
include MailerHelper
|
||||||
|
include UsersHelper
|
||||||
|
|
||||||
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
|
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
|
||||||
belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id"
|
belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id"
|
||||||
@@ -49,7 +50,23 @@ class Comment < ActiveRecord::Base
|
|||||||
mails << RedstonerMailer.new_post_comment_mail(User.find(uid), self)
|
mails << RedstonerMailer.new_post_comment_mail(User.find(uid), self)
|
||||||
rescue => e
|
rescue => e
|
||||||
Rails.logger.error "---"
|
Rails.logger.error "---"
|
||||||
Rails.logger.error "WARNING: Failed to create thread_reply mail (view) for reply#: #{@self.id}, user: #{@user.name}, #{@user.email}"
|
Rails.logger.error "WARNING: Failed to create post_reply mail (view) for reply#: #{@self.id}, user: #{@user.name}, #{@user.email}"
|
||||||
|
Rails.logger.error e.message
|
||||||
|
Rails.logger.error "---"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
background_mailer(mails)
|
||||||
|
end
|
||||||
|
|
||||||
|
def send_new_mention_mail(old_content = "")
|
||||||
|
new_mentions = mentions(content) - mentions(old_content)
|
||||||
|
mails = []
|
||||||
|
new_mentions.each do |user|
|
||||||
|
begin
|
||||||
|
mails << RedstonerMailer.new_post_comment_mention_mail(user, self)
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.error "---"
|
||||||
|
Rails.logger.error "WARNING: Failed to create new_post_comment_mention_mail (view) for reply#: #{@self.id}, user: #{@user.name}, #{@user.email}"
|
||||||
Rails.logger.error e.message
|
Rails.logger.error e.message
|
||||||
Rails.logger.error "---"
|
Rails.logger.error "---"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
class Forumthread < ActiveRecord::Base
|
class Forumthread < ActiveRecord::Base
|
||||||
|
|
||||||
|
include MailerHelper
|
||||||
|
include UsersHelper
|
||||||
|
|
||||||
belongs_to :forum
|
belongs_to :forum
|
||||||
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
|
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
|
||||||
belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id"
|
belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id"
|
||||||
@@ -37,4 +41,20 @@ class Forumthread < ActiveRecord::Base
|
|||||||
def can_write?(user)
|
def can_write?(user)
|
||||||
forum.can_write?(user) && (!locked? || user.mod?)
|
forum.can_write?(user) && (!locked? || user.mod?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_new_mention_mail(old_content = "")
|
||||||
|
new_mentions = mentions(content) - mentions(old_content)
|
||||||
|
mails = []
|
||||||
|
new_mentions.each do |user|
|
||||||
|
begin
|
||||||
|
mails << RedstonerMailer.new_thread_mention_mail(user, self)
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.error "---"
|
||||||
|
Rails.logger.error "WARNING: Failed to create new_thread_mention_mail (view) for reply#: #{@self.id}, user: #{@user.name}, #{@user.email}"
|
||||||
|
Rails.logger.error e.message
|
||||||
|
Rails.logger.error "---"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
background_mailer(mails)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
class Threadreply < ActiveRecord::Base
|
class Threadreply < ActiveRecord::Base
|
||||||
|
|
||||||
include MailerHelper
|
include MailerHelper
|
||||||
|
include UsersHelper
|
||||||
|
|
||||||
belongs_to :forumthread
|
belongs_to :forumthread
|
||||||
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
|
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
|
||||||
@@ -32,6 +33,22 @@ class Threadreply < ActiveRecord::Base
|
|||||||
!!user_editor_id
|
!!user_editor_id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_new_mention_mail(old_content = "")
|
||||||
|
new_mentions = mentions(content) - mentions(old_content)
|
||||||
|
mails = []
|
||||||
|
new_mentions.each do |user|
|
||||||
|
begin
|
||||||
|
mails << RedstonerMailer.new_thread_reply_mention_mail(user, self)
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.error "---"
|
||||||
|
Rails.logger.error "WARNING: Failed to create new_thread_reply_mention_mail (view) for reply#: #{@self.id}, user: #{@user.name}, #{@user.email}"
|
||||||
|
Rails.logger.error e.message
|
||||||
|
Rails.logger.error "---"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
background_mailer(mails)
|
||||||
|
end
|
||||||
|
|
||||||
def send_new_reply_mail
|
def send_new_reply_mail
|
||||||
userids = []
|
userids = []
|
||||||
|
|
||||||
@@ -53,7 +70,7 @@ class Threadreply < ActiveRecord::Base
|
|||||||
mails << RedstonerMailer.new_thread_reply_mail(User.find(uid), self)
|
mails << RedstonerMailer.new_thread_reply_mail(User.find(uid), self)
|
||||||
rescue => e
|
rescue => e
|
||||||
Rails.logger.error "---"
|
Rails.logger.error "---"
|
||||||
Rails.logger.error "WARNING: Failed to create thread_reply mail (view) for reply#: #{@self.id}, user: #{@user.name}, #{@user.email}"
|
Rails.logger.error "WARNING: Failed to create new_thread_reply_mail (view) for reply#: #{@self.id}, user: #{@user.name}, #{@user.email}"
|
||||||
Rails.logger.error e.message
|
Rails.logger.error e.message
|
||||||
Rails.logger.error "---"
|
Rails.logger.error "---"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
||||||
<div style="color: rgb(63, 63, 63); width: 600px; max-width: 100%; padding: 2em; margin: auto">
|
<div style="color: rgb(63, 63, 63); width: 600px; max-width: 100%; padding: 2em 0; margin: auto">
|
||||||
Hi <%= @user.name %>!
|
Hi <%= @user.name %>!
|
||||||
|
|
||||||
<p>You changed your email on Redstoner.com!</p>
|
<p>You changed your email on Redstoner.com!</p>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
||||||
<div style="color: #3f3f3f; width: 600px; max-width: 100%; padding: 2em; margin: auto;">
|
<div style="color: #3f3f3f; width: 600px; max-width: 100%; padding: 2em 0; margin: auto;">
|
||||||
Hi <%= @user.name %>!
|
Hi <%= @user.name %>!
|
||||||
|
|
||||||
<p><%= link_to @comment.author.name, user_url(@comment.author), style: "text-decoration: none; color: #4096EE;" %> has replied to '<%= @comment.blogpost.title %>' on the Redstoner blog!</p>
|
<p><%= link_to @comment.author.name, user_url(@comment.author), style: "text-decoration: none; color: #4096EE;" %> has replied to '<%= @comment.blogpost.title %>' on the Redstoner blog!</p>
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
||||||
|
<div style="color: #3f3f3f; width: 600px; max-width: 100%; padding: 2em 0; margin: auto;">
|
||||||
|
Hi <%= @user.name %>!
|
||||||
|
|
||||||
|
<p><%= link_to @comment.author.name, user_url(@comment.author), style: "text-decoration: none; color: #4096EE;" %> has mentioned you in '<%= @comment.blogpost.title %>' on the Redstoner blog!</p>
|
||||||
|
|
||||||
|
<blockquote>
|
||||||
|
<%# TODO: fix relative links + iframes %>
|
||||||
|
<%= render_mini_md(@comment.content).html_safe %>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<p><%= link_to "Click here", blogpost_url(@comment.blogpost) + "#comment-#{@comment.id}", style: "text-decoration: none; color: #4096EE;" %> to view the blog post.</p>
|
||||||
|
|
||||||
|
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
|
||||||
|
<p>Your Redstoner team</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="background: #444; width: 100%; color: #fff; margin: auto; text-align: center; display: inline-block;">
|
||||||
|
<div style="margin: 2em;">
|
||||||
|
<p><i>Too much spam? Change <%= link_to "your notification settings", edit_notifications_user_url(@user), style: "text-decoration: none; color: #4096EE;" %>!</i></p>
|
||||||
|
<p>You can contact us via:
|
||||||
|
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Google+", "https://google.com/+Redstoner", style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
30
app/views/redstoner_mailer/new_post_mention_mail.html.erb
Normal file
30
app/views/redstoner_mailer/new_post_mention_mail.html.erb
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
||||||
|
<div style="color: #3f3f3f; width: 600px; max-width: 100%; padding: 2em 0; margin: auto;">
|
||||||
|
Hi <%= @user.name %>!
|
||||||
|
|
||||||
|
<p><%= link_to @post.author.name, user_url(@post.author), style: "text-decoration: none; color: #4096EE;" %> has mentioned you in '<%= @post.title %>' on the Redstoner blog!</p>
|
||||||
|
|
||||||
|
<blockquote>
|
||||||
|
<%# TODO: fix relative links + iframes %>
|
||||||
|
<%= render_mini_md(@post.content).html_safe %>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<p><%= link_to "Click here", blogpost_url(@post), style: "text-decoration: none; color: #4096EE;" %> to view the blog post.</p>
|
||||||
|
|
||||||
|
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
|
||||||
|
<p>Your Redstoner team</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="background: #444; width: 100%; color: #fff; margin: auto; text-align: center; display: inline-block;">
|
||||||
|
<div style="margin: 2em;">
|
||||||
|
<p><i>Too much spam? Change <%= link_to "your notification settings", edit_notifications_user_url(@user), style: "text-decoration: none; color: #4096EE;" %>!</i></p>
|
||||||
|
<p>You can contact us via:
|
||||||
|
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Google+", "https://google.com/+Redstoner", style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
31
app/views/redstoner_mailer/new_thread_mention_mail.html.erb
Normal file
31
app/views/redstoner_mailer/new_thread_mention_mail.html.erb
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
||||||
|
<div style="color: #3f3f3f; width: 600px; max-width: 100%; padding: 2em 0; margin: auto;">
|
||||||
|
Hi <%= @user.name %>!
|
||||||
|
|
||||||
|
<p><%= link_to @thread.author.name, user_url(@thread.author), style: "text-decoration: none; color: #4096EE;" %> mentioned you in '<%= @thread.title %>' on the Redstoner forums!</p>
|
||||||
|
|
||||||
|
<blockquote>
|
||||||
|
<%# TODO: fix relative links + iframes %>
|
||||||
|
<%= render_md(@thread.content).html_safe %>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<p><%= link_to "Click here", forumthread_url(@thread), style: "text-decoration: none; color: #4096EE;" %> to view the thread.</p>
|
||||||
|
|
||||||
|
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
|
||||||
|
<p>Your Redstoner team</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="background: #444; width: 100%; color: #fff; margin: auto; text-align: center; display: inline-block;">
|
||||||
|
<div style="margin: 2em;">
|
||||||
|
<p><i>Too much spam? Change <%= link_to "your notification settings", edit_notifications_user_url(@user), style: "text-decoration: none; color: #4096EE;" %>!</i></p>
|
||||||
|
</p>
|
||||||
|
<p>You can contact us via:
|
||||||
|
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Google+", "https://google.com/+Redstoner", style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
||||||
<div style="color: #3f3f3f; width: 600px; max-width: 100%; padding: 2em; margin: auto;">
|
<div style="color: #3f3f3f; width: 600px; max-width: 100%; padding: 2em 0; margin: auto;">
|
||||||
Hi <%= @user.name %>!
|
Hi <%= @user.name %>!
|
||||||
|
|
||||||
<p><%= link_to @reply.author.name, user_url(@reply.author), style: "text-decoration: none; color: #4096EE;" %> has replied to '<%= @reply.thread.title %>' on the Redstoner forums!</p>
|
<p><%= link_to @reply.author.name, user_url(@reply.author), style: "text-decoration: none; color: #4096EE;" %> has replied to '<%= @reply.thread.title %>' on the Redstoner forums!</p>
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
||||||
|
<div style="color: #3f3f3f; width: 600px; max-width: 100%; padding: 2em 0; margin: auto;">
|
||||||
|
Hi <%= @user.name %>!
|
||||||
|
|
||||||
|
<p><%= link_to @reply.author.name, user_url(@reply.author), style: "text-decoration: none; color: #4096EE;" %> mentioned you in '<%= @reply.thread.title %>' on the Redstoner forums!</p>
|
||||||
|
|
||||||
|
<blockquote>
|
||||||
|
<%# TODO: fix relative links + iframes %>
|
||||||
|
<%= render_md(@reply.content).html_safe %>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
|
<p><%= link_to "Click here", forumthread_url(@reply.thread) + "#reply-#{@reply.id}", style: "text-decoration: none; color: #4096EE;" %> to view the thread.</p>
|
||||||
|
|
||||||
|
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
|
||||||
|
<p>Your Redstoner team</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="background: #444; width: 100%; color: #fff; margin: auto; text-align: center; display: inline-block;">
|
||||||
|
<div style="margin: 2em;">
|
||||||
|
<p><i>Too much spam? Change <%= link_to "your notification settings", edit_notifications_user_url(@user), style: "text-decoration: none; color: #4096EE;" %>!</i></p>
|
||||||
|
</p>
|
||||||
|
<p>You can contact us via:
|
||||||
|
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Google+", "https://google.com/+Redstoner", style: "text-decoration: none; color: #4096EE;" %> |
|
||||||
|
<%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
||||||
<div style="color: rgb(63, 63, 63); width: 600px; max-width: 100%; padding: 2em; margin: auto">
|
<div style="color: rgb(63, 63, 63); width: 600px; max-width: 100%; padding: 2em 0; margin: auto">
|
||||||
Hi <%= @user.name %>!
|
Hi <%= @user.name %>!
|
||||||
|
|
||||||
<p>Thank you for registering on Redstoner.com!</p>
|
<p>Thank you for registering on Redstoner.com!</p>
|
||||||
|
|||||||
63
test/mailers/previews/all_preview.rb
Normal file
63
test/mailers/previews/all_preview.rb
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
class AllPreview < ActionMailer::Preview
|
||||||
|
@@user = User.new(id: 123, uuid: "aabbccddeeff11223344556677889900", ign: "fancy_user", name: "fancy_user", email_token: "abcdefg", email: "fancymail@example.com", created_at: Time.now, last_ip: "1.2.3.4")
|
||||||
|
|
||||||
|
def register_mail_normal
|
||||||
|
RedstonerMailer.register_mail(@@user, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
def register_mail_idiot
|
||||||
|
RedstonerMailer.register_mail(@@user, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
def register_info_mail_normal
|
||||||
|
RedstonerMailer.register_info_mail(@@user, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
def register_info_mail_idiot
|
||||||
|
RedstonerMailer.register_info_mail(@@user, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_thread_mention_mail
|
||||||
|
op = User.new(id: 32, name: "TheOP", email: "theopuser@example.com")
|
||||||
|
thread = Forumthread.new(id: 123, user_author: op, title: "Wow, test thread!", content: "# Markdown!\n\n@mention\n`incline code`\n\n<b>html?</b>\n\n[yt:abcd1234]\n\n[link](/forums)")
|
||||||
|
RedstonerMailer.new_thread_mention_mail(@@user, thread)
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_thread_reply_mail
|
||||||
|
op = User.new(id: 32, name: "TheOP", email: "theopuser@example.com")
|
||||||
|
thread = Forumthread.new(id: 123, user_author: op, title: "Wow, test thread!", content: "You should not see this...")
|
||||||
|
reply = Threadreply.new(id: 312, user_author: @@user, content: "# Markdown!\n\n`incline code`\n\n<b>html?</b>\n\n[yt:abcd1234]\n\n[link](/forums)", forumthread: thread)
|
||||||
|
RedstonerMailer.new_thread_reply_mail(@@user, reply)
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_thread_reply_mention_mail
|
||||||
|
op = User.new(id: 32, name: "TheOP", email: "theopuser@example.com")
|
||||||
|
thread = Forumthread.new(id: 123, user_author: op, title: "Wow, test thread!", content: "You should not see this...")
|
||||||
|
reply = Threadreply.new(id: 312, user_author: @@user, content: "# Markdown!\n\n@mention\n`incline code`\n\n<b>html?</b>\n\n[yt:abcd1234]\n\n[link](/forums)", forumthread: thread)
|
||||||
|
RedstonerMailer.new_thread_reply_mention_mail(@@user, reply)
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_post_mention_mail
|
||||||
|
op = User.new(id: 32, name: "TheOP", email: "theopuser@example.com")
|
||||||
|
post = Blogpost.new(id: 123, user_author: op, title: "Wow, test post!", content: "@mention Wow, that is **cool**!")
|
||||||
|
RedstonerMailer.new_post_mention_mail(@@user, post)
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_post_comment_mail
|
||||||
|
op = User.new(id: 32, name: "TheOP", email: "theopuser@example.com")
|
||||||
|
post = Blogpost.new(id: 123, user_author: op, title: "Wow, test post!", content: "You should not see this...")
|
||||||
|
comment = Comment.new(id: 312, user_author: @@user, content: "Wow, that is **cool**!", blogpost: post)
|
||||||
|
RedstonerMailer.new_post_comment_mail(@@user, comment)
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_post_comment_mention_mail
|
||||||
|
op = User.new(id: 32, name: "TheOP", email: "theopuser@example.com")
|
||||||
|
post = Blogpost.new(id: 123, user_author: op, title: "Wow, test post!", content: "You should not see this...")
|
||||||
|
comment = Comment.new(id: 312, user_author: @@user, content: "@mention Wow, that is **cool**!", blogpost: post)
|
||||||
|
RedstonerMailer.new_post_comment_mail(@@user, comment)
|
||||||
|
end
|
||||||
|
|
||||||
|
def email_change_confirm_mail
|
||||||
|
RedstonerMailer.email_change_confirm_mail(@@user)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
class RegistrationPreview < ActionMailer::Preview
|
|
||||||
@@user = User.new(id: 123, uuid: "aabbccddeeff11223344556677889900", ign: "fancy_user", name: "fancy_user", email_token: "abcdefg", email: "fancymail@example.com", created_at: Time.now, last_ip: "1.2.3.4")
|
|
||||||
|
|
||||||
def register_mail_normal
|
|
||||||
RedstonerMailer.register_mail(@@user, false)
|
|
||||||
end
|
|
||||||
|
|
||||||
def register_mail_idiot
|
|
||||||
RedstonerMailer.register_mail(@@user, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
def register_info_mail_normal
|
|
||||||
RedstonerMailer.register_info_mail(@@user, false)
|
|
||||||
end
|
|
||||||
|
|
||||||
def register_info_mail_idiot
|
|
||||||
RedstonerMailer.register_info_mail(@@user, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
def new_thread_reply_mail
|
|
||||||
op = User.new(id: 32, name: "TheOP", email: "theopuser@example.com")
|
|
||||||
thread = Forumthread.new(id: 123, user_author: op, title: "Wow, test thread!", content: "You should not see this...")
|
|
||||||
reply = Threadreply.new(id: 312, user_author: @@user, content: "# Markdown!\n\n`incline code`\n\n<b>html?</b>\n\n[yt:abcd1234]\n\n[link](/forums)", forumthread: thread)
|
|
||||||
RedstonerMailer.new_thread_reply_mail(@@user, reply)
|
|
||||||
end
|
|
||||||
|
|
||||||
def new_post_comment_mail
|
|
||||||
op = User.new(id: 32, name: "TheOP", email: "theopuser@example.com")
|
|
||||||
post = Blogpost.new(id: 123, user_author: op, title: "Wow, test post!", content: "You should not see this...")
|
|
||||||
comment = Comment.new(id: 312, user_author: @@user, content: "Wow, that is **cool**!", blogpost: post)
|
|
||||||
RedstonerMailer.new_post_comment_mail(@@user, comment)
|
|
||||||
end
|
|
||||||
|
|
||||||
def email_change_confirm_mail
|
|
||||||
RedstonerMailer.email_change_confirm_mail(@@user)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user