[#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 include PullRequestHelper
attr_accessor :comment, :options 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 = {}) def initialize(comment, opts = {})
@is_reference_to_issue = !!(comment.automatic && comment.created_from_issue_id) # is it reference issue from another issue @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.html_safe
end end
def item def reference_project
@comment @referenced_issue.project
end end
end end

View File

@ -4,7 +4,7 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
attr_accessor :commit attr_accessor :commit
attr_reader :header, :image, :date, :caption, :content, :expandable, 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 = {}) def initialize(commit, opts = {})
comment = opts[:comment] comment = opts[:comment]
@ -77,8 +77,8 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
false false
end end
def item def reference_project
@commit @project
end end
protected 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 : ''} .activity{:id => presenter.comment_id? ? presenter.comment_anchor : ''}
.top .top
- if presenter.buttons? - if presenter.buttons?