Francois Gouget : testbot/web: Reuse $self-> {Job} instead of reloading the Job everywhere.
Alexandre Julliard
julliard at winehq.org
Fri Mar 2 08:59:41 CST 2018
Module: tools
Branch: master
Commit: 5f98526e32fefd953fe7095a55693ebaedff93e8
URL: https://source.winehq.org/git/tools.git/?a=commit;h=5f98526e32fefd953fe7095a55693ebaedff93e8
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Fri Mar 2 01:25:38 2018 +0100
testbot/web: Reuse $self->{Job} instead of reloading the Job everywhere.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/web/JobDetails.pl | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/testbot/web/JobDetails.pl b/testbot/web/JobDetails.pl
index 7ca7889..923ef97 100644
--- a/testbot/web/JobDetails.pl
+++ b/testbot/web/JobDetails.pl
@@ -91,8 +91,7 @@ sub CanCancel($)
{
my ($self) = @_;
- my $Job = CreateJobs()->GetItem($self->{JobId});
- my $Status = $Job->Status;
+ my $Status = $self->{Job}->Status;
if ($Status ne "queued" && $Status ne "running")
{
return "Job already $Status";
@@ -105,7 +104,7 @@ sub CanCancel($)
}
my $CurrentUser = $Session->User;
if (! $CurrentUser->HasRole("admin") &&
- $Job->User->GetKey() ne $CurrentUser->GetKey())
+ $self->{Job}->User->GetKey() ne $CurrentUser->GetKey())
{
return "You are not authorized to cancel this job";
}
@@ -117,8 +116,7 @@ sub CanRestart($)
{
my ($self) = @_;
- my $Job = CreateJobs()->GetItem($self->{JobId});
- my $Status = $Job->Status;
+ my $Status = $self->{Job}->Status;
if ($Status ne "boterror" && $Status ne "canceled")
{
return "Not a failed / canceled Job";
@@ -131,7 +129,7 @@ sub CanRestart($)
}
my $CurrentUser = $Session->User;
if (! $CurrentUser->HasRole("admin") &&
- $Job->User->GetKey() ne $CurrentUser->GetKey()) # FIXME: Admin only?
+ $self->{Job}->User->GetKey() ne $CurrentUser->GetKey()) # FIXME: Admin only?
{
return "You are not authorized to restart this job";
}
More information about the wine-cvs
mailing list