Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 24 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 1 |
StartEditing | |
0.00% |
0 / 24 |
|
0.00% |
0 / 9 |
110 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getHeaderIconName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getHeaderText | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getBody | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getModuleStyles | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
getJsConfigVars | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
getModuleRoute | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getMobileSummaryBody | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getState | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace GrowthExperiments\HomepageModules; |
4 | |
5 | use GrowthExperiments\ExperimentUserManager; |
6 | use MediaWiki\Config\Config; |
7 | use MediaWiki\Context\IContextSource; |
8 | use MediaWiki\User\Options\UserOptionsLookup; |
9 | |
10 | class StartEditing extends BaseModule { |
11 | |
12 | /** @var UserOptionsLookup */ |
13 | private $userOptionsLookup; |
14 | |
15 | /** |
16 | * @inheritDoc |
17 | */ |
18 | public function __construct( |
19 | IContextSource $context, |
20 | Config $wikiConfig, |
21 | ExperimentUserManager $experimentUserManager, |
22 | UserOptionsLookup $userOptionsLookup |
23 | ) { |
24 | parent::__construct( 'start-startediting', $context, $wikiConfig, $experimentUserManager ); |
25 | |
26 | $this->userOptionsLookup = $userOptionsLookup; |
27 | } |
28 | |
29 | /** |
30 | * @inheritDoc |
31 | */ |
32 | protected function getHeaderIconName() { |
33 | return ''; |
34 | } |
35 | |
36 | /** |
37 | * @inheritDoc |
38 | */ |
39 | protected function getHeaderText() { |
40 | return $this->getContext()->msg( |
41 | 'growthexperiments-homepage-suggested-edits-header' |
42 | )->text(); |
43 | } |
44 | |
45 | /** |
46 | * @inheritDoc |
47 | */ |
48 | protected function getBody() { |
49 | return ''; |
50 | } |
51 | |
52 | /** |
53 | * @inheritDoc |
54 | */ |
55 | protected function getModuleStyles() { |
56 | return array_merge( |
57 | parent::getModuleStyles(), |
58 | [ 'oojs-ui.styles.icons-editing-core' ], |
59 | [ 'ext.growthExperiments.icons' ] |
60 | ); |
61 | } |
62 | |
63 | /** @inheritDoc */ |
64 | protected function getJsConfigVars() { |
65 | return [ |
66 | 'GEHomepageSuggestedEditsEnableTopics' => |
67 | SuggestedEdits::isTopicMatchingEnabled( |
68 | $this->getContext(), |
69 | $this->userOptionsLookup |
70 | ) |
71 | ]; |
72 | } |
73 | |
74 | /** @inheritDoc */ |
75 | protected function getModuleRoute(): string { |
76 | return ''; |
77 | } |
78 | |
79 | /** |
80 | * @inheritDoc |
81 | */ |
82 | protected function getMobileSummaryBody() { |
83 | return ''; |
84 | } |
85 | |
86 | /** @inheritDoc */ |
87 | public function getState(): string { |
88 | return SuggestedEdits::isActivated( $this->getContext()->getUser(), $this->userOptionsLookup ) ? |
89 | self::MODULE_STATE_COMPLETE : |
90 | self::MODULE_STATE_INCOMPLETE; |
91 | } |
92 | } |