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
Kazuhiko Shiozaki
gitlab-ce
Commits
36bd6c84
Commit
36bd6c84
authored
Jul 30, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show who last edited a comment if it wasn't the original author
parent
a06827bf
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
53 additions
and
67 deletions
+53
-67
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+2
-5
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+0
-15
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+0
-15
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+2
-2
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+1
-0
app/models/note.rb
app/models/note.rb
+1
-0
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+1
-1
app/services/merge_requests/update_service.rb
app/services/merge_requests/update_service.rb
+1
-1
app/services/notes/update_service.rb
app/services/notes/update_service.rb
+4
-15
app/views/projects/issues/show.html.haml
app/views/projects/issues/show.html.haml
+7
-1
app/views/projects/merge_requests/show/_mr_title.html.haml
app/views/projects/merge_requests/show/_mr_title.html.haml
+8
-2
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+8
-1
db/migrate/20150730122406_add_updated_by_to_issuables_and_notes.rb
...e/20150730122406_add_updated_by_to_issuables_and_notes.rb
+7
-0
db/schema.rb
db/schema.rb
+5
-2
lib/api/notes.rb
lib/api/notes.rb
+5
-7
No files found.
CHANGELOG
View file @
36bd6c84
...
@@ -17,6 +17,7 @@ v 7.14.0 (unreleased)
...
@@ -17,6 +17,7 @@ v 7.14.0 (unreleased)
- Add fetch command to the MR page
- Add fetch command to the MR page
- Fix bug causing Bitbucket importer to crash when OAuth application had been removed.
- Fix bug causing Bitbucket importer to crash when OAuth application had been removed.
- Add fetch command to the MR page.
- Add fetch command to the MR page.
- Show who last edited a comment if it wasn't the original author
v 7.13.2
v 7.13.2
- Fix randomly failed spec
- Fix randomly failed spec
...
...
app/controllers/projects/notes_controller.rb
View file @
36bd6c84
...
@@ -30,13 +30,10 @@ class Projects::NotesController < Projects::ApplicationController
...
@@ -30,13 +30,10 @@ class Projects::NotesController < Projects::ApplicationController
end
end
def
update
def
update
if
note
.
editable?
@note
=
Notes
::
UpdateService
.
new
(
project
,
current_user
,
note_params
).
execute
(
note
)
note
.
update_attributes
(
note_params
)
note
.
reset_events_cache
end
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
json
{
render_note_json
(
note
)
}
format
.
json
{
render_note_json
(
@
note
)
}
format
.
html
{
redirect_to
:back
}
format
.
html
{
redirect_to
:back
}
end
end
end
end
...
...
app/helpers/issues_helper.rb
View file @
36bd6c84
...
@@ -43,21 +43,6 @@ module IssuesHelper
...
@@ -43,21 +43,6 @@ module IssuesHelper
end
end
end
end
def
issue_timestamp
(
issue
)
# Shows the created at time and the updated at time if different
ts
=
time_ago_with_tooltip
(
issue
.
created_at
,
placement:
'bottom'
,
html_class:
'note_created_ago'
)
if
issue
.
updated_at
!=
issue
.
created_at
ts
<<
capture_haml
do
haml_tag
:span
do
haml_concat
'·'
haml_concat
icon
(
'edit'
,
title:
'edited'
)
haml_concat
time_ago_with_tooltip
(
issue
.
updated_at
,
placement:
'bottom'
,
html_class:
'issue_edited_ago'
)
end
end
end
ts
.
html_safe
end
def
bulk_update_milestone_options
def
bulk_update_milestone_options
options_for_select
([[
'None (backlog)'
,
-
1
]])
+
options_for_select
([[
'None (backlog)'
,
-
1
]])
+
options_from_collection_for_select
(
project_active_milestones
,
'id'
,
options_from_collection_for_select
(
project_active_milestones
,
'id'
,
...
...
app/helpers/notes_helper.rb
View file @
36bd6c84
...
@@ -23,21 +23,6 @@ module NotesHelper
...
@@ -23,21 +23,6 @@ module NotesHelper
end
end
end
end
def
note_timestamp
(
note
)
# Shows the created at time and the updated at time if different
ts
=
time_ago_with_tooltip
(
note
.
created_at
,
placement:
'bottom'
,
html_class:
'note_created_ago'
)
if
note
.
updated_at
!=
note
.
created_at
ts
<<
capture_haml
do
haml_tag
:span
do
haml_concat
'·'
haml_concat
icon
(
'edit'
,
title:
'edited'
)
haml_concat
time_ago_with_tooltip
(
note
.
updated_at
,
placement:
'bottom'
,
html_class:
'note_edited_ago'
)
end
end
end
ts
.
html_safe
end
def
noteable_json
(
noteable
)
def
noteable_json
(
noteable
)
{
{
id:
noteable
.
id
,
id:
noteable
.
id
,
...
...
app/helpers/projects_helper.rb
View file @
36bd6c84
...
@@ -21,7 +21,7 @@ module ProjectsHelper
...
@@ -21,7 +21,7 @@ module ProjectsHelper
end
end
def
link_to_member
(
project
,
author
,
opts
=
{})
def
link_to_member
(
project
,
author
,
opts
=
{})
default_opts
=
{
avatar:
true
,
name:
true
,
size:
16
}
default_opts
=
{
avatar:
true
,
name:
true
,
size:
16
,
author_class:
'author'
}
opts
=
default_opts
.
merge
(
opts
)
opts
=
default_opts
.
merge
(
opts
)
return
"(deleted)"
unless
author
return
"(deleted)"
unless
author
...
@@ -32,7 +32,7 @@ module ProjectsHelper
...
@@ -32,7 +32,7 @@ module ProjectsHelper
author_html
<<
image_tag
(
avatar_icon
(
author
.
try
(
:email
),
opts
[
:size
]),
width:
opts
[
:size
],
class:
"avatar avatar-inline
#{
"s
#{
opts
[
:size
]
}
"
if
opts
[
:size
]
}
"
,
alt
:''
)
if
opts
[
:avatar
]
author_html
<<
image_tag
(
avatar_icon
(
author
.
try
(
:email
),
opts
[
:size
]),
width:
opts
[
:size
],
class:
"avatar avatar-inline
#{
"s
#{
opts
[
:size
]
}
"
if
opts
[
:size
]
}
"
,
alt
:''
)
if
opts
[
:avatar
]
# Build name span tag
# Build name span tag
author_html
<<
content_tag
(
:span
,
sanitize
(
author
.
name
),
class:
'author'
)
if
opts
[
:name
]
author_html
<<
content_tag
(
:span
,
sanitize
(
author
.
name
),
class:
opts
[
:author_class
]
)
if
opts
[
:name
]
author_html
=
author_html
.
html_safe
author_html
=
author_html
.
html_safe
...
...
app/models/concerns/issuable.rb
View file @
36bd6c84
...
@@ -12,6 +12,7 @@ module Issuable
...
@@ -12,6 +12,7 @@ module Issuable
included
do
included
do
belongs_to
:author
,
class_name:
"User"
belongs_to
:author
,
class_name:
"User"
belongs_to
:assignee
,
class_name:
"User"
belongs_to
:assignee
,
class_name:
"User"
belongs_to
:updated_by
,
class_name:
"User"
belongs_to
:milestone
belongs_to
:milestone
has_many
:notes
,
as: :noteable
,
dependent: :destroy
has_many
:notes
,
as: :noteable
,
dependent: :destroy
has_many
:label_links
,
as: :target
,
dependent: :destroy
has_many
:label_links
,
as: :target
,
dependent: :destroy
...
...
app/models/note.rb
View file @
36bd6c84
...
@@ -33,6 +33,7 @@ class Note < ActiveRecord::Base
...
@@ -33,6 +33,7 @@ class Note < ActiveRecord::Base
belongs_to
:project
belongs_to
:project
belongs_to
:noteable
,
polymorphic:
true
,
touch:
true
belongs_to
:noteable
,
polymorphic:
true
,
touch:
true
belongs_to
:author
,
class_name:
"User"
belongs_to
:author
,
class_name:
"User"
belongs_to
:updated_by
,
class_name:
"User"
delegate
:name
,
to: :project
,
prefix:
true
delegate
:name
,
to: :project
,
prefix:
true
delegate
:name
,
:email
,
to: :author
,
prefix:
true
delegate
:name
,
:email
,
to: :author
,
prefix:
true
...
...
app/services/issues/update_service.rb
View file @
36bd6c84
...
@@ -14,7 +14,7 @@ module Issues
...
@@ -14,7 +14,7 @@ module Issues
filter_params
filter_params
old_labels
=
issue
.
labels
.
to_a
old_labels
=
issue
.
labels
.
to_a
if
params
.
present?
&&
issue
.
update_attributes
(
params
)
if
params
.
present?
&&
issue
.
update_attributes
(
params
.
merge
(
updated_by:
current_user
)
)
issue
.
reset_events_cache
issue
.
reset_events_cache
if
issue
.
labels
!=
old_labels
if
issue
.
labels
!=
old_labels
...
...
app/services/merge_requests/update_service.rb
View file @
36bd6c84
...
@@ -24,7 +24,7 @@ module MergeRequests
...
@@ -24,7 +24,7 @@ module MergeRequests
filter_params
filter_params
old_labels
=
merge_request
.
labels
.
to_a
old_labels
=
merge_request
.
labels
.
to_a
if
params
.
present?
&&
merge_request
.
update_attributes
(
params
)
if
params
.
present?
&&
merge_request
.
update_attributes
(
params
.
merge
(
updated_by:
current_user
)
)
merge_request
.
reset_events_cache
merge_request
.
reset_events_cache
if
merge_request
.
labels
!=
old_labels
if
merge_request
.
labels
!=
old_labels
...
...
app/services/notes/update_service.rb
View file @
36bd6c84
module
Notes
module
Notes
class
UpdateService
<
BaseService
class
UpdateService
<
BaseService
def
execute
def
execute
(
note
)
note
=
project
.
notes
.
find
(
params
[
:note_id
])
return
note
unless
note
.
editable?
note
.
note
=
params
[
:note
]
if
note
.
save
notification_service
.
new_note
(
note
)
# Skip system notes, like status changes and cross-references.
note
.
update_attributes
(
params
.
merge
(
updated_by:
current_user
))
unless
note
.
system
event_service
.
leave_note
(
note
,
note
.
author
)
# Create a cross-reference note if this Note contains GFM that
project
.
reset_events_cache
# names an issue, merge request, or commit.
note
.
references
.
each
do
|
mentioned
|
SystemNoteService
.
cross_reference
(
mentioned
,
note
.
noteable
,
note
.
author
)
end
end
end
note
note
end
end
...
...
app/views/projects/issues/show.html.haml
View file @
36bd6c84
...
@@ -9,7 +9,13 @@
...
@@ -9,7 +9,13 @@
Open
Open
Issue ##{@issue.iid}
Issue ##{@issue.iid}
%small
.creator
%small
.creator
·
created by
#{
link_to_member
(
@project
,
@issue
.
author
)
}
#{
issue_timestamp
(
@issue
)
}
·
created by
#{
link_to_member
(
@project
,
@issue
.
author
)
}
=
time_ago_with_tooltip
(
@issue
.
created_at
,
placement:
'bottom'
,
html_class:
'issue_created_ago'
)
-
if
@issue
.
updated_at
!=
@issue
.
created_at
%span
·
=
icon
(
'edit'
,
title:
'edited'
)
=
time_ago_with_tooltip
(
@issue
.
updated_at
,
placement:
'bottom'
,
html_class:
'issue_edited_ago'
)
.pull-right
.pull-right
-
if
can?
(
current_user
,
:create_issue
,
@project
)
-
if
can?
(
current_user
,
:create_issue
,
@project
)
...
...
app/views/projects/merge_requests/show/_mr_title.html.haml
View file @
36bd6c84
%h4
.page-title
%h4
.page-title
.issue-box
{
class:
issue_box_class
(
@merge_request
)
}
.issue-box
{
class:
issue_box_class
(
@merge_request
)
}
=
@merge_request
.
state_human_name
=
@merge_request
.
state_human_name
=
"Merge Request #
#{
@merge_request
.
iid
}
"
Merge Request ##{@merge_request.iid}
%small
.creator
%small
.creator
·
·
created by
#{
link_to_member
(
@project
,
@merge_request
.
author
)
}
#{
time_ago_with_tooltip
(
@merge_request
.
created_at
)
}
created by
#{
link_to_member
(
@project
,
@merge_request
.
author
)
}
=
time_ago_with_tooltip
(
@merge_request
.
created_at
)
-
if
@merge_request
.
updated_at
!=
@merge_request
.
created_at
%span
·
=
icon
(
'edit'
,
title:
'edited'
)
=
time_ago_with_tooltip
(
@merge_request
.
updated_at
,
placement:
'bottom'
)
.issue-btn-group.pull-right
.issue-btn-group.pull-right
-
if
can?
(
current_user
,
:update_merge_request
,
@merge_request
)
-
if
can?
(
current_user
,
:update_merge_request
,
@merge_request
)
...
...
app/views/projects/notes/_note.html.haml
View file @
36bd6c84
...
@@ -33,7 +33,14 @@
...
@@ -33,7 +33,14 @@
%span
.note-last-update
%span
.note-last-update
=
link_to
"#
#{
dom_id
(
note
)
}
"
,
name:
dom_id
(
note
),
title:
"Link here"
do
=
link_to
"#
#{
dom_id
(
note
)
}
"
,
name:
dom_id
(
note
),
title:
"Link here"
do
=
note_timestamp
(
note
)
=
time_ago_with_tooltip
(
note
.
created_at
,
placement:
'bottom'
,
html_class:
'note_created_ago'
)
-
if
note
.
updated_at
!=
note
.
created_at
%span
·
=
icon
(
'edit'
,
title:
'edited'
)
=
time_ago_with_tooltip
(
note
.
updated_at
,
placement:
'bottom'
,
html_class:
'note_edited_ago'
)
-
if
note
.
updated_by
&&
note
.
updated_by
!=
note
.
author
by
#{
link_to_member
(
note
.
project
,
note
.
updated_by
,
avatar:
false
,
author_class:
nil
)
}
-
if
note
.
superceded?
(
@notes
)
-
if
note
.
superceded?
(
@notes
)
-
if
note
.
upvote?
-
if
note
.
upvote?
...
...
db/migrate/20150730122406_add_updated_by_to_issuables_and_notes.rb
0 → 100644
View file @
36bd6c84
class
AddUpdatedByToIssuablesAndNotes
<
ActiveRecord
::
Migration
def
change
add_column
:notes
,
:updated_by_id
,
:integer
add_column
:issues
,
:updated_by_id
,
:integer
add_column
:merge_requests
,
:updated_by_id
,
:integer
end
end
db/schema.rb
View file @
36bd6c84
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201507
17130904
)
do
ActiveRecord
::
Schema
.
define
(
version:
201507
30122406
)
do
# These are extensions that must be enabled in order to support this database
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
enable_extension
"plpgsql"
...
@@ -134,6 +134,7 @@ ActiveRecord::Schema.define(version: 20150717130904) do
...
@@ -134,6 +134,7 @@ ActiveRecord::Schema.define(version: 20150717130904) do
t
.
integer
"milestone_id"
t
.
integer
"milestone_id"
t
.
string
"state"
t
.
string
"state"
t
.
integer
"iid"
t
.
integer
"iid"
t
.
integer
"updated_by_id"
end
end
add_index
"issues"
,
[
"assignee_id"
],
name:
"index_issues_on_assignee_id"
,
using: :btree
add_index
"issues"
,
[
"assignee_id"
],
name:
"index_issues_on_assignee_id"
,
using: :btree
...
@@ -230,6 +231,7 @@ ActiveRecord::Schema.define(version: 20150717130904) do
...
@@ -230,6 +231,7 @@ ActiveRecord::Schema.define(version: 20150717130904) do
t
.
text
"description"
t
.
text
"description"
t
.
integer
"position"
,
default:
0
t
.
integer
"position"
,
default:
0
t
.
datetime
"locked_at"
t
.
datetime
"locked_at"
t
.
integer
"updated_by_id"
end
end
add_index
"merge_requests"
,
[
"assignee_id"
],
name:
"index_merge_requests_on_assignee_id"
,
using: :btree
add_index
"merge_requests"
,
[
"assignee_id"
],
name:
"index_merge_requests_on_assignee_id"
,
using: :btree
...
@@ -289,6 +291,7 @@ ActiveRecord::Schema.define(version: 20150717130904) do
...
@@ -289,6 +291,7 @@ ActiveRecord::Schema.define(version: 20150717130904) do
t
.
integer
"noteable_id"
t
.
integer
"noteable_id"
t
.
boolean
"system"
,
default:
false
,
null:
false
t
.
boolean
"system"
,
default:
false
,
null:
false
t
.
text
"st_diff"
t
.
text
"st_diff"
t
.
integer
"updated_by_id"
end
end
add_index
"notes"
,
[
"author_id"
],
name:
"index_notes_on_author_id"
,
using: :btree
add_index
"notes"
,
[
"author_id"
],
name:
"index_notes_on_author_id"
,
using: :btree
...
...
lib/api/notes.rb
View file @
36bd6c84
...
@@ -78,17 +78,15 @@ module API
...
@@ -78,17 +78,15 @@ module API
put
":id/
#{
noteables_str
}
/:
#{
noteable_id_str
}
/notes/:note_id"
do
put
":id/
#{
noteables_str
}
/:
#{
noteable_id_str
}
/notes/:note_id"
do
required_attributes!
[
:body
]
required_attributes!
[
:body
]
authorize!
:admin_note
,
user_project
.
notes
.
find
(
params
[
:note_id
])
note
=
user_project
.
notes
.
find
(
params
[
:note_id
])
authorize!
:admin_note
,
note
opts
=
{
opts
=
{
note:
params
[
:body
],
note:
params
[
:body
]
note_id:
params
[
:note_id
],
noteable_type:
noteables_str
.
classify
,
noteable_id:
params
[
noteable_id_str
]
}
}
@note
=
::
Notes
::
UpdateService
.
new
(
user_project
,
current_user
,
@note
=
::
Notes
::
UpdateService
.
new
(
user_project
,
current_user
,
opts
).
execute
(
note
)
opts
).
execute
if
@note
.
valid?
if
@note
.
valid?
present
@note
,
with:
Entities
::
Note
present
@note
,
with:
Entities
::
Note
...
...
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