aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-07 14:58:24 +0200
committerChocobozzz <me@florianbigard.com>2020-05-07 15:07:01 +0200
commit80fdaf064562aff968f4c9cea1cf220bc12a70da (patch)
treea0ec49f433b828660f741b394dfd87056cd2c6ef /server/models
parent3cc665f48fd233d09f778d7e887488dde6f03ef6 (diff)
downloadPeerTube-80fdaf064562aff968f4c9cea1cf220bc12a70da.tar.gz
PeerTube-80fdaf064562aff968f4c9cea1cf220bc12a70da.tar.zst
PeerTube-80fdaf064562aff968f4c9cea1cf220bc12a70da.zip
Add moderation helpers to plugins
Diffstat (limited to 'server/models')
-rw-r--r--server/models/server/server.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/server/models/server/server.ts b/server/models/server/server.ts
index 8b07115f1..5131257ec 100644
--- a/server/models/server/server.ts
+++ b/server/models/server/server.ts
@@ -71,6 +71,13 @@ export class ServerModel extends Model<ServerModel> {
71 return ServerModel.findOne(query) 71 return ServerModel.findOne(query)
72 } 72 }
73 73
74 static async loadOrCreateByHost (host: string) {
75 let server = await ServerModel.loadByHost(host)
76 if (!server) server = await ServerModel.create({ host })
77
78 return server
79 }
80
74 isBlocked () { 81 isBlocked () {
75 return this.BlockedByAccounts && this.BlockedByAccounts.length !== 0 82 return this.BlockedByAccounts && this.BlockedByAccounts.length !== 0
76 } 83 }