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
d17b0580
Commit
d17b0580
authored
Apr 21, 2021
by
Robert May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move path fix to broadcast_message model
parent
6f1f5c71
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
app/models/broadcast_message.rb
app/models/broadcast_message.rb
+8
-0
app/services/post_receive_service.rb
app/services/post_receive_service.rb
+2
-6
No files found.
app/models/broadcast_message.rb
View file @
d17b0580
...
...
@@ -106,6 +106,14 @@ class BroadcastMessage < ApplicationRecord
return
false
if
current_path
.
blank?
&&
target_path
.
present?
return
true
if
current_path
.
blank?
||
target_path
.
blank?
# Ensure paths are consistent across callers.
# This fixes a mismatch between requests in the GUI and CLI
#
# This has to be reassigned due to frozen strings being provided.
unless
current_path
.
start_with?
(
"/"
)
current_path
=
"/
#{
current_path
}
"
end
escaped
=
Regexp
.
escape
(
target_path
).
gsub
(
'\\*'
,
'.*'
)
regexp
=
Regexp
.
new
"^
#{
escaped
}
$"
,
Regexp
::
IGNORECASE
...
...
app/services/post_receive_service.rb
View file @
d17b0580
...
...
@@ -81,12 +81,8 @@ class PostReceiveService
banner
=
nil
if
project
# This provides the path in a similar manner to the frontend passing
# the request path, improving regex matching.
path
=
"/
#{
project
.
full_path
}
"
scoped_messages
=
BroadcastMessage
.
current_banner_messages
(
path
).
select
do
|
message
|
message
.
target_path
.
present?
&&
message
.
matches_current_path
(
path
)
scoped_messages
=
BroadcastMessage
.
current_banner_messages
(
project
.
full_path
).
select
do
|
message
|
message
.
target_path
.
present?
&&
message
.
matches_current_path
(
project
.
full_path
)
end
banner
=
scoped_messages
.
last
...
...
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