Index: trunk/extensions/CodeReview/backend/CodeRevision.php |
— | — | @@ -629,33 +629,14 @@ |
630 | 630 | return $refs; |
631 | 631 | } |
632 | 632 | |
633 | | - public function getSignoffsForUser( $user, $from = DB_SLAVE ) { |
634 | | - return $this->fetchSignoffs( array( 'user' => $user ), $from ); |
635 | | - } |
636 | | - |
637 | | - public function getSignoffs( $from = DB_SLAVE) { |
638 | | - return $this->fetchSignoffs( array(), $from ); |
639 | | - } |
640 | | - |
641 | | - /** |
642 | | - * @param $options Array: array of filtering options |
643 | | - * @param $from DB_SLAVE|DB_MASTER |
644 | | - */ |
645 | | - private function fetchSignoffs( $options, $from = DB_SLAVE ) { |
646 | | - # Default conditions for DB query. |
647 | | - $fetchConditions = array( |
648 | | - 'cs_repo_id' => $this->mRepoId, |
649 | | - 'cs_rev_id' => $this->mId, |
650 | | - ); |
651 | | - # Add a filter on user id (see getSignoffsForUser()) |
652 | | - if( isset($options['user']) ) { |
653 | | - $fetchConditions['cs_user'] = $options['user']->getID() ; |
654 | | - } |
655 | | - |
| 633 | + public function getSignoffs( $from = DB_SLAVE ) { |
656 | 634 | $db = wfGetDB( $from ); |
657 | 635 | $result = $db->select( 'code_signoffs', |
658 | 636 | array( 'cs_user', 'cs_user_text', 'cs_flag', 'cs_timestamp' ), |
659 | | - $fetchConditions, |
| 637 | + array( |
| 638 | + 'cs_repo_id' => $this->mRepoId, |
| 639 | + 'cs_rev_id' => $this->mId, |
| 640 | + ), |
660 | 641 | __METHOD__, |
661 | 642 | array( 'ORDER BY' => 'cs_timestamp' ) |
662 | 643 | ); |
— | — | @@ -688,27 +669,6 @@ |
689 | 670 | $dbw->insert( 'code_signoffs', $rows, __METHOD__, array( 'IGNORE' ) ); |
690 | 671 | } |
691 | 672 | |
692 | | - /** |
693 | | - * Skip already existing signoffs. |
694 | | - */ |
695 | | - public function mergeSignoff( $user, $postedFlags, $from = DB_SLAVE ) { |
696 | | - $existingFlags = array(); |
697 | | - $userSignoffs = $this->getSignoffsForUser( $user, $from ); |
698 | | - |
699 | | - # get user existing signoffs flags |
700 | | - foreach( $userSignoffs as $signoff ) { |
701 | | - $existingFlags[] = $signoff->flag; |
702 | | - } |
703 | | - |
704 | | - # compare with posted ones and only keep non existant |
705 | | - $addFlags = array_diff( $postedFlags, $existingFlags ); |
706 | | - if( count( $addFlags ) ) { |
707 | | - $this->addSignoff( $user, $addFlags ); |
708 | | - } else { |
709 | | - # We skipped insertion / replacement |
710 | | - } |
711 | | - } |
712 | | - |
713 | 673 | public function getTags( $from = DB_SLAVE ) { |
714 | 674 | $db = wfGetDB( $from ); |
715 | 675 | $result = $db->select( 'code_tags', |
Index: trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | } |
88 | 88 | // Add any signoffs |
89 | 89 | if ( count( $signoffFlags ) && $this->validPost( 'codereview-signoff' ) ) { |
90 | | - $this->mRev->mergeSignoff( $wgUser, $signoffFlags ); |
| 90 | + $this->mRev->addSignoff( $wgUser, $signoffFlags ); |
91 | 91 | } |
92 | 92 | // Add any comments |
93 | 93 | $commentAdded = false; |