https://bugzilla.wikimedia.org/show_bug.cgi?id=4488


P.Copp <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
Attachment #5823 is|0                           |1
           obsolete|                            |




--- Comment #9 from P.Copp <[email protected]>  2009-12-02 23:46:56 
UTC ---
Created an attachment (id=6853)
 --> (https://bugzilla.wikimedia.org/attachment.cgi?id=6853)
Updated patch for new pref system

Oops, didn't realize someone commented on this one :D

(In reply to comment #8)
> Proposed patch seems to include a strange movement of watch/unwatch logic to
> the Title object. This doesn't make sense, because you watch the article, not
> the title.
>
It's rather a small addition than a move. The problem is that the Title object
caches, whether the page is watched or not in its member ->mWatched. Currenty,
when we watch/unwatch a page, this member is not updated, so any following
calls of $title->userIsWatching() will return the wrong result.
So I changed the calls from $wgUser->addWatch( $title ) to $title->watch(),
which will update the member var and call $wgUser->addWatch( $this ) itself.


> -               # If there were errors, bail out now
> -               if( !empty( $errors ) )
> -                       return $errors;
> 
> -               return $this->commitRollback($fromP, $summary, $bot,
> $resultDetails);
> +               if( empty( $errors ) ) {
> +                       $errors = $this->commitRollback($fromP, $summary, 
> $bot,
> $resultDetails);
> +               }
> +               if( empty( $errors ) && $wgUser->getOption( 'watchrollback' )
> && !$this->mTitle->userIsWatching() ) {
> +                       $this->doWatch();
> +               }
> +               return $errors;
> 
> I think I like the early bail-out better. It avoids the clutter of checking
> empty($errors).
> 
I moved the second if-Statement into the first one now, so I think there
shouldn't be a difference anymore.

> Also, you should check count($errors)==0, not empty($errors). empty() is used
> for a cast to bool with warnings suppressed. If you didn't want to do that, 
> you
> should use count() explicitly.
The existing code uses empty, so I didn't really want to change that.

> 
> It would be cool if you could work the 'create' toggle into the rest of the
> logic in Preferences, which is quite elegant compared to the current version.
>
With the new pref system this was even easier :)


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to