LJSUP-17669: Login.bml form refactoring
[livejournal.git] / cgi-bin / LJ / Event / CommunityMantioned.pm
blobf65c5ec12a85d33bc40eb372c06224d05c4e3f47
1 package LJ::Event::CommunityMantioned;
2 use strict;
3 use Class::Autouse qw(LJ::Entry);
4 use Carp qw(croak);
5 use base 'LJ::Event';
7 sub new {
8 my ($class, $u, $fromu, $commu) = @_;
9 foreach ($u, $fromu, $commu) {
10 LJ::errobj('Event::CommunityMantioned', u => $_)->throw unless LJ::isu($_);
13 return $class->SUPER::new($u, $fromu->{userid}, $commu->{userid});
16 sub is_common { 0 }
17 sub available_for_user { 1 }
19 sub is_subscription_visible_to {
20 my ($class, $u) = @_;
22 return 0 if ($class->{user}->prop('pingback') eq 'D');
23 return 1 if $u->can_manage($class->{user});
24 return 0;
27 sub subscription_as_html {
28 my ($class, $subscr) = @_;
29 my $journal = $subscr->journal or croak "No user";
31 return LJ::Lang::ml('event.comm_mantioned', { community => $journal->ljuser_display } );
34 sub is_subscription_ntype_disabled_for {
35 my ($self, $ntypeid, $u) = @_;
37 return 0 if $ntypeid == LJ::NotificationMethod::Email->ntypeid;
38 return 1;
43 package LJ::Error::Event::CommunityMantioned;
44 sub fields { 'u' }
45 sub as_string {
46 my $self = shift;
47 return "LJ::Event::CommuinityMantioned passed bogus u object: $self->{u}";