mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-01 03:57:15 +00:00
Optimize Version#wiki_page method (#42121).
Avoid unnecessary evaluation of `project.wiki` when `wiki_page_title` is blank, reducing redundant SQL queries. Patch by Go MAEDA (user:maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@23450 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
382ff17fa4
commit
2ffe3fa547
@ -312,10 +312,7 @@ class Version < ApplicationRecord
|
||||
end
|
||||
|
||||
def wiki_page
|
||||
if project.wiki && !wiki_page_title.blank?
|
||||
@wiki_page ||= project.wiki.find_page(wiki_page_title)
|
||||
end
|
||||
@wiki_page
|
||||
@wiki_page ||= project.wiki&.find_page(wiki_page_title) if wiki_page_title.present?
|
||||
end
|
||||
|
||||
def to_s; name end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user