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
Léo-Paul Géneau
gitlab-ce
Commits
7e51ec4f
Commit
7e51ec4f
authored
Aug 21, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
bd78e1a2
d43d7ffd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
3 deletions
+51
-3
CHANGELOG
CHANGELOG
+2
-0
app/models/note.rb
app/models/note.rb
+1
-1
app/models/user.rb
app/models/user.rb
+13
-2
spec/models/note_spec.rb
spec/models/note_spec.rb
+6
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+29
-0
No files found.
CHANGELOG
View file @
7e51ec4f
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 8.0.0 (unreleased)
v 8.0.0 (unreleased)
- Only show recent push event if the branch still exists or a recent merge request has not been created (Stan Hu)
- Remove satellites
- Remove satellites
- Better performance for web editor (switched from satellites to rugged)
- Better performance for web editor (switched from satellites to rugged)
- Faster merge
- Faster merge
- Ability to fetch merge requests from refs/merge-requests/:id
- Ability to fetch merge requests from refs/merge-requests/:id
- Allow displaying of archived projects in the admin interface (Artem Sidorenko)
- Allow displaying of archived projects in the admin interface (Artem Sidorenko)
- Allow configuration of import sources for new projects (Artem Sidorenko)
- Allow configuration of import sources for new projects (Artem Sidorenko)
- Search for comments should be case insensetive
v 7.14.0 (unreleased)
v 7.14.0 (unreleased)
- Update default robots.txt rules to disallow crawling of irrelevant pages (Ben Bodenmiller)
- Update default robots.txt rules to disallow crawling of irrelevant pages (Ben Bodenmiller)
...
...
app/models/note.rb
View file @
7e51ec4f
...
@@ -90,7 +90,7 @@ class Note < ActiveRecord::Base
...
@@ -90,7 +90,7 @@ class Note < ActiveRecord::Base
end
end
def
search
(
query
)
def
search
(
query
)
where
(
"
note like :query"
,
query:
"%
#{
query
}
%"
)
where
(
"
LOWER(note) like :query"
,
query:
"%
#{
query
.
downcase
}
%"
)
end
end
end
end
...
...
app/models/user.rb
View file @
7e51ec4f
...
@@ -471,8 +471,19 @@ class User < ActiveRecord::Base
...
@@ -471,8 +471,19 @@ class User < ActiveRecord::Base
events
=
recent_events
.
code_push
.
where
(
"created_at > ?"
,
Time
.
now
-
2
.
hours
)
events
=
recent_events
.
code_push
.
where
(
"created_at > ?"
,
Time
.
now
-
2
.
hours
)
events
=
events
.
where
(
project_id:
project_id
)
if
project_id
events
=
events
.
where
(
project_id:
project_id
)
if
project_id
# Take only latest one
# Use the latest event that has not been pushed or merged recently
events
=
events
.
recent
.
limit
(
1
).
first
events
.
recent
.
find
do
|
event
|
project
=
Project
.
find_by_id
(
event
.
project_id
)
next
unless
project
repo
=
project
.
repository
if
repo
.
branch_names
.
include?
(
event
.
branch_name
)
merge_requests
=
MergeRequest
.
where
(
"created_at >= ?"
,
event
.
created_at
).
where
(
source_project_id:
project
.
id
,
source_branch:
event
.
branch_name
)
merge_requests
.
empty?
end
end
end
end
def
projects_sorted_by_activity
def
projects_sorted_by_activity
...
...
spec/models/note_spec.rb
View file @
7e51ec4f
...
@@ -198,4 +198,10 @@ describe Note do
...
@@ -198,4 +198,10 @@ describe Note do
let
(
:backref_text
)
{
issue
.
gfm_reference
}
let
(
:backref_text
)
{
issue
.
gfm_reference
}
let
(
:set_mentionable_text
)
{
->
(
txt
)
{
subject
.
note
=
txt
}
}
let
(
:set_mentionable_text
)
{
->
(
txt
)
{
subject
.
note
=
txt
}
}
end
end
describe
:search
do
let!
(
:note
)
{
create
(
:note
,
note:
"WoW"
)
}
it
{
expect
(
Note
.
search
(
'wow'
)).
to
include
(
note
)
}
end
end
end
spec/models/user_spec.rb
View file @
7e51ec4f
...
@@ -710,4 +710,33 @@ describe User do
...
@@ -710,4 +710,33 @@ describe User do
it
{
expect
(
subject
.
can_be_removed?
).
to
be_falsey
}
it
{
expect
(
subject
.
can_be_removed?
).
to
be_falsey
}
end
end
end
end
describe
"#recent_push"
do
subject
{
create
(
:user
)
}
let!
(
:project1
)
{
create
(
:project
)
}
let!
(
:project2
)
{
create
(
:project
,
forked_from_project:
project1
)
}
let!
(
:push_data
)
{
Gitlab
::
PushDataBuilder
.
build_sample
(
project2
,
subject
)
}
let!
(
:push_event
)
{
create
(
:event
,
action:
Event
::
PUSHED
,
project:
project2
,
target:
project1
,
author:
subject
,
data:
push_data
)
}
before
do
project1
.
team
<<
[
subject
,
:master
]
project2
.
team
<<
[
subject
,
:master
]
end
it
"includes push event"
do
expect
(
subject
.
recent_push
).
to
eq
(
push_event
)
end
it
"excludes push event if branch has been deleted"
do
allow_any_instance_of
(
Repository
).
to
receive
(
:branch_names
).
and_return
([
'foo'
])
expect
(
subject
.
recent_push
).
to
eq
(
nil
)
end
it
"excludes push event if MR is opened for it"
do
create
(
:merge_request
,
source_project:
project2
,
target_project:
project1
,
source_branch:
project2
.
default_branch
,
target_branch:
'fix'
,
author:
subject
)
expect
(
subject
.
recent_push
).
to
eq
(
nil
)
end
end
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