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
f26c4354
Commit
f26c4354
authored
Jul 21, 2018
by
Peter Leitzen
Committed by
Sean McGivern
Aug 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create empty Commits::UpdateService and wire it up
parent
8a5c1942
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
9 deletions
+34
-9
app/models/commit.rb
app/models/commit.rb
+4
-0
app/policies/commit_policy.rb
app/policies/commit_policy.rb
+3
-0
app/services/commits/update_service.rb
app/services/commits/update_service.rb
+9
-0
app/services/notes/quick_actions_service.rb
app/services/notes/quick_actions_service.rb
+2
-1
app/services/quick_actions/interpret_service.rb
app/services/quick_actions/interpret_service.rb
+16
-8
No files found.
app/models/commit.rb
View file @
f26c4354
...
...
@@ -448,6 +448,10 @@ class Commit
true
end
def
to_ability_name
model_name
.
singular
end
def
touch
# no-op but needs to be defined since #persisted? is defined
end
...
...
app/policies/commit_policy.rb
0 → 100644
View file @
f26c4354
class
CommitPolicy
<
BasePolicy
delegate
{
@subject
.
project
}
end
app/services/commits/update_service.rb
0 → 100644
View file @
f26c4354
# frozen_string_literal: true
module
Commits
class
UpdateService
<
BaseService
def
execute
(
commit
)
# TODO authorize user
end
end
end
app/services/notes/quick_actions_service.rb
View file @
f26c4354
...
...
@@ -4,7 +4,8 @@ module Notes
class
QuickActionsService
<
BaseService
UPDATE_SERVICES
=
{
'Issue'
=>
Issues
::
UpdateService
,
'MergeRequest'
=>
MergeRequests
::
UpdateService
'MergeRequest'
=>
MergeRequests
::
UpdateService
,
'Commit'
=>
Commits
::
UpdateService
}.
freeze
def
self
.
noteable_update_service
(
note
)
...
...
app/services/quick_actions/interpret_service.rb
View file @
f26c4354
...
...
@@ -61,6 +61,7 @@ module QuickActions
"Closes this
#{
issuable
.
to_ability_name
.
humanize
(
capitalize:
false
)
}
."
end
condition
do
issuable
.
is_a?
(
Issuable
)
&&
issuable
.
persisted?
&&
issuable
.
open?
&&
current_user
.
can?
(
:"update_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
...
...
@@ -76,6 +77,7 @@ module QuickActions
"Reopens this
#{
issuable
.
to_ability_name
.
humanize
(
capitalize:
false
)
}
."
end
condition
do
issuable
.
is_a?
(
Issuable
)
&&
issuable
.
persisted?
&&
issuable
.
closed?
&&
current_user
.
can?
(
:"update_
#{
issuable
.
to_ability_name
}
"
,
issuable
)
...
...
@@ -150,6 +152,7 @@ module QuickActions
issuable
.
allows_multiple_assignees?
?
'@user1 @user2'
:
''
end
condition
do
issuable
.
is_a?
(
Issuable
)
&&
issuable
.
persisted?
&&
issuable
.
assignees
.
any?
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
project
)
...
...
@@ -189,6 +192,7 @@ module QuickActions
"Removes
#{
issuable
.
milestone
.
to_reference
(
format: :name
)
}
milestone."
end
condition
do
issuable
.
is_a?
(
Issuable
)
&&
issuable
.
persisted?
&&
issuable
.
milestone_id?
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
project
)
...
...
@@ -232,6 +236,7 @@ module QuickActions
end
params
'~label1 ~"label 2"'
condition
do
issuable
.
is_a?
(
Issuable
)
&&
issuable
.
persisted?
&&
issuable
.
labels
.
any?
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
project
)
...
...
@@ -258,6 +263,7 @@ module QuickActions
end
params
'~label1 ~"label 2"'
condition
do
issuable
.
is_a?
(
Issuable
)
&&
issuable
.
persisted?
&&
issuable
.
labels
.
any?
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
project
)
...
...
@@ -318,6 +324,7 @@ module QuickActions
"Subscribes to this
#{
issuable
.
to_ability_name
.
humanize
(
capitalize:
false
)
}
."
end
condition
do
issuable
.
is_a?
(
Issuable
)
&&
issuable
.
persisted?
&&
!
issuable
.
subscribed?
(
current_user
,
project
)
end
...
...
@@ -330,6 +337,7 @@ module QuickActions
"Unsubscribes from this
#{
issuable
.
to_ability_name
.
humanize
(
capitalize:
false
)
}
."
end
condition
do
issuable
.
is_a?
(
Issuable
)
&&
issuable
.
persisted?
&&
issuable
.
subscribed?
(
current_user
,
project
)
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