Harej has uploaded a new change for review.
https://gerrit.wikimedia.org/r/322607
Change subject: Purges cache upon adding a new feature to a hub.
......................................................................
Purges cache upon adding a new feature to a hub.
This is so that there's no "feature does not exist" text when the hub is loaded
for the first time after the new feature is created.
For hub *creation*, it just creates the subpages first to short-circuit this
problem altogether.
Bug: T149022
Change-Id: I12bd045104cd61e1cad4b9725d58736a80fdd3f1
---
M includes/SpecialCreateCollaborationHub.php
M includes/SpecialCreateHubFeature.php
2 files changed, 20 insertions(+), 17 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CollaborationKit
refs/changes/07/322607/1
diff --git a/includes/SpecialCreateCollaborationHub.php
b/includes/SpecialCreateCollaborationHub.php
index d0153b0..8588078 100644
--- a/includes/SpecialCreateCollaborationHub.php
+++ b/includes/SpecialCreateCollaborationHub.php
@@ -160,22 +160,6 @@
return Status::newFatal(
'collaborationkit-createhub-invalidtitle' );
}
- $result = CollaborationHubContentHandler::edit(
- $title,
- $data['display_name'],
- $data['icon'],
- $data['colour'],
- $data['introduction'],
- '',
- [],
- $this->msg( 'collaborationkit-createhub-editsummary'
)->inContentLanguage()->plain(),
- $this->getContext()
- );
-
- if ( !$result->isGood() ) {
- return $result;
- }
-
$memberListTitle = Title::newFromText( $data['title'] . '/' .
$this->msg( 'collaborationkit-hub-pagetitle-members' ) );
if ( !$memberListTitle ) {
return Status::newFatal(
'collaborationkit-createhub-invalidtitle' );
@@ -217,6 +201,22 @@
$e->getCodeString() ) );
}
+ $result = CollaborationHubContentHandler::edit(
+ $title,
+ $data['display_name'],
+ $data['icon'],
+ $data['colour'],
+ $data['introduction'],
+ '',
+ [],
+ $this->msg( 'collaborationkit-createhub-editsummary'
)->inContentLanguage()->plain(),
+ $this->getContext()
+ );
+
+ if ( !$result->isGood() ) {
+ return $result;
+ }
+
// Once all the pages we want to create are created, we send
them to the first one
$this->getOutput()->redirect( $title->getFullUrl() );
return Status::newGood();
diff --git a/includes/SpecialCreateHubFeature.php
b/includes/SpecialCreateHubFeature.php
index 070649b..9f15d56 100644
--- a/includes/SpecialCreateHubFeature.php
+++ b/includes/SpecialCreateHubFeature.php
@@ -189,7 +189,7 @@
$initialContent = ''; // Create empty page by default;
exception is if there needs to be something such as JSON.
if ( $contentModel == 'CollaborationListContent' ) {
// FIXME why are we redefining this here? Can't we
reuse something from collaborationlistcontenthandler, which already has default
content?
- $initialContent = '{ "columns": [ { "items":[],
"options":{}, "description":"" } ] }';
+ $initialContent = '{ "displaymode": "normal",
"columns": [ { "items":[] } ], "options":{}, "description":"" }';
}
$summary = $this->msg(
'collaborationkit-createhubfeature-editsummary' )->plain();
@@ -218,6 +218,9 @@
$e->getCodeString() ) );
}
+ // Purge the hub's cache so that it doesn't say "feature does
not exist"
+ $hubTitleObject->invalidateCache();
+
// Once all the pages we want to create are created, we send
them to the first one
$this->getOutput()->redirect( $title->getFullUrl() );
return Status::newGood();
--
To view, visit https://gerrit.wikimedia.org/r/322607
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I12bd045104cd61e1cad4b9725d58736a80fdd3f1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CollaborationKit
Gerrit-Branch: master
Gerrit-Owner: Harej <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits