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
fcd44591
Commit
fcd44591
authored
Apr 05, 2015
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1143867: Optimize set_comment_is_private() and isopened()
r=dkl a=sgreen
parent
467bef6d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
17 deletions
+25
-17
Bug.pm
Bugzilla/Bug.pm
+25
-17
No files found.
Bugzilla/Bug.pm
View file @
fcd44591
...
@@ -2498,29 +2498,34 @@ sub reset_assigned_to {
...
@@ -2498,29 +2498,34 @@ sub reset_assigned_to {
}
}
sub
set_bug_ignored
{
$_
[
0
]
->
set
(
'bug_ignored'
,
$_
[
1
]);
}
sub
set_bug_ignored
{
$_
[
0
]
->
set
(
'bug_ignored'
,
$_
[
1
]);
}
sub
set_cclist_accessible
{
$_
[
0
]
->
set
(
'cclist_accessible'
,
$_
[
1
]);
}
sub
set_cclist_accessible
{
$_
[
0
]
->
set
(
'cclist_accessible'
,
$_
[
1
]);
}
sub
set_comment_is_private
{
sub
set_comment_is_private
{
my
(
$self
,
$comment_id
,
$isprivate
)
=
@_
;
my
(
$self
,
$comments
,
$isprivate
)
=
@_
;
$self
->
{
comment_isprivate
}
||=
[]
;
my
$is_insider
=
Bugzilla
->
user
->
is_insider
;
$comments
=
{
$comments
=>
$isprivate
}
unless
ref
$comments
;
# We also allow people to pass in a hash of comment ids to update.
foreach
my
$comment
(
@
{
$self
->
comments
})
{
if
(
ref
$comment_id
)
{
# Skip unmodified comment privacy.
while
(
my
(
$id
,
$is
)
=
each
%
$comment_id
)
{
next
unless
exists
$comments
->
{
$comment
->
id
};
$self
->
set_comment_is_private
(
$id
,
$is
);
my
$isprivate
=
delete
$comments
->
{
$comment
->
id
}
?
1
:
0
;
if
(
$isprivate
!=
$comment
->
is_private
)
{
ThrowUserError
(
'user_not_insider'
)
unless
$is_insider
;
$comment
->
set_is_private
(
$isprivate
);
push
@
{
$self
->
{
comment_isprivate
}},
$comment
;
}
}
return
;
}
}
my
(
$comment
)
=
grep
(
$comment_id
==
$_
->
id
,
@
{
$self
->
comments
});
# If there are still entries in $comments, then they are illegal.
ThrowUserError
(
'comment_invalid_isprivate'
,
{
id
=>
$comment_id
})
ThrowUserError
(
'comment_invalid_isprivate'
,
{
id
=>
join
(
', '
,
keys
%
$comments
)
})
if
!
$comment
;
if
scalar
keys
%
$comments
;
$isprivate
=
$isprivate
?
1
:
0
;
# If no comment privacy has been modified, remove this key.
if
(
$isprivate
!=
$comment
->
is_private
)
{
delete
$self
->
{
comment_isprivate
}
unless
scalar
@
{
$self
->
{
comment_isprivate
}};
ThrowUserError
(
'user_not_insider'
)
if
!
Bugzilla
->
user
->
is_insider
;
$self
->
{
comment_isprivate
}
||=
[]
;
$comment
->
set_is_private
(
$isprivate
);
push
@
{
$self
->
{
comment_isprivate
}},
$comment
;
}
}
}
sub
set_component
{
sub
set_component
{
my
(
$self
,
$name
)
=
@_
;
my
(
$self
,
$name
)
=
@_
;
my
$old_comp
=
$self
->
component_obj
;
my
$old_comp
=
$self
->
component_obj
;
...
@@ -3579,7 +3584,10 @@ sub flags {
...
@@ -3579,7 +3584,10 @@ sub flags {
sub
isopened
{
sub
isopened
{
my
$self
=
shift
;
my
$self
=
shift
;
return
is_open_state
(
$self
->
{
bug_status
})
?
1
:
0
;
unless
(
exists
$self
->
{
isopened
})
{
$self
->
{
isopened
}
=
is_open_state
(
$self
->
{
bug_status
})
?
1
:
0
;
}
return
$self
->
{
isopened
};
}
}
sub
keywords
{
sub
keywords
{
...
...
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