-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e7dd67
commit a736bbf
Showing
3 changed files
with
87 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Main class for the Talkright MediaWiki extension | ||
* @author Marc Noirot - marc dot noirot at gmail | ||
* @author P.Levêque - User:Phillev | ||
* @author James Montalvo - User:Jamesmontalvo3 | ||
* | ||
* | ||
*/ | ||
class TalkRight { | ||
|
||
/** | ||
* Bypass edit restriction when EDITING pages if user has 'talk' right and page is a talk (discussion) page. | ||
* @param $&editPage the page edition object | ||
* @return true to resume edition to normal operation | ||
*/ | ||
static function alternateEdit( $editPage ) { | ||
global $wgOut, $wgUser, $wgRequest, $wgTitle; | ||
if ( $wgTitle->isTalkPage() && $wgUser->isAllowed( 'talk' ) ) { | ||
array_push( $wgUser->mRights, 'edit' ); | ||
} | ||
return true; | ||
} | ||
|
||
/** | ||
* Bypass edit restriction when VIEWING pages if user has 'talk' right and page is a talk (discussion) page. | ||
* This is probably not the ideal hook to use. I just needed one earlier than creation of section links, edit tab and add topic tab | ||
* @param &$parser parser object, used to gain access to User and Title objects | ||
* @param &$text unused | ||
* @param &$strip_state unused | ||
* @return true and false both seemed to work. [[Manual:Hooks/ParserBeforeStrip]] doesn't indicate what return value affects | ||
*/ | ||
static function giveEditRightsWhenViewingTalkPages ( &$parser, &$test, &$test ) { | ||
|
||
$user = $parser->getUser(); | ||
if ( $parser->getTitle()->isTalkPage() && $user->isAllowed( 'talk' ) ) { | ||
array_push( $user->mRights, 'edit' ); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "enterprisemediawiki/talk-right", | ||
"type": "mediawiki-extension", | ||
"description": "Makes editing MediaWiki talk pages a distinct action from editing articles", | ||
"keywords": [ | ||
"MediaWiki", | ||
"Discussion" | ||
], | ||
"homepage": "https://www.mediawiki.org/wiki/Extension:TalkRight", | ||
"license": "GPL-2.0+", | ||
"authors": [ | ||
{ | ||
"name": "P.Levêque", | ||
"role": "Original developer" | ||
}, | ||
{ | ||
"name": "Marc Noirot", | ||
"role": "Developer" | ||
}, | ||
{ | ||
"name": "James Montalvo", | ||
"role": "Current developer" | ||
} | ||
], | ||
"support": { | ||
"issues": "https://bugzilla.wikimedia.org/", | ||
"github": "https://github.com/enterprisemediawiki/TalkRight/issues" | ||
}, | ||
"require": { | ||
"composer/installers": ">=1.0.1" | ||
}, | ||
"autoload": { | ||
"files": ["TalkRight.php"] | ||
} | ||
} |