Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web-apps
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
Boris Kocherov
web-apps
Commits
ccded151
Commit
ccded151
authored
Aug 09, 2016
by
Julia Radzhabova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Bug 32934.
parent
0c14aeb1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
28 deletions
+30
-28
apps/common/main/lib/view/Chat.js
apps/common/main/lib/view/Chat.js
+15
-14
apps/common/main/lib/view/Comments.js
apps/common/main/lib/view/Comments.js
+15
-14
No files found.
apps/common/main/lib/view/Chat.js
View file @
ccded151
...
...
@@ -227,14 +227,15 @@ define([
_pickLink
:
function
(
message
)
{
var
arr
=
[],
offset
,
len
;
message
.
replace
(
Common
.
Utils
.
emailStrongRe
,
function
(
subStr
)
{
var
ref
=
(
!
/
((
^mailto:
)\/\/)
/i
.
test
(
subStr
)
)
?
(
'
mailto:
'
+
subStr
)
:
subStr
;
message
.
replace
(
Common
.
Utils
.
ipStrongRe
,
function
(
subStr
)
{
offset
=
arguments
[
arguments
.
length
-
2
];
arr
.
push
({
start
:
offset
,
end
:
subStr
.
length
+
offset
,
str
:
'
<a href="
'
+
ref
+
'
">
'
+
subStr
+
'
</a>
'
});
arr
.
push
({
start
:
offset
,
end
:
subStr
.
length
+
offset
,
str
:
'
<a href="
'
+
subStr
+
'
" target="_blank" data-can-copy="true
">
'
+
subStr
+
'
</a>
'
});
return
''
;
});
message
.
replace
(
Common
.
Utils
.
ipStrongRe
,
function
(
subStr
)
{
if
(
message
.
length
<
1000
||
message
.
search
(
/
\S{255,}
/
)
<
0
)
message
.
replace
(
Common
.
Utils
.
hostnameStrongRe
,
function
(
subStr
)
{
var
ref
=
(
!
/
(((
^https
?)
|
(
^ftp
))
:
\/\/)
/i
.
test
(
subStr
)
)
?
(
'
http://
'
+
subStr
)
:
subStr
;
offset
=
arguments
[
arguments
.
length
-
2
];
len
=
subStr
.
length
;
var
elem
=
_
.
find
(
arr
,
function
(
item
){
...
...
@@ -242,13 +243,12 @@ define([
(
offset
<=
item
.
start
)
&&
(
offset
+
len
>
item
.
start
));
});
if
(
!
elem
)
arr
.
push
({
start
:
offset
,
end
:
len
+
offset
,
str
:
'
<a href="
'
+
subStr
+
'
" target="_blank" data-can-copy="true">
'
+
subStr
+
'
</a>
'
});
arr
.
push
({
start
:
offset
,
end
:
len
+
offset
,
str
:
'
<a href="
'
+
ref
+
'
" target="_blank" data-can-copy="true">
'
+
subStr
+
'
</a>
'
});
return
''
;
});
if
(
message
.
length
<
1000
||
message
.
search
(
/
\S{255,}
/
)
<
0
)
message
.
replace
(
Common
.
Utils
.
hostnameStrongRe
,
function
(
subStr
)
{
var
ref
=
(
!
/
(((
^https
?)
|
(
^ftp
))
:
\/\/)
/i
.
test
(
subStr
)
)
?
(
'
http://
'
+
subStr
)
:
subStr
;
message
.
replace
(
Common
.
Utils
.
emailStrongRe
,
function
(
subStr
)
{
var
ref
=
(
!
/
((
^mailto:
)\/\/)
/i
.
test
(
subStr
)
)
?
(
'
mailto:
'
+
subStr
)
:
subStr
;
offset
=
arguments
[
arguments
.
length
-
2
];
len
=
subStr
.
length
;
var
elem
=
_
.
find
(
arr
,
function
(
item
){
...
...
@@ -256,9 +256,10 @@ define([
(
offset
<=
item
.
start
)
&&
(
offset
+
len
>
item
.
start
));
});
if
(
!
elem
)
arr
.
push
({
start
:
offset
,
end
:
len
+
offset
,
str
:
'
<a href="
'
+
ref
+
'
" target="_blank" data-can-copy="true
">
'
+
subStr
+
'
</a>
'
});
arr
.
push
({
start
:
offset
,
end
:
len
+
offset
,
str
:
'
<a href="
'
+
ref
+
'
">
'
+
subStr
+
'
</a>
'
});
return
''
;
});
arr
=
_
.
sortBy
(
arr
,
function
(
item
){
return
item
.
start
;
});
var
str_res
=
(
arr
.
length
>
0
)
?
(
message
.
substring
(
0
,
arr
[
0
].
start
)
+
arr
[
0
].
str
)
:
message
;
...
...
apps/common/main/lib/view/Comments.js
View file @
ccded151
...
...
@@ -1356,14 +1356,15 @@ define([
var
arr
=
[],
offset
,
len
;
message
=
Common
.
Utils
.
String
.
htmlEncode
(
message
);
message
.
replace
(
Common
.
Utils
.
emailStrongRe
,
function
(
subStr
)
{
var
ref
=
(
!
/
((
^mailto:
)\/\/)
/i
.
test
(
subStr
)
)
?
(
'
mailto:
'
+
subStr
)
:
subStr
;
message
.
replace
(
Common
.
Utils
.
ipStrongRe
,
function
(
subStr
)
{
offset
=
arguments
[
arguments
.
length
-
2
];
arr
.
push
({
start
:
offset
,
end
:
subStr
.
length
+
offset
,
str
:
'
<a href="
'
+
ref
+
'
">
'
+
subStr
+
'
</a>
'
});
arr
.
push
({
start
:
offset
,
end
:
subStr
.
length
+
offset
,
str
:
'
<a href="
'
+
subStr
+
'
" target="_blank" data-can-copy="true
">
'
+
subStr
+
'
</a>
'
});
return
''
;
});
message
.
replace
(
Common
.
Utils
.
ipStrongRe
,
function
(
subStr
)
{
if
(
message
.
length
<
1000
||
message
.
search
(
/
\S{255,}
/
)
<
0
)
message
.
replace
(
Common
.
Utils
.
hostnameStrongRe
,
function
(
subStr
)
{
var
ref
=
(
!
/
(((
^https
?)
|
(
^ftp
))
:
\/\/)
/i
.
test
(
subStr
)
)
?
(
'
http://
'
+
subStr
)
:
subStr
;
offset
=
arguments
[
arguments
.
length
-
2
];
len
=
subStr
.
length
;
var
elem
=
_
.
find
(
arr
,
function
(
item
){
...
...
@@ -1371,13 +1372,12 @@ define([
(
offset
<=
item
.
start
)
&&
(
offset
+
len
>
item
.
start
));
});
if
(
!
elem
)
arr
.
push
({
start
:
offset
,
end
:
len
+
offset
,
str
:
'
<a href="
'
+
subStr
+
'
" target="_blank" data-can-copy="true">
'
+
subStr
+
'
</a>
'
});
arr
.
push
({
start
:
offset
,
end
:
len
+
offset
,
str
:
'
<a href="
'
+
ref
+
'
" target="_blank" data-can-copy="true">
'
+
subStr
+
'
</a>
'
});
return
''
;
});
if
(
message
.
length
<
1000
||
message
.
search
(
/
\S{255,}
/
)
<
0
)
message
.
replace
(
Common
.
Utils
.
hostnameStrongRe
,
function
(
subStr
)
{
var
ref
=
(
!
/
(((
^https
?)
|
(
^ftp
))
:
\/\/)
/i
.
test
(
subStr
)
)
?
(
'
http://
'
+
subStr
)
:
subStr
;
message
.
replace
(
Common
.
Utils
.
emailStrongRe
,
function
(
subStr
)
{
var
ref
=
(
!
/
((
^mailto:
)\/\/)
/i
.
test
(
subStr
)
)
?
(
'
mailto:
'
+
subStr
)
:
subStr
;
offset
=
arguments
[
arguments
.
length
-
2
];
len
=
subStr
.
length
;
var
elem
=
_
.
find
(
arr
,
function
(
item
){
...
...
@@ -1385,9 +1385,10 @@ define([
(
offset
<=
item
.
start
)
&&
(
offset
+
len
>
item
.
start
));
});
if
(
!
elem
)
arr
.
push
({
start
:
offset
,
end
:
len
+
offset
,
str
:
'
<a href="
'
+
ref
+
'
" target="_blank" data-can-copy="true
">
'
+
subStr
+
'
</a>
'
});
arr
.
push
({
start
:
offset
,
end
:
len
+
offset
,
str
:
'
<a href="
'
+
ref
+
'
">
'
+
subStr
+
'
</a>
'
});
return
''
;
});
arr
=
_
.
sortBy
(
arr
,
function
(
item
){
return
item
.
start
;
});
var
str_res
=
(
arr
.
length
>
0
)
?
(
message
.
substring
(
0
,
arr
[
0
].
start
)
+
arr
[
0
].
str
)
:
message
;
...
...
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