Index: trunk/extensions/LiquidThreads/classes/Thread.php |
— | — | @@ -1543,14 +1543,7 @@ |
1544 | 1544 | } |
1545 | 1545 | } |
1546 | 1546 | |
1547 | | - $testTitle = Title::makeTitleSafe( NS_LQT_THREAD, 'test' ); |
1548 | | - if ( ! $testTitle->userCan( 'create' ) || |
1549 | | - ! $testTitle->userCan( 'edit' ) ) |
1550 | | - { |
1551 | | - return false; |
1552 | | - } |
1553 | | - |
1554 | | - return true; |
| 1547 | + return self::canUserCreateThreads( $user ); |
1555 | 1548 | } |
1556 | 1549 | |
1557 | 1550 | public static function canUserPost( $user, $talkpage ) { |
— | — | @@ -1562,14 +1555,20 @@ |
1563 | 1556 | } |
1564 | 1557 | } |
1565 | 1558 | |
1566 | | - $testTitle = Title::makeTitleSafe( NS_LQT_THREAD, 'test' ); |
1567 | | - if ( ! $testTitle->userCan( 'create' ) || |
1568 | | - ! $testTitle->userCan( 'edit' ) ) |
1569 | | - { |
1570 | | - return false; |
| 1559 | + return self::canUserCreateThreads( $user ); |
| 1560 | + } |
| 1561 | + |
| 1562 | + // Generally, not some specific page |
| 1563 | + public static function canUserCreateThreads( $user ) { |
| 1564 | + $userText = $user->getName(); |
| 1565 | + |
| 1566 | + static $canCreateNew = null; |
| 1567 | + if ( !isset( $canCreateNew[$userText] ) ) { |
| 1568 | + $title = Title::makeTitleSafe( NS_LQT_THREAD, 'Test title for LQT thread creation check' ); |
| 1569 | + $canCreateNew[$userText] = $title->userCan( 'create' ) && $title->userCan( 'edit' ); |
1571 | 1570 | } |
1572 | 1571 | |
1573 | | - return true; |
| 1572 | + return $canCreateNew[$userText]; |
1574 | 1573 | } |
1575 | 1574 | |
1576 | 1575 | public function signature() { |