[#19] fix hide autocomment to the hidden project for current user

This commit is contained in:
Alexander Machehin 2013-04-10 16:30:53 +06:00
parent 49feaf9d73
commit 82668412ae
3 changed files with 8 additions and 7 deletions

View File

@ -3,7 +3,8 @@ class CommentPresenter < ApplicationPresenter
include PullRequestHelper
attr_accessor :comment, :options
attr_reader :header, :image, :date, :caption, :content, :buttons, :is_reference_to_issue, :item
attr_reader :header, :image, :date, :caption, :content, :buttons, :is_reference_to_issue,
:reference_project
def initialize(comment, opts = {})
@is_reference_to_issue = !!(comment.automatic && comment.created_from_issue_id) # is it reference issue from another issue
@ -111,7 +112,7 @@ class CommentPresenter < ApplicationPresenter
end.html_safe
end
def item
@comment
def reference_project
@referenced_issue.project
end
end

View File

@ -4,7 +4,7 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
attr_accessor :commit
attr_reader :header, :image, :date, :caption, :content, :expandable,
:is_reference_to_issue, :committer, :item
:is_reference_to_issue, :committer, :reference_project
def initialize(commit, opts = {})
comment = opts[:comment]
@ -77,8 +77,8 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
false
end
def item
@commit
def reference_project
@project
end
protected

View File

@ -1,4 +1,4 @@
-if !presenter.is_reference_to_issue || can?(:show, presenter.item)
-if !presenter.is_reference_to_issue || can?(:show, presenter.reference_project)
.activity{:id => presenter.comment_id? ? presenter.comment_anchor : ''}
.top
- if presenter.buttons?