@@ -99,7 +99,7 @@ sub Create {
99
99
my %args = ( Group => ' ' ,
100
100
Member => ' ' ,
101
101
ImmediateParent => ' ' ,
102
- Via => ' 0 ' ,
102
+ Via => undef ,
103
103
Disabled => ' 0' ,
104
104
@_ );
105
105
@@ -141,7 +141,12 @@ sub Create {
141
141
. $args {' Via' } );
142
142
return (undef ); # this will percolate up and bail out of the transaction
143
143
}
144
- if ( $self -> __Value(' Via' ) == 0 ) {
144
+
145
+ # Check $args{Via} instead of __Value('Via') to avoid cache issues on
146
+ # SQLite that may reuse ids: t/validator/group_members.t fails with
147
+ # __Value('Via')
148
+
149
+ if ( !$args {Via } ) {
145
150
my ( $vid , $vmsg ) = $self -> __Set( Field => ' Via' , Value => $id );
146
151
unless ($vid ) {
147
152
$RT::Logger -> warning( " Due to a via error, couldn't create "
@@ -181,44 +186,6 @@ sub Create {
181
186
182
187
183
188
184
- =head2 Delete
185
-
186
- Deletes the current CachedGroupMember from the group it's in and
187
- cascades the delete to all submembers.
188
-
189
- =cut
190
-
191
- sub Delete {
192
- my $self = shift ;
193
-
194
-
195
- my $member = $self -> MemberObj();
196
- if ( $member -> IsGroup ) {
197
- my $deletable = RT::CachedGroupMembers-> new( $self -> CurrentUser );
198
-
199
- $deletable -> Limit( FIELD => ' id' ,
200
- OPERATOR => ' !=' ,
201
- VALUE => $self -> id );
202
- $deletable -> Limit( FIELD => ' Via' ,
203
- OPERATOR => ' =' ,
204
- VALUE => $self -> id );
205
-
206
- while ( my $kid = $deletable -> Next ) {
207
- my ($ok , $msg ) = $kid -> Delete();
208
- unless ($ok ) {
209
- $RT::Logger -> error(
210
- " Couldn't delete CachedGroupMember " . $kid -> Id );
211
- return ($ok , $msg );
212
- }
213
- }
214
- }
215
- my ($ok , $msg ) = $self -> SUPER::Delete();
216
- $RT::Logger -> error( " Couldn't delete CachedGroupMember " . $self -> Id ) unless $ok ;
217
- return ($ok , $msg );
218
- }
219
-
220
-
221
-
222
189
=head2 SetDisabled
223
190
224
191
SetDisableds the current CachedGroupMember from the group it's in and cascades
0 commit comments