diff --git a/app/models/forum.rb b/app/models/forum.rb index e0592723e..61ba528a0 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -30,7 +30,7 @@ class Forum < ActiveRecord::Base def destroyable_by? user # user && user.logged? && Forum.find(self.forum_id).creator_id == user.id || user.admin? - user.admin? + self.creator == user || user.admin? end # Updates topic_count, memo_count and last_memo_id attributes for +board_id+ diff --git a/app/models/memo.rb b/app/models/memo.rb index b02564834..847795b4f 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -88,11 +88,11 @@ class Memo < ActiveRecord::Base def editable_by? user # user && user.logged? || (self.author == usr && usr.allowed_to?(:edit_own_messages, project)) - user.admin? + (user && self.author == user) || user.admin? end def destroyable_by? user - (user && user.logged? && (Forum.find(self.forum_id).creator_id == user.id) ) || user.admin? + (user && self.author == user) || user.admin? #self.author == user || user.admin? end diff --git a/app/views/forums/_form.html.erb b/app/views/forums/_form.html.erb index 9b3519b05..ac9c298ff 100644 --- a/app/views/forums/_form.html.erb +++ b/app/views/forums/_form.html.erb @@ -15,7 +15,7 @@ <% end %>
(<%= l(:label_forums_max_length) %>)
++ (<%= l(:label_forums_max_length) %>) +
公共贴吧 | -<%= l(:label_user_location) %> : | ++ + <%= l(:label_user_location) %> : + + | - <% if User.current.logged? %> - <%= link_to( l(:label_forum_new), new_forum_path, :class => 'icon icon-add') %> - <% end %> - + <% if User.current.logged? %> + <%= link_to( l(:label_forum_new), new_forum_path, :class => 'icon icon-add') %> + <% end %> |
@@ -24,8 +27,15 @@
|
<%= link_to request.host()+"/forums", forums_path %> | -<%= link_to l(:field_homepage), home_path %> > <%= link_to "公共贴吧", forums_path %> | ++ + <%= link_to request.host()+"/forums", forums_path %> + + | ++ <%= link_to l(:field_homepage), home_path %> > + <%= link_to "公共贴吧", forums_path %> + |