Allow editing if there are no undeleted comments.
Patch by afuna.
diffs (26 lines):
diff -r f92bdbc5f35a -r c983aaae3857 cgi-bin/LJ/Comment.pm
--- a/cgi-bin/LJ/Comment.pm Mon Jul 20 15:46:42 2009 +0000
+++ b/cgi-bin/LJ/Comment.pm Mon Jul 20 10:58:34 2009 -0500
@@ -386,6 +386,11 @@ sub has_children {
my $self = shift;
return $self->children ? 1 : 0;
+}
+
+sub has_nondeleted_children {
+ my $nondeleted_children = grep { ! $_->is_deleted } $_[0]->children;
+ return $nondeleted_children ? 1 : 0;
}
# returns true if entry currently exists. (it's possible for a given
@@ -934,8 +939,8 @@ sub user_can_edit {
return 0;
}
- # comment cannot have any replies
- if ($self->has_children) {
+ # comment cannot have any replies; deleted comments don't count
+ if ($self->has_nondeleted_children) {
$$errref = LJ::Lang::ml('talk.error.cantedit.haschildren');
return 0;
}
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog