[dw-free] warn if you are about to send a PM with no text
[commit: http://hg.dwscoalition.org/dw-free/rev/b19aa1d9e107]
http://bugs.dwscoalition.org/show_bug.cgi?id=813
Warn the user on the first attempt; allow on the second attempt.
Patch by
meowth.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=813
Warn the user on the first attempt; allow on the second attempt.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- htdocs/inbox/compose.bml
- htdocs/inbox/compose.bml.text
-------------------------------------------------------------------------------- diff -r 8669cb208a92 -r b19aa1d9e107 htdocs/inbox/compose.bml --- a/htdocs/inbox/compose.bml Sat Oct 17 00:24:32 2009 +0000 +++ b/htdocs/inbox/compose.bml Fri Oct 16 23:48:00 2009 -0500 @@ -33,6 +33,7 @@ body<= my $msg_body = ''; # reply body my $msg_parent = ''; # Hidden msg field containing id of parent message my $msg_limit = LJ::get_cap($remote, "usermessage_length"); + my $force = 0; # flag for if user wants to force an empty PM my @errors; @@ -60,6 +61,13 @@ body<= { msg_length => LJ::commafy( $msg_len_c ), => msg_limit -> LJ::commafy( $msg_limit ) } ) unless ($msg_len_c <= $msg_limit); + + # checks if the PM is empty (no text) + $force = $POST{'force'}; + unless ( $msg_len_c > 0 || $force ) { + push @errors, $ML{'.warning.empty.message'}; + $force = 1; + } # Get list of recipients my $to_field = $POST{'msg_to'}; @@ -225,6 +233,9 @@ body<= }); } + $body .= LJ::html_hidden( { name => 'force', + value => $force, + id => 'force' } ); $body .= "</p>\n"; # autocomplete To field with trusted and watched people my @flist = (); diff -r 8669cb208a92 -r b19aa1d9e107 htdocs/inbox/compose.bml.text --- a/htdocs/inbox/compose.bml.text Sat Oct 17 00:24:32 2009 +0000 +++ b/htdocs/inbox/compose.bml.text Fri Oct 16 23:48:00 2009 -0500 @@ -29,3 +29,5 @@ .messaging.disabled=User messaging is currently disabled .suspended.cannot.send=Suspended accounts are not allowed to send private messages + +.warning.empty.message=Warning: You are trying to send a message with no text. Please resubmit if this is correct. --------------------------------------------------------------------------------