Patch #43934 ยป 0001-Optimize-Issue-visible_journals_with_index-preload-b.patch
| app/models/issue.rb | ||
|---|---|---|
| 918 | 918 |
# Returns the journals that are visible to user with their index |
| 919 | 919 |
# Used to display the issue history |
| 920 | 920 |
def visible_journals_with_index(user=User.current) |
| 921 |
preloads = [:details, :updated_by] |
|
| 922 |
preloads << (Setting.gravatar_enabled? ? {user: :email_address} : :user)
|
|
| 923 | ||
| 921 | 924 |
result = journals. |
| 922 |
preload(:details). |
|
| 923 |
preload(:user => :email_address). |
|
| 925 |
preload(*preloads). |
|
| 924 | 926 |
reorder(:created_on, :id). |
| 925 | 927 |
to_a |
| 926 | 928 | |