44
55import {
66 AbstractProtection ,
7+ allocateProtection ,
78 describeProtection ,
89 Logger ,
10+ OwnLifetime ,
911 PolicyRuleType ,
1012 ProtectedRoomsSet ,
1113 Protection ,
@@ -23,7 +25,7 @@ import {
2325} from "@the-draupnir-project/matrix-basic-types" ;
2426import { SynapseHttpAntispam } from "../webapis/SynapseHTTPAntispam/SynapseHttpAntispam" ;
2527import { Draupnir } from "../Draupnir" ;
26- import { Ok , ResultError } from "@gnuxie/typescript-result" ;
28+ import { ResultError } from "@gnuxie/typescript-result" ;
2729
2830const log = new Logger ( "SynapseHTTPUserMayInvite" ) ;
2931
@@ -131,12 +133,15 @@ export class BlockInvitationsOnServerProtection
131133 private readonly userMayInvite : SynapseHTTPUserMayInvite ;
132134 public constructor (
133135 description : BlockInvitationsOnServerProtectionDescription ,
136+ lifetime : OwnLifetime <
137+ Protection < BlockInvitationsOnServerProtectionDescription >
138+ > ,
134139 capabilities : BlockInvitationsOnServerProtectionCapabilities ,
135140 protectedRoomsSet : ProtectedRoomsSet ,
136141 automaticallyRedactForReasons : string [ ] ,
137142 synapseHTTPAntispam : SynapseHttpAntispam
138143 ) {
139- super ( description , capabilities , protectedRoomsSet , { } ) ;
144+ super ( description , lifetime , capabilities , protectedRoomsSet , { } ) ;
140145 this . userMayInvite = new SynapseHTTPUserMayInvite (
141146 protectedRoomsSet . watchedPolicyRooms ,
142147 automaticallyRedactForReasons ,
@@ -157,6 +162,7 @@ describeProtection<BlockInvitationsOnServerProtectionCapabilities, Draupnir>({
157162 defaultCapabilities : { } ,
158163 async factory (
159164 description ,
165+ lifetime ,
160166 protectedRoomsSet ,
161167 draupnir ,
162168 capabilities ,
@@ -167,9 +173,11 @@ describeProtection<BlockInvitationsOnServerProtectionCapabilities, Draupnir>({
167173 "This protection requires synapse-http-antispam to be enabled"
168174 ) ;
169175 }
170- return Ok (
176+ return allocateProtection (
177+ lifetime ,
171178 new BlockInvitationsOnServerProtection (
172179 description ,
180+ lifetime ,
173181 capabilities ,
174182 protectedRoomsSet ,
175183 draupnir . config . automaticallyRedactForReasons ,
0 commit comments