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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a89c1bf6
Commit
a89c1bf6
authored
Jun 26, 2017
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix application error when Project#last_activity_at is nil
parent
f0886918
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
app/models/project.rb
app/models/project.rb
+1
-1
app/views/shared/projects/_project.html.haml
app/views/shared/projects/_project.html.haml
+1
-1
spec/features/dashboard/projects_spec.rb
spec/features/dashboard/projects_spec.rb
+17
-5
No files found.
app/models/project.rb
View file @
a89c1bf6
...
@@ -689,7 +689,7 @@ class Project < ActiveRecord::Base
...
@@ -689,7 +689,7 @@ class Project < ActiveRecord::Base
end
end
def
last_activity_date
def
last_activity_date
last_activity_at
||
updated_at
last_
repository_updated_at
||
last_
activity_at
||
updated_at
end
end
def
project_id
def
project_id
...
...
app/views/shared/projects/_project.html.haml
View file @
a89c1bf6
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
-
show_last_commit_as_description
=
false
unless
local_assigns
[
:show_last_commit_as_description
]
==
true
&&
project
.
commit
-
show_last_commit_as_description
=
false
unless
local_assigns
[
:show_last_commit_as_description
]
==
true
&&
project
.
commit
-
css_class
+=
" no-description"
if
project
.
description
.
blank?
&&
!
show_last_commit_as_description
-
css_class
+=
" no-description"
if
project
.
description
.
blank?
&&
!
show_last_commit_as_description
-
cache_key
=
project_list_cache_key
(
project
)
-
cache_key
=
project_list_cache_key
(
project
)
-
updated_tooltip
=
time_ago_with_tooltip
(
project
.
last_activity_
at
)
-
updated_tooltip
=
time_ago_with_tooltip
(
project
.
last_activity_
date
)
%li
.project-row
{
class:
css_class
}
%li
.project-row
{
class:
css_class
}
=
cache
(
cache_key
)
do
=
cache
(
cache_key
)
do
...
...
spec/features/dashboard/projects_spec.rb
View file @
a89c1bf6
...
@@ -15,13 +15,25 @@ RSpec.describe 'Dashboard Projects', feature: true do
...
@@ -15,13 +15,25 @@ RSpec.describe 'Dashboard Projects', feature: true do
expect
(
page
).
to
have_content
(
'awesome stuff'
)
expect
(
page
).
to
have_content
(
'awesome stuff'
)
end
end
it
'shows the last_activity_at attribute as the update date
'
do
context
'when last_repository_updated_at, last_activity_at and update_at are present
'
do
now
=
Time
.
now
it
'shows the last_repository_updated_at attribute as the update date'
do
project
.
update_column
(
:last_activity_at
,
now
)
project
.
update_attributes!
(
last_repository_updated_at:
Time
.
now
,
last_activity_at:
1
.
hour
.
ago
)
visit
dashboard_projects_path
visit
dashboard_projects_path
expect
(
page
).
to
have_xpath
(
"//time[@datetime='
#{
project
.
last_repository_updated_at
.
getutc
.
iso8601
}
']"
)
end
end
expect
(
page
).
to
have_xpath
(
"//time[@datetime='
#{
now
.
getutc
.
iso8601
}
']"
)
context
'when last_repository_updated_at and last_activity_at are missing'
do
it
'shows the updated_at attribute as the update date'
do
project
.
update_attributes!
(
last_repository_updated_at:
nil
,
last_activity_at:
nil
)
project
.
touch
visit
dashboard_projects_path
expect
(
page
).
to
have_xpath
(
"//time[@datetime='
#{
project
.
updated_at
.
getutc
.
iso8601
}
']"
)
end
end
end
context
'when on Starred projects tab'
do
context
'when on Starred projects tab'
do
...
...
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