summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-19 13:21:01 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-19 13:21:01 +0200
commit98f5c00e7ac860c7ac78b8245b171f2f27681563 (patch)
treea416e87601f76ba04f1401bc03df23dfb0759449 /app/models/commit.rb
parenta6d1e92d98e71098c5a32999294bcdce6c7a092d (diff)
parent2ddcb1f1a6b68f67e6e50283b4ab0c8df29f6b43 (diff)
downloadgitlab-ce-98f5c00e7ac860c7ac78b8245b171f2f27681563.tar.gz
Merge branch 'master' into backstage/gb/build-stage-id-ref-bg-migration-cleanupbackstage/gb/build-stage-id-ref-bg-migration-cleanup
* master: (59 commits) Resolve "Clarify k8s service keys" Add Portuguese Brazil translations of Commits Page & Pipeline Charts Add Japanese Translation to i18n Update Prometheus gem to version that explicitly calls `munmap` Simplify width for dropdown-menu on mobile Update CHANGELOG.md for 9.3.7 Remove developer documentation about not describing symbols Incorporate Gitaly's Commits#between RPC Adapt to new Gitaly commit message format Remove transitions on nav link hover Provide option to trigger build only for official CE and EE repos in .com Fix queries duration sorting in Performance Bar Rename Project nav items Add structured logging for Rails processes Disable Rails logging in CI test environments Fix download artifacts button alignment Update avatar border to be opaque for better stacking Fixed typos Fix typos Fix external issue trackers redirect ... Conflicts: db/schema.rb
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb19
1 files changed, 3 insertions, 16 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 21b906e1110..1e19f00106a 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -1,5 +1,6 @@
class Commit
extend ActiveModel::Naming
+ extend Gitlab::Cache::RequestCache
include ActiveModel::Conversion
include Noteable
@@ -169,19 +170,9 @@ class Commit
end
def author
- if RequestStore.active?
- key = "commit_author:#{author_email.downcase}"
- # nil is a valid value since no author may exist in the system
- if RequestStore.store.key?(key)
- @author = RequestStore.store[key]
- else
- @author = find_author_by_any_email
- RequestStore.store[key] = @author
- end
- else
- @author ||= find_author_by_any_email
- end
+ User.find_by_any_email(author_email.downcase)
end
+ request_cache(:author) { author_email.downcase }
def committer
@committer ||= User.find_by_any_email(committer_email.downcase)
@@ -368,10 +359,6 @@ class Commit
end
end
- def find_author_by_any_email
- User.find_by_any_email(author_email.downcase)
- end
-
def repo_changes
changes = { added: [], modified: [], removed: [] }