Skip to content

Commit

Permalink
Add evacuateUser (#11)
Browse files Browse the repository at this point in the history
* evacuateUser

* cant type

* update documentation
  • Loading branch information
jjj333-p authored Dec 23, 2023
1 parent f2d975c commit b50d3d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ Feel free to make a issue for each requested feature so when I finally get time

Currently implemented commands:

- `evacuate <room ID | Alias> ?<--preserve | -p>`
- `evacuate <User MXID | Room ID | Room Alias> ?<--preserve | -p>`

Runs the [evacuate room endpoint](https://matrix-org.github.io/dendrite/administration/adminapi#post-_dendriteadminevacuateroomroomid) on that roomID or Alias. If the `--preserve` or `-p` flag is **not** provided the [purge room endpoint](https://matrix-org.github.io/dendrite/administration/adminapi#post-_dendriteadminpurgeroomroomid) will also be run, purging the room state from the database.
- When supplied a room ID or alias, the interface runs the [evacuate room endpoint](https://matrix-org.github.io/dendrite/administration/adminapi#post-_dendriteadminevacuateroomroomid) on that roomID or Alias, causing all users on this server to leave that room. If the `--preserve` or `-p` flag is **not** provided the [purge room endpoint](https://matrix-org.github.io/dendrite/administration/adminapi#post-_dendriteadminpurgeroomroomid) will also be run, purging the room state from the database.
- When supplied with a MXID of a local user, i.e. `@localpart:your.server`, the interface will run the [evacuate user endpoint](https://matrix-org.github.io/dendrite/administration/adminapi#post-_dendriteadminevacuateuseruserid) on that user, making that account leave all rooms it is in.

Space: [#admin-interface:pain.agency](https://matrix.to/#/#admin-interface:pain.agency)
Discussion Room: [#admin-interface-support:pain.agency](https://matrix.to/#/%23admin-interface-support%3Apain.agency)
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ async function makeDendriteReq (reqType, command, arg1, arg2, body) {

async function evacuateUser(mxid){


makeDendriteReq("POST", "evacuateUser", mxid)
.then(e => client.sendHtmlNotice(adminRoom, ("Ran evacuateUser endpoint on <code>"+ mxid + "</code> with response <pre><code>" + e + "</code></pre>")) )
.catch(e => client.sendHtmlNotice(adminRoom, ("❌ | could not make evacuateUser request with error\n<pre><code>" + e + "</code></pre>")) )

}

Expand Down

0 comments on commit b50d3d4

Please sign in to comment.