Skip to content

Commit

Permalink
do not show Edit link if there's no editable comment. closes nahi#198.
Browse files Browse the repository at this point in the history
  • Loading branch information
nahi committed Jul 14, 2009
1 parent 48cba16 commit f59af1e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/helpers/entry_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1160,12 +1160,18 @@ def undo_add_comment_link(id, comment)
end

def moderate_link(entry)
if !ctx.moderate and !entry.comments.empty?
if !ctx.moderate and editable?(entry)
link_to(inline_menu_label(:comment_edit, 'Edit'),
link_action('show', :id => u(entry.id), :moderate => true))
end
end

def editable?(entry)
name = auth.name
!entry.comments.empty? and
(entry.nickname == name or entry.comments.any? { |c| c.nickname == name })
end

def edit_comment_link(comment)
if ctx.moderate
if comment.nickname == auth.name
Expand Down

0 comments on commit f59af1e

Please sign in to comment.