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
2022243a
Commit
2022243a
authored
Jul 21, 2018
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create empty Commits::UpdateService and wire it up
parent
d23fbbc6
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 @
2022243a
...
...
@@ -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 @
2022243a
class
CommitPolicy
<
BasePolicy
delegate
{
@subject
.
project
}
end
app/services/commits/update_service.rb
0 → 100644
View file @
2022243a
# 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 @
2022243a
...
...
@@ -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 @
2022243a
...
...
@@ -60,6 +60,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
)
...
...
@@ -75,6 +76,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
)
...
...
@@ -149,6 +151,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
)
...
...
@@ -188,6 +191,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
)
...
...
@@ -231,6 +235,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
)
...
...
@@ -257,6 +262,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
)
...
...
@@ -317,6 +323,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
...
...
@@ -329,6 +336,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