[dw-free] /directorysearch returns errors
[commit: http://hg.dwscoalition.org/dw-free/rev/87229f3e4dff]
http://bugs.dwscoalition.org/show_bug.cgi?id=448
Missed files for fixing the directorysearch errors.
Patch by
janinedog.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=448
Missed files for fixing the directorysearch errors.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/LJ/Directory/Constraint/MemberOf.pm
- cgi-bin/LJ/Directory/Constraint/TrustedBy.pm
- cgi-bin/LJ/Directory/Constraint/Trusts.pm
- cgi-bin/LJ/Directory/Constraint/WatchedBy.pm
- cgi-bin/LJ/Directory/Constraint/Watches.pm
-------------------------------------------------------------------------------- diff -r 6431dc1bf28b -r 87229f3e4dff cgi-bin/LJ/Directory/Constraint/MemberOf.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/LJ/Directory/Constraint/MemberOf.pm Mon Apr 06 05:13:35 2009 +0000 @@ -0,0 +1,53 @@ +#!/usr/bin/perl +# +# LJ::Directory::Constraint::MemberOf +# +# This defines the directory constraint for getting the list of userids that +# are members of the given community. +# +# Authors: +# Janine Costanzo <janine@netrophic.com> +# +# Copyright (c) 2009 by Dreamwidth Studios, LLC. +# +# This program is free software; you may redistribute it and/or modify it under +# the same terms as Perl itself. For a copy of the license, please reference +# 'perldoc perlartistic' or 'perldoc perlgpl'. +# + +package LJ::Directory::Constraint::MemberOf; +use strict; +use warnings; +use base 'LJ::Directory::Constraint'; +use Carp qw( croak ); + +sub new { + my ( $pkg, %args ) = @_; + my $self = bless {}, $pkg; + $self->{$_} = delete $args{$_} foreach qw( userid user ); + croak "unknown args" if %args; + return $self; +} + +sub new_from_formargs { + my ( $pkg, $args ) = @_; + return undef unless $args->{user_is_member} xor $args->{userid_is_member}; + return $pkg->new( user => $args->{user_is_member}, + userid => $args->{userid_is_member} ); +} + +sub cache_for { 5 * 60 } + +sub u { + my $self = shift; + return $self->{u} if $self->{u}; + $self->{u} = $self->{userid} ? LJ::load_userid( $self->{userid} ) : LJ::load_user( $self->{user} ); +} + +sub matching_uids { + my $self = shift; + my $u = $self->u or return (); + return $u->member_userids; +} + +1; diff -r 6431dc1bf28b -r 87229f3e4dff cgi-bin/LJ/Directory/Constraint/TrustedBy.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/LJ/Directory/Constraint/TrustedBy.pm Mon Apr 06 05:13:35 2009 +0000 @@ -0,0 +1,53 @@ +#!/usr/bin/perl +# +# LJ::Directory::Constraint::TrustedBy +# +# This defines the directory constraint for getting the list of userids that +# are trusted by the given user. +# +# Authors: +# Janine Costanzo <janine@netrophic.com> +# +# Copyright (c) 2009 by Dreamwidth Studios, LLC. +# +# This program is free software; you may redistribute it and/or modify it under +# the same terms as Perl itself. For a copy of the license, please reference +# 'perldoc perlartistic' or 'perldoc perlgpl'. +# + +package LJ::Directory::Constraint::TrustedBy; +use strict; +use warnings; +use base 'LJ::Directory::Constraint'; +use Carp qw( croak ); + +sub new { + my ( $pkg, %args ) = @_; + my $self = bless {}, $pkg; + $self->{$_} = delete $args{$_} foreach qw( userid user ); + croak "unknown args" if %args; + return $self; +} + +sub new_from_formargs { + my ( $pkg, $args ) = @_; + return undef unless $args->{user_trusted_by} xor $args->{userid_trusted_by}; + return $pkg->new( user => $args->{user_trusted_by}, + userid => $args->{userid_trusted_by} ); +} + +sub cache_for { 5 * 60 } + +sub u { + my $self = shift; + return $self->{u} if $self->{u}; + $self->{u} = $self->{userid} ? LJ::load_userid( $self->{userid} ) : LJ::load_user( $self->{user} ); +} + +sub matching_uids { + my $self = shift; + my $u = $self->u or return (); + return $u->trusted_userids; +} + +1; diff -r 6431dc1bf28b -r 87229f3e4dff cgi-bin/LJ/Directory/Constraint/Trusts.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/LJ/Directory/Constraint/Trusts.pm Mon Apr 06 05:13:35 2009 +0000 @@ -0,0 +1,53 @@ +#!/usr/bin/perl +# +# LJ::Directory::Constraint::Trusts +# +# This defines the directory constraint for getting the list of userids that +# trust the given user. +# +# Authors: +# Janine Costanzo <janine@netrophic.com> +# +# Copyright (c) 2009 by Dreamwidth Studios, LLC. +# +# This program is free software; you may redistribute it and/or modify it under +# the same terms as Perl itself. For a copy of the license, please reference +# 'perldoc perlartistic' or 'perldoc perlgpl'. +# + +package LJ::Directory::Constraint::Trusts; +use strict; +use warnings; +use base 'LJ::Directory::Constraint'; +use Carp qw( croak ); + +sub new { + my ( $pkg, %args ) = @_; + my $self = bless {}, $pkg; + $self->{$_} = delete $args{$_} foreach qw( userid user ); + croak "unknown args" if %args; + return $self; +} + +sub new_from_formargs { + my ( $pkg, $args ) = @_; + return undef unless $args->{user_trusts} xor $args->{userid_trusts}; + return $pkg->new( user => $args->{user_trusts}, + userid => $args->{userid_trusts} ); +} + +sub cache_for { 5 * 60 } + +sub u { + my $self = shift; + return $self->{u} if $self->{u}; + $self->{u} = $self->{userid} ? LJ::load_userid( $self->{userid} ) : LJ::load_user( $self->{user} ); +} + +sub matching_uids { + my $self = shift; + my $u = $self->u or return (); + return $u->trusted_by_userids; +} + +1; diff -r 6431dc1bf28b -r 87229f3e4dff cgi-bin/LJ/Directory/Constraint/WatchedBy.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/LJ/Directory/Constraint/WatchedBy.pm Mon Apr 06 05:13:35 2009 +0000 @@ -0,0 +1,53 @@ +#!/usr/bin/perl +# +# LJ::Directory::Constraint::WatchedBy +# +# This defines the directory constraint for getting the list of userids that +# are watched by the given user. +# +# Authors: +# Janine Costanzo <janine@netrophic.com> +# +# Copyright (c) 2009 by Dreamwidth Studios, LLC. +# +# This program is free software; you may redistribute it and/or modify it under +# the same terms as Perl itself. For a copy of the license, please reference +# 'perldoc perlartistic' or 'perldoc perlgpl'. +# + +package LJ::Directory::Constraint::WatchedBy; +use strict; +use warnings; +use base 'LJ::Directory::Constraint'; +use Carp qw( croak ); + +sub new { + my ( $pkg, %args ) = @_; + my $self = bless {}, $pkg; + $self->{$_} = delete $args{$_} foreach qw( userid user ); + croak "unknown args" if %args; + return $self; +} + +sub new_from_formargs { + my ( $pkg, $args ) = @_; + return undef unless $args->{user_watched_by} xor $args->{userid_watched_by}; + return $pkg->new( user => $args->{user_watched_by}, + userid => $args->{userid_watched_by} ); +} + +sub cache_for { 5 * 60 } + +sub u { + my $self = shift; + return $self->{u} if $self->{u}; + $self->{u} = $self->{userid} ? LJ::load_userid( $self->{userid} ) : LJ::load_user( $self->{user} ); +} + +sub matching_uids { + my $self = shift; + my $u = $self->u or return (); + return $u->watched_userids; +} + +1; diff -r 6431dc1bf28b -r 87229f3e4dff cgi-bin/LJ/Directory/Constraint/Watches.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/LJ/Directory/Constraint/Watches.pm Mon Apr 06 05:13:35 2009 +0000 @@ -0,0 +1,53 @@ +#!/usr/bin/perl +# +# LJ::Directory::Constraint::Watches +# +# This defines the directory constraint for getting the list of userids that +# watch the given user. +# +# Authors: +# Janine Costanzo <janine@netrophic.com> +# +# Copyright (c) 2009 by Dreamwidth Studios, LLC. +# +# This program is free software; you may redistribute it and/or modify it under +# the same terms as Perl itself. For a copy of the license, please reference +# 'perldoc perlartistic' or 'perldoc perlgpl'. +# + +package LJ::Directory::Constraint::Watches; +use strict; +use warnings; +use base 'LJ::Directory::Constraint'; +use Carp qw( croak ); + +sub new { + my ( $pkg, %args ) = @_; + my $self = bless {}, $pkg; + $self->{$_} = delete $args{$_} foreach qw( userid user ); + croak "unknown args" if %args; + return $self; +} + +sub new_from_formargs { + my ( $pkg, $args ) = @_; + return undef unless $args->{user_watches} xor $args->{userid_watches}; + return $pkg->new( user => $args->{user_watches}, + userid => $args->{userid_watches} ); +} + +sub cache_for { 5 * 60 } + +sub u { + my $self = shift; + return $self->{u} if $self->{u}; + $self->{u} = $self->{userid} ? LJ::load_userid( $self->{userid} ) : LJ::load_user( $self->{user} ); +} + +sub matching_uids { + my $self = shift; + my $u = $self->u or return (); + return $u->watched_by_userids; +} + +1; --------------------------------------------------------------------------------