@@ -21,6 +21,7 @@ import { ImageUploadForm } from "../common/image-upload-form";
21
21
import { LanguageSelect } from "../common/language-select" ;
22
22
import { ListingTypeSelect } from "../common/listing-type-select" ;
23
23
import { MarkdownTextArea } from "../common/markdown-textarea" ;
24
+ import UrlListTextarea from "../common/url-list-textarea" ;
24
25
25
26
interface SiteFormProps {
26
27
blockedInstances ?: Instance [ ] ;
@@ -84,6 +85,7 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
84
85
captcha_difficulty : ls . captcha_difficulty ,
85
86
allowed_instances : this . props . allowedInstances ?. map ( i => i . domain ) ,
86
87
blocked_instances : this . props . blockedInstances ?. map ( i => i . domain ) ,
88
+ blocked_urls : this . props . siteRes . blocked_urls . map ( u => u . url ) ,
87
89
} ;
88
90
}
89
91
@@ -112,6 +114,8 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
112
114
113
115
this . handleInstanceEnterPress = this . handleInstanceEnterPress . bind ( this ) ;
114
116
this . handleInstanceTextChange = this . handleInstanceTextChange . bind ( this ) ;
117
+
118
+ this . handleBlockedUrlsUpdate = this . handleBlockedUrlsUpdate . bind ( this ) ;
115
119
}
116
120
117
121
render ( ) {
@@ -500,6 +504,10 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
500
504
onChange = { this . handleDiscussionLanguageChange }
501
505
showAll
502
506
/>
507
+ < UrlListTextarea
508
+ urls = { this . state . siteForm . blocked_urls ?? [ ] }
509
+ onUpdate = { this . handleBlockedUrlsUpdate }
510
+ />
503
511
< div className = "mb-3 row" >
504
512
< label
505
513
className = "col-12 col-form-label"
@@ -994,4 +1002,14 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
994
1002
handleDefaultPostListingTypeChange ( val : ListingType ) {
995
1003
this . setState ( s => ( ( s . siteForm . default_post_listing_type = val ) , s ) ) ;
996
1004
}
1005
+
1006
+ handleBlockedUrlsUpdate ( newBlockedUrls : string [ ] ) {
1007
+ this . setState ( prev => ( {
1008
+ ...prev ,
1009
+ siteForm : {
1010
+ ...prev . siteForm ,
1011
+ blocked_urls : newBlockedUrls ,
1012
+ } ,
1013
+ } ) ) ;
1014
+ }
997
1015
}
0 commit comments