forked from MapComplete/MapComplete
Feature: add user_block endpoint
This commit is contained in:
parent
75a0eeed83
commit
be68837ffb
2 changed files with 24 additions and 8 deletions
|
@ -65,6 +65,16 @@ interface OsmUserInfo {
|
|||
}
|
||||
}
|
||||
|
||||
interface UserBlock {
|
||||
"id": number,
|
||||
"created_at": string,
|
||||
"updated_at": string,
|
||||
"ends_at": string,
|
||||
"needs_view": boolean,
|
||||
"user": { "uid": number, "user": string },
|
||||
"creator": { "uid": number, "user": string }
|
||||
}
|
||||
|
||||
export default interface UserDetails {
|
||||
name: string
|
||||
uid: number
|
||||
|
@ -77,7 +87,8 @@ export default interface UserDetails {
|
|||
account_created: string
|
||||
tracesCount: number
|
||||
description?: string
|
||||
languages: string[]
|
||||
languages: string[],
|
||||
active_blocks: number
|
||||
}
|
||||
export type OsmServiceState = "online" | "readonly" | "offline" | "unknown" | "unreachable"
|
||||
|
||||
|
@ -309,6 +320,7 @@ export class OsmConnection {
|
|||
account_created: user.account_created,
|
||||
tracesCount: user.traces?.count ?? 0,
|
||||
unreadMessages: user.messages.received?.unread ?? 0,
|
||||
active_blocks: user.blocks.received.active ?? 0
|
||||
}
|
||||
this.userDetails.set(userdetails)
|
||||
this.loadingStatus.setData("logged-in")
|
||||
|
@ -559,6 +571,14 @@ export class OsmConnection {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Have you been banned by the DWG?
|
||||
*/
|
||||
public async getUserBlocks(): Promise<UserBlock[]> {
|
||||
const raw = await this.interact("/user/blocks/active.json")
|
||||
return JSON.parse(raw)["user_blocks"]
|
||||
}
|
||||
|
||||
/**
|
||||
* To be called by land.html
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue