Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
9ebbcb8f
Commit
9ebbcb8f
authored
Mar 05, 2018
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Operate on ids to avoid unnecessary loading.
parent
11a559f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
app/models/user_interacted_project.rb
app/models/user_interacted_project.rb
+3
-3
spec/models/user_interacted_project_spec.rb
spec/models/user_interacted_project_spec.rb
+2
-2
No files found.
app/models/user_interacted_project.rb
View file @
9ebbcb8f
...
@@ -2,8 +2,8 @@ class UserInteractedProject < ActiveRecord::Base
...
@@ -2,8 +2,8 @@ class UserInteractedProject < ActiveRecord::Base
belongs_to
:user
belongs_to
:user
belongs_to
:project
belongs_to
:project
validates
:project
,
presence:
true
validates
:project
_id
,
presence:
true
validates
:user
,
presence:
true
validates
:user
_id
,
presence:
true
CACHE_EXPIRY_TIME
=
1
.
day
CACHE_EXPIRY_TIME
=
1
.
day
...
@@ -15,7 +15,7 @@ class UserInteractedProject < ActiveRecord::Base
...
@@ -15,7 +15,7 @@ class UserInteractedProject < ActiveRecord::Base
# For events without a project, we simply don't care.
# For events without a project, we simply don't care.
# An example of this is the creation of a snippet (which
# An example of this is the creation of a snippet (which
# is not related to any project).
# is not related to any project).
return
unless
event
.
project
return
unless
event
.
project
_id
# This is a precaution because the cache lookup
# This is a precaution because the cache lookup
# will work just fine without an author.
# will work just fine without an author.
...
...
spec/models/user_interacted_project_spec.rb
View file @
9ebbcb8f
...
@@ -55,6 +55,6 @@ describe UserInteractedProject do
...
@@ -55,6 +55,6 @@ describe UserInteractedProject do
end
end
end
end
it
{
is_expected
.
to
validate_presence_of
(
:project
)
}
it
{
is_expected
.
to
validate_presence_of
(
:project
_id
)
}
it
{
is_expected
.
to
validate_presence_of
(
:user
)
}
it
{
is_expected
.
to
validate_presence_of
(
:user
_id
)
}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment