Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4159513
UserBlock.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
UserBlock.js
View Options
'use strict'
;
const
{
action
,
assert
,
utils
}
=
require
(
'api-testing'
);
describe
(
'The block/unblock action'
,
()
=>
{
const
pageTitle
=
utils
.
title
(
'Block_'
);
let
eve
=
action
.
getAnon
();
let
mindy
;
before
(
async
()
=>
{
[
eve
,
mindy
]
=
await
Promise
.
all
(
[
eve
.
account
(
'Eve_'
),
action
.
mindy
()
]
);
}
);
it
(
'allows an admin to block a user'
,
async
()
=>
{
await
eve
.
edit
(
pageTitle
,
{
text
:
'One'
,
summary
:
'first'
}
);
const
result
=
await
mindy
.
action
(
'block'
,
{
user
:
eve
.
username
,
reason
:
'testing'
,
token
:
await
mindy
.
token
()
},
'POST'
);
assert
.
exists
(
result
.
block
.
id
);
assert
.
equal
(
result
.
block
.
userID
,
eve
.
userid
);
assert
.
equal
(
result
.
block
.
user
,
eve
.
username
);
}
);
it
(
'prevents a blocked user from editing'
,
async
()
=>
{
const
error
=
await
eve
.
actionError
(
'edit'
,
{
title
:
pageTitle
,
text
:
'Two'
,
summary
:
'second'
,
token
:
await
eve
.
token
(
'csrf'
)
},
'POST'
);
assert
.
equal
(
error
.
code
,
'blocked'
);
}
);
it
(
'allows an admin to unblock a user'
,
async
()
=>
{
const
result
=
await
mindy
.
action
(
'unblock'
,
{
user
:
eve
.
username
,
reason
:
'testing'
,
token
:
await
mindy
.
token
()
},
'POST'
);
assert
.
exists
(
result
.
unblock
.
id
);
assert
.
equal
(
result
.
unblock
.
userid
,
eve
.
userid
);
assert
.
equal
(
result
.
unblock
.
user
,
eve
.
username
);
}
);
it
(
'allows a user to edit after being unblocked'
,
async
()
=>
{
await
eve
.
edit
(
pageTitle
,
{
text
:
'Three'
,
summary
:
'third'
}
);
}
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 19 2026, 23:56 (9 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
1d/5b/fd6bd568e09fd82ca562a5e32064
Default Alt Text
UserBlock.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment