Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
8f405c09
Commit
8f405c09
authored
Jan 02, 2016
by
Albert Ting
Committed by
Dylan Hardison
Jan 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 688205 - quoted text inside comments should wrap
r=dylan,a=dylan
parent
85ca54b4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
4 deletions
+38
-4
Comment.pm
Bugzilla/Comment.pm
+3
-0
Template.pm
Bugzilla/Template.pm
+7
-0
Util.pm
Bugzilla/Util.pm
+24
-1
Bug.pm
Bugzilla/WebService/Bug.pm
+4
-3
No files found.
Bugzilla/Comment.pm
View file @
8f405c09
...
...
@@ -272,6 +272,9 @@ sub body_full {
else
{
$body
=
$self
->
body
;
}
if
(
!
$self
->
is_markdown
and
!
$self
->
already_wrapped
)
{
$body
=
wrap_cite
(
$body
);
}
if
(
$params
->
{
wrap
}
and
!
$self
->
already_wrapped
)
{
$body
=
wrap_comment
(
$body
);
}
...
...
Bugzilla/Template.pm
View file @
8f405c09
...
...
@@ -972,6 +972,13 @@ sub create {
return
sub
{
wrap_comment
(
$_
[
0
],
$cols
)
}
},
1
],
# Wrap cited text
wrap_cite
=>
[
sub
{
my
(
$context
,
$cols
)
=
@_
;
return
sub
{
wrap_cite
(
$_
[
0
],
$cols
)
}
},
1
],
# We force filtering of every variable in key security-critical
# places; we have a none filter for people to use when they
# really, really don't want a variable to be changed.
...
...
Bugzilla/Util.pm
View file @
8f405c09
...
...
@@ -18,7 +18,7 @@ use parent qw(Exporter);
i_am_cgi i_am_webservice correct_urlbase remote_ip
validate_ip do_ssl_redirect_if_required use_attachbase
diff_arrays on_main_db
trim wrap_hard wrap_comment find_wrap_point
trim wrap_hard wrap_comment find_wrap_point
wrap_cite
format_time validate_date validate_time datetime_from
is_7bit_clean bz_crypt generate_random_password
validate_email_syntax check_email_syntax clean_text
...
...
@@ -456,6 +456,27 @@ sub wrap_comment {
return
$wrappedcomment
;
}
sub
wrap_cite
{
my
(
$comment
,
$cols
)
=
@_
;
my
$wrappedcomment
=
""
;
# Use 'local', as recommended by Text::Wrap's perldoc.
local
$
Text::Wrap::
columns
=
$cols
||
COMMENT_COLS
;
# Make words that are longer than COMMENT_COLS not wrap.
local
$
Text::Wrap::
huge
=
'overflow'
;
# Don't mess with tabs.
local
$
Text::Wrap::
unexpand
=
0
;
foreach
my
$line
(
split
(
/\r\n|\r|\n/
,
$comment
))
{
if
(
$line
=~
/^(>+ *)/
)
{
$wrappedcomment
.=
wrap
(
''
,
$1
,
$line
)
.
"\n"
;
}
else
{
$wrappedcomment
.=
$line
.
"\n"
;
}
}
return
$wrappedcomment
;
}
sub
find_wrap_point
{
my
(
$string
,
$maxpos
)
=
@_
;
if
(
!
$string
)
{
return
0
}
...
...
@@ -1244,4 +1265,6 @@ if Bugzilla is currently using the shadowdb or not. Used like:
=item display_value
=item wrap_cite
=back
Bugzilla/WebService/Bug.pm
View file @
8f405c09
...
...
@@ -342,9 +342,10 @@ sub render_comment {
Bugzilla
->
switch_to_shadow_db
();
my
$bug
=
$params
->
{
id
}
?
Bugzilla::
Bug
->
check
(
$params
->
{
id
})
:
undef
;
my
$markdown
=
$params
->
{
markdown
}
?
1
:
0
;
my
$tmpl
=
$markdown
?
'[% text FILTER markdown(bug, { is_markdown => 1 }) %]'
:
'[% text FILTER markdown(bug) %]'
;
my
$tmpl
=
$params
->
{
markdown
}
?
'[% text FILTER markdown(bug, { is_markdown => 1 }) %]'
:
'[% text FILTER wrap_cite FILTER markdown(bug) %]'
;
my
$html
;
my
$template
=
Bugzilla
->
template
;
$template
->
process
(
...
...
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