Page MenuHomePhabricator

VisualEditor should not re-implement EditPage::getCopyrightWarning()
Closed, ResolvedPublic8 Estimated Story Points

Description

VisualEditorDataModule.php
		// Copyright warning (based on EditPage::getCopyrightWarning)
		$rightsText = $this->config->get( 'RightsText' );
		if ( $rightsText ) {
			$copywarnMsgArgs = [ 'copyrightwarning',
				'[[' . $context->msg( 'copyrightpage' )->inContentLanguage()->text() . ']]',
				$rightsText ];
		} else {
			$copywarnMsgArgs = [ 'copyrightwarning2',
				'[[' . $context->msg( 'copyrightpage' )->inContentLanguage()->text() . ']]' ];
		}
		// EditPage supports customisation based on title, we can't support that
		$title = Title::newFromText( 'Dwimmerlaik' );
		Hooks::run( 'EditPageCopyrightWarning', [ $title, &$copywarnMsgArgs ] );
		// Normalise to 'copyrightwarning' so we have a consistent key in the front-end
		$parseMsgs[ 'copyrightwarning' ] = call_user_func_array(
			[ $context, 'msg' ],
			$copywarnMsgArgs
		);

As far as I can tell, the only difference is that VisualEditor does not call an output format on the Message object ($parseMsgs[ 'copyrightwarning' ] is a Message object), and it is not wrapped in a div that sets an id of editpage-copywarn. The former seems like a bug, and the latter an oversight, or at least something that should have a negligible impact if implemented.

The comment which states "EditPage supports customisation based on title, we can't support that" doesn't make sense, because VisualEditor can simply pass the Dwimmerlaik title to EditPage and it would have the same effect.

Event Timeline

Jdforrester-WMF set the point value for this task to 8.
Jdforrester-WMF moved this task from To Triage to Freezer on the VisualEditor board.

Change 312159 had a related patch set uploaded (by Legoktm):
Don't re-implement EditPage::getCopyrightWarning()

https://gerrit.wikimedia.org/r/312159

Change 312159 merged by jenkins-bot:
Don't re-implement EditPage::getCopyrightWarning()

https://gerrit.wikimedia.org/r/312159

Legoktm claimed this task.