From 67d9cbbecbcf569f781210f9e8e05eefd825a1a9 Mon Sep 17 00:00:00 2001 From: jomo Date: Mon, 21 Apr 2014 01:46:31 +0200 Subject: [PATCH] bugfixes --- app/models/forumthread.rb | 4 +--- app/views/forumthreads/show.html.erb | 2 +- app/views/redstoner_mailer/register_mail.html.erb | 2 +- app/views/threadreplies/_reply.html.erb | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/models/forumthread.rb b/app/models/forumthread.rb index 0af46bd..6be73dd 100644 --- a/app/models/forumthread.rb +++ b/app/models/forumthread.rb @@ -4,8 +4,6 @@ class Forumthread < ActiveRecord::Base belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id" has_many :threadreplies - - validates_presence_of :title, :author, :forum validates_presence_of :content validates_length_of :content, in: 5..10000 @@ -37,6 +35,6 @@ class Forumthread < ActiveRecord::Base end def can_write?(user) - forum.can_write?(user) && (!locked? || mod?) + forum.can_write?(user) && (!locked? || user.mod?) end end \ No newline at end of file diff --git a/app/views/forumthreads/show.html.erb b/app/views/forumthreads/show.html.erb index 1cda450..0faea1f 100644 --- a/app/views/forumthreads/show.html.erb +++ b/app/views/forumthreads/show.html.erb @@ -3,7 +3,7 @@ <%= link_to(image_tag(@thread.author.avatar_url(64), class: "avatar"), @thread.author, title: @thread.author.ign) %>
<%= render partial: "users/username", locals: { user: @thread.author } %> - <%= link_to "edit", edit_forumthread_path( @thread), class: "editlink" if mod? %> + <%= link_to "edit", edit_forumthread_path( @thread), class: "editlink" if (@thread.author.is?(current_user) || mod?) %>
diff --git a/app/views/redstoner_mailer/register_mail.html.erb b/app/views/redstoner_mailer/register_mail.html.erb index 2a8ea6b..dea9709 100644 --- a/app/views/redstoner_mailer/register_mail.html.erb +++ b/app/views/redstoner_mailer/register_mail.html.erb @@ -3,7 +3,7 @@ Hi <%= @user.name %>!

Thank you for registering on Redstoner.com!

-

To use your account, you need to <%= link_to "confirm", confirm_user_path(@user, code: @user.email_token, only_path: false) %>your email address.

+

To use your account, you need to <%= link_to "confirm", confirm_user_path(@user, code: @user.email_token, only_path: false) %> your email address.

diff --git a/app/views/threadreplies/_reply.html.erb b/app/views/threadreplies/_reply.html.erb index dd061b2..2afea79 100644 --- a/app/views/threadreplies/_reply.html.erb +++ b/app/views/threadreplies/_reply.html.erb @@ -2,7 +2,7 @@ <%= link_to(image_tag(reply.author.avatar_url(64), class: "avatar"), reply.author, title: reply.author.ign) %>
<%= render partial: "users/username", locals: { user: reply.author } %> - <%= link_to "edit", edit_forumthread_threadreply_path(reply.thread, reply), class: "editlink" if mod? || thread.author.is?(current_user) %> + <%= link_to "edit", edit_forumthread_threadreply_path(reply.thread, reply), class: "editlink" if mod? || reply.thread.author.is?(current_user) %>