[tools 2/2] testbot/cgi: Don't offer to save the item if no field is editable.

Francois Gouget fgouget at codeweavers.com
Mon May 2 12:23:33 CDT 2022


This allows derived pages to offer a read-only view of the item details
just by overriding DisplayProperty().

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/ObjectModel/CGI/ItemPage.pm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/testbot/lib/ObjectModel/CGI/ItemPage.pm b/testbot/lib/ObjectModel/CGI/ItemPage.pm
index 1b77eea01..8bea816b0 100644
--- a/testbot/lib/ObjectModel/CGI/ItemPage.pm
+++ b/testbot/lib/ObjectModel/CGI/ItemPage.pm
@@ -132,10 +132,7 @@ sub GetActions($)
 {
   my ($self) = @_;
 
-  my @Actions = @{$self->SUPER::GetActions()};
-  push @Actions, "Save", "Cancel";
-
-  return \@Actions;
+  return $self->{HasRW} ? ["Save", "Cancel"] : [];
 }
 
 sub RedirectToList($)
-- 
2.30.2



More information about the wine-devel mailing list