mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2011-12-30 04:54 am

[dw-free] allow maintainers to import communities from other sites

[commit: http://hg.dwscoalition.org/dw-free/rev/03201efd6296]

http://bugs.dwscoalition.org/show_bug.cgi?id=2391

* Editing posts in imported comms didn't work because of the backdate
restriction for communities. If the entry was imported, allow it to keep the
backdated property.

* Lift the restriction on editing posts in communities you can't post to.
You are now allowed to edit any post you have made, regardless of your
current access to the community.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/LJ/Protocol.pm
  • htdocs/editjournal.bml
--------------------------------------------------------------------------------
diff -r c8fe0c416b76 -r 03201efd6296 cgi-bin/LJ/Protocol.pm
--- a/cgi-bin/LJ/Protocol.pm	Fri Dec 30 01:52:42 2011 +0000
+++ b/cgi-bin/LJ/Protocol.pm	Fri Dec 30 04:59:07 2011 +0000
@@ -1911,9 +1911,11 @@
     return fail($err, 210)
         if $req->{event} eq $CannotBeShown;
 
-    # don't allow backdated posts in communities
-    return fail($err,152) if
-        $req->{props}->{opt_backdated} && $uowner->is_community;
+    # don't allow backdated posts in communities... unless this is an import
+    if ( $req->{props}->{opt_backdated} && $uowner->is_community ) {
+        return fail($err, 152)
+            unless $curprops{$itemid}->{import_source};
+    }
 
     # make year/mon/day/hour/min optional in an edit event,
     # and just inherit their old values
@@ -1946,6 +1948,7 @@
             $props_byname{$key} = $req->{'props'}->{$key};
         }
     }
+
     # additionally, if the 'opt_nocomments_maintainer' prop was set before and the poster now sets
     # 'opt_nocomments' to 0 again, 'opt_nocomments_maintainer' should be set to 0 again, as well
     # so comments are enabled again
diff -r c8fe0c416b76 -r 03201efd6296 htdocs/editjournal.bml
--- a/htdocs/editjournal.bml	Fri Dec 30 01:52:42 2011 +0000
+++ b/htdocs/editjournal.bml	Fri Dec 30 04:59:07 2011 +0000
@@ -174,7 +174,6 @@
                 $disabled_delete = ! $u->can_manage( $usejournal_u );
                 $disabled_save++;
             }
-            $disabled_save++ if $usejournal && ! $u->can_post_to( $usejournal_u );
             $disabled_spamdelete = $disabled_delete || !$usejournal || ($res{'events_1_poster'} eq $u->{'user'});
             $disabled_spamdelete ||= LJ::sysban_check( 'spamreport', $usejournal_u->user ) if $usejournal_u;
 
--------------------------------------------------------------------------------