Skip to content

Commit 892c7f9

Browse files
authored
Merge pull request #6 from wmde/introduce-unblock-user
Introduce unblock user, bump version
2 parents 6a5a570 + 244f3de commit 892c7f9

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"api-testing": "^1.7.0"
88
},
99
"name": "cypress-wikibase-api",
10-
"version": "0.0.2",
10+
"version": "0.0.3",
1111
"description": "Support package for developing cypress tests that use the Wikibase API",
1212
"homepage": "https://github.com/wmde/cypress-wikibase-api",
1313
"bugs": "https://phabricator.wikimedia.org",

src/MwApiPlugin.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,22 @@ module.exports = {
149149
action: 'wbgetentities',
150150
ids: entityId
151151
} ).then( ( response ) => response.body.entities[ entityId ] );
152+
},
153+
async 'MwApi:UnblockUser'( { username, reason } ) {
154+
const rootClient = await root();
155+
const unblockResult = await rootClient.action( 'unblock', {
156+
user: username,
157+
assert: 'user',
158+
reason: reason || 'Unblocked user',
159+
token: await rootClient.token()
160+
}, 'POST' );
161+
162+
if ( !unblockResult.unblock ) {
163+
return Promise.reject( new Error( 'Failed to unblock user.' ) );
164+
}
165+
166+
return Promise.resolve( null );
167+
152168
}
153169
};
154170
}

0 commit comments

Comments
 (0)