Matthias Mullie has uploaded a new change for review. https://gerrit.wikimedia.org/r/223278
Change subject: Revert "Change mention inspector template" ...................................................................... Revert "Change mention inspector template" This reverts commit b5d857f6d2c222caf5525efe42e309604575bcda. Change-Id: Ifb5cb0dc06b250f4eaae961072c66f4db3b77b4c --- M Hooks.php M i18n/en.json M i18n/qqq.json D maintenance/FlowCreateMentionTemplate.php M modules/editor/editors/visualeditor/ui/inspectors/mw.flow.ve.ui.MentionInspector.js 5 files changed, 8 insertions(+), 59 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/78/223278/1 diff --git a/Hooks.php b/Hooks.php index 114f622..fe0988a 100644 --- a/Hooks.php +++ b/Hooks.php @@ -232,9 +232,6 @@ require_once __DIR__.'/maintenance/FlowUpdateWorkflowPageId.php'; $updater->addPostDatabaseUpdateMaintenance( 'FlowUpdateWorkflowPageId' ); - require_once __DIR__.'/maintenance/FlowCreateMentionTemplate.php'; - $updater->addPostDatabaseUpdateMaintenance( 'FlowCreateMentionTemplate' ); - return true; } @@ -673,6 +670,7 @@ $vars['wgFlowEditorList'] = $wgFlowEditorList; $vars['wgFlowMaxTopicLength'] = Flow\Model\PostRevision::MAX_TOPIC_LENGTH; + $vars['wgFlowMentionTemplate'] = wfMessage( 'flow-ve-mention-template' )->inContentLanguage()->plain(); $vars['wgFlowAjaxTimeout'] = $wgFlowAjaxTimeout; return true; diff --git a/i18n/en.json b/i18n/en.json index 2ac5ea4..e02f0f5 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -529,6 +529,7 @@ "flow-ve-mention-inspector-remove-label": "Remove", "flow-ve-mention-placeholder": "User name", "flow-ve-mention-tool-title": "Mention a user", + "flow-ve-mention-template": "ping", "flow-ve-mention-inspector-invalid-user": "The username \"$1\" is not registered.", "flow-wikitext-editor-help": "Wikitext $1.", "flow-wikitext-editor-help-and-preview": "Wikitext $1 and you can $2 anytime.", diff --git a/i18n/qqq.json b/i18n/qqq.json index 97f07dc..e48d547 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -535,6 +535,7 @@ "flow-ve-mention-inspector-remove-label": "Text of remove button on Flow's user mention panel (inspector) in the VisualEditor.", "flow-ve-mention-placeholder": "Placeholder text for the input field in the user mention tool where the user can type a user name.\n{{Identical|Username}}", "flow-ve-mention-tool-title": "Title text for the user mention tool on Flow's VisualEditor toolbar.", + "flow-ve-mention-template": "Name of on-wiki template used for user mentions. The template should accept a call in the form <nowiki>{{templatename|Username}}</nowiki>, to mention Username. It uses the content language.", "flow-ve-mention-inspector-invalid-user": "Error shown when the poster attempts to mention a user that does not exist. Parameters:\n$1: Username. The username is not registered; thus, gender is unknown.", "flow-wikitext-editor-help": "Text shown at the bottom of a wikitext editing box when visualeditor is not available to switch to.\n\n$1 is {{msg-mw|Flow-wikitext-editor-help-uses-wikitext}}.", "flow-wikitext-editor-help-and-preview": "Text shown at the bottom of a wikitext editing box when visualeditor is available to switch to.\n* $1 is {{msg-mw|flow-wikitext-editor-help-uses-wikitext}}\n* $2 is {{msg-mw|flow-wikitext-editor-help-preview-the-result}}", diff --git a/maintenance/FlowCreateMentionTemplate.php b/maintenance/FlowCreateMentionTemplate.php deleted file mode 100644 index 7d34a92..0000000 --- a/maintenance/FlowCreateMentionTemplate.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php - -require_once ( getenv( 'MW_INSTALL_PATH' ) !== false - ? getenv( 'MW_INSTALL_PATH' ) . '/maintenance/Maintenance.php' - : dirname( __FILE__ ) . '/../../../maintenance/Maintenance.php' ); - -/** - * Creates Template:FlowMention, which is used te render mentions in Flow's Visual Editor. - * The template will be created with a default format, but can be customized. - * If the template already exists, it will be left untouched. - * - * @ingroup Maintenance - */ -class FlowCreateMentionTemplate extends LoggedUpdateMaintenance { - public function __construct() { - parent::__construct(); - - $this->mDescription = "Creates Template:FlowMention, which is used te render mentions in Flow's Visual Editor"; - } - - protected function getUpdateKey() { - return __CLASS__; - } - - protected function doDBUpdates() { - // get "User:" namespace prefix in wiki language - global $wgContLang; - $namespaces = $wgContLang->getFormattedNamespaces(); - - $title = Title::newFromText( 'FlowMention', NS_TEMPLATE ); - $article = new Article( $title ); - $page = $article->getPage(); - - if ( $page->getRevision() !== null ) { - // template already exists, don't overwrite it - return true; - } - - $status = $page->doEditContent( - new WikitextContent( '@[[' . $namespaces[NS_USER] . ':{{{1|Example}}}|{{{2|{{{1|Example}}}}}}]]' ), - '/* Automatically created by Flow */', - EDIT_FORCE_BOT | EDIT_SUPPRESS_RC, - false, - FlowHooks::getOccupationController()->getTalkpageManager() - ); - - return $status->isOK(); - } -} - -$maintClass = 'FlowCreateMentionTemplate'; -require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/modules/editor/editors/visualeditor/ui/inspectors/mw.flow.ve.ui.MentionInspector.js b/modules/editor/editors/visualeditor/ui/inspectors/mw.flow.ve.ui.MentionInspector.js index f8dcc83..9772313 100644 --- a/modules/editor/editors/visualeditor/ui/inspectors/mw.flow.ve.ui.MentionInspector.js +++ b/modules/editor/editors/visualeditor/ui/inspectors/mw.flow.ve.ui.MentionInspector.js @@ -39,7 +39,7 @@ mw.flow.ve.ui.MentionInspector.static.title = OO.ui.deferMsg( 'flow-ve-mention-inspector-title' ); mw.flow.ve.ui.MentionInspector.static.modelClasses = [ ve.dm.MWTransclusionNode ]; - mw.flow.ve.ui.MentionInspector.static.template = 'FlowMention'; + mw.flow.ve.ui.MentionInspector.static.template = mw.config.get( 'wgFlowMentionTemplate' ); mw.flow.ve.ui.MentionInspector.static.templateParameterKey = '1'; // 1-indexed positional parameter // Buttons @@ -121,7 +121,7 @@ }; /** - * Sets the abilities based on the current status + * Sets the abiliities based on the current status * * If it's empty or invalid, it can not be inserted or updated. */ @@ -324,7 +324,7 @@ // Don't allow saving until we're sure it's valid. this.actions.setAbilities( { done: false } ); this.pushPending(); - promise.always( this.onTransclusionReady.bind( this ) ); + promise.always( this.onTransclusionReady.bind( this ) ); }, this ); }; @@ -359,7 +359,8 @@ /** * Gets the transclusion node representing this mention * - * @return {ve.dm.Node|null} Selected node + * @param {Object} [data] Inspector opening data + * @return {ve.dm.Node} Selected node */ mw.flow.ve.ui.MentionInspector.prototype.getSelectedNode = function () { // Checks the model class -- To view, visit https://gerrit.wikimedia.org/r/223278 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifb5cb0dc06b250f4eaae961072c66f4db3b77b4c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits