Remove federation strict_allowlist and retry_count.

This commit is contained in:
Dessalines 2022-11-21 11:52:54 -05:00
parent e2a29a5bad
commit 3c856cf036
3 changed files with 65 additions and 130 deletions

View file

@ -47,7 +47,7 @@
"inferno-server": "^8.0.3", "inferno-server": "^8.0.3",
"isomorphic-cookie": "^1.2.4", "isomorphic-cookie": "^1.2.4",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"lemmy-js-client": "0.17.0-rc.53", "lemmy-js-client": "0.17.0-rc.54",
"markdown-it": "^13.0.1", "markdown-it": "^13.0.1",
"markdown-it-container": "^3.0.0", "markdown-it-container": "^3.0.0",
"markdown-it-footnote": "^3.0.3", "markdown-it-footnote": "^3.0.3",

View file

@ -72,8 +72,6 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
federation_enabled: None, federation_enabled: None,
federation_debug: None, federation_debug: None,
federation_worker_count: None, federation_worker_count: None,
federation_strict_allowlist: None,
federation_http_fetch_retry_limit: None,
captcha_enabled: None, captcha_enabled: None,
captcha_difficulty: None, captcha_difficulty: None,
allowed_instances: None, allowed_instances: None,
@ -148,10 +146,6 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
federation_enabled: Some(ls.federation_enabled), federation_enabled: Some(ls.federation_enabled),
federation_debug: Some(ls.federation_debug), federation_debug: Some(ls.federation_debug),
federation_worker_count: Some(ls.federation_worker_count), federation_worker_count: Some(ls.federation_worker_count),
federation_strict_allowlist: Some(ls.federation_strict_allowlist),
federation_http_fetch_retry_limit: Some(
ls.federation_http_fetch_retry_limit
),
captcha_enabled: Some(ls.captcha_enabled), captcha_enabled: Some(ls.captcha_enabled),
captcha_difficulty: Some(ls.captcha_difficulty), captcha_difficulty: Some(ls.captcha_difficulty),
allowed_instances: this.props.siteRes.federated_instances.andThen( allowed_instances: this.props.siteRes.federated_instances.andThen(
@ -678,53 +672,6 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
</div> </div>
</div> </div>
</div> </div>
<div className="form-group row">
<div className="col-12">
<div className="form-check">
<input
className="form-check-input"
id="create-site-federation-strict-allowlist"
type="checkbox"
checked={toUndefined(
this.state.siteForm.federation_strict_allowlist
)}
onChange={linkEvent(
this,
this.handleSiteFederationStrictAllowList
)}
/>
<label
className="form-check-label"
htmlFor="create-site-federation-strict-allowlist"
>
{i18n.t("federation_strict_allowlist")}
</label>
</div>
</div>
</div>
<div className="form-group row">
<label
className="col-12 col-form-label"
htmlFor="create-site-federation-http-fetch-retry-limit"
>
{i18n.t("federation_http_fetch_retry_limit")}
</label>
<div className="col-12">
<input
type="number"
id="create-site-federation-http-fetch-retry-limit"
className="form-control"
min={0}
value={toUndefined(
this.state.siteForm.federation_http_fetch_retry_limit
)}
onInput={linkEvent(
this,
this.handleSiteFederationHttpFetchRetryLimit
)}
/>
</div>
</div>
<div className="form-group row"> <div className="form-group row">
<label <label
className="col-12 col-form-label" className="col-12 col-form-label"
@ -1034,57 +981,62 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
/> />
</div> </div>
</div> </div>
{siteSetup && <div className="form-group row"> {siteSetup && (
<h5 className="col-12">{i18n.t("taglines")}</h5> <div className="form-group row">
<div className="table-responsive col-12"> <h5 className="col-12">{i18n.t("taglines")}</h5>
<table id="taglines_table" className="table table-sm table-hover"> <div className="table-responsive col-12">
<thead className="pointer"></thead> <table
<tbody> id="taglines_table"
{this.state.siteForm.taglines className="table table-sm table-hover"
.unwrapOr([]) >
.map((cv, index) => ( <thead className="pointer"></thead>
<tr key={index}> <tbody>
<td> {this.state.siteForm.taglines
<MarkdownTextArea .unwrapOr([])
initialContent={Some(cv)} .map((cv, index) => (
initialLanguageId={None} <tr key={index}>
placeholder={None} <td>
buttonTitle={None} <MarkdownTextArea
maxLength={None} initialContent={Some(cv)}
onContentChange={s => initialLanguageId={None}
this.handleTaglineChange(this, index, s) placeholder={None}
} buttonTitle={None}
hideNavigationWarnings maxLength={None}
allLanguages={this.props.siteRes.all_languages} onContentChange={s =>
/> this.handleTaglineChange(this, index, s)
</td> }
<td className="text-right"> hideNavigationWarnings
<button allLanguages={this.props.siteRes.all_languages}
className="btn btn-link btn-animate text-muted"
onClick={e =>
this.handleDeleteTaglineClick(this, index, e)
}
data-tippy-content={i18n.t("delete")}
aria-label={i18n.t("delete")}
>
<Icon
icon="trash"
classes={`icon-inline text-danger`}
/> />
</button> </td>
</td> <td className="text-right">
</tr> <button
))} className="btn btn-link btn-animate text-muted"
</tbody> onClick={e =>
</table> this.handleDeleteTaglineClick(this, index, e)
<button }
className="btn btn-sm btn-secondary mr-2" data-tippy-content={i18n.t("delete")}
onClick={e => this.handleAddTaglineClick(this, e)} aria-label={i18n.t("delete")}
> >
{i18n.t("add_tagline")} <Icon
</button> icon="trash"
classes={`icon-inline text-danger`}
/>
</button>
</td>
</tr>
))}
</tbody>
</table>
<button
className="btn btn-sm btn-secondary mr-2"
onClick={e => this.handleAddTaglineClick(this, e)}
>
{i18n.t("add_tagline")}
</button>
</div>
</div> </div>
</div>} )}
<div className="form-group row"> <div className="form-group row">
<div className="col-12"> <div className="col-12">
<button <button
@ -1152,9 +1104,6 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
federation_enabled: sForm.federation_enabled, federation_enabled: sForm.federation_enabled,
federation_debug: sForm.federation_debug, federation_debug: sForm.federation_debug,
federation_worker_count: sForm.federation_worker_count, federation_worker_count: sForm.federation_worker_count,
federation_strict_allowlist: sForm.federation_strict_allowlist,
federation_http_fetch_retry_limit:
sForm.federation_http_fetch_retry_limit,
captcha_enabled: sForm.captcha_enabled, captcha_enabled: sForm.captcha_enabled,
captcha_difficulty: sForm.captcha_difficulty, captcha_difficulty: sForm.captcha_difficulty,
allowed_instances: sForm.allowed_instances, allowed_instances: sForm.allowed_instances,
@ -1195,8 +1144,10 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
handleTaglineChange(i: SiteForm, index: number, val: string) { handleTaglineChange(i: SiteForm, index: number, val: string) {
i.state.siteForm.taglines.match({ i.state.siteForm.taglines.match({
some: tls => { tls[index] = val; }, some: tls => {
none: void 0 tls[index] = val;
},
none: void 0,
}); });
i.setState(i.state); i.setState(i.state);
} }
@ -1207,7 +1158,7 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
event: InfernoMouseEvent<HTMLButtonElement> event: InfernoMouseEvent<HTMLButtonElement>
) { ) {
event.preventDefault(); event.preventDefault();
if (i.state.siteForm.taglines.isSome()){ if (i.state.siteForm.taglines.isSome()) {
let taglines = i.state.siteForm.taglines.unwrap(); let taglines = i.state.siteForm.taglines.unwrap();
taglines.splice(index, 1); taglines.splice(index, 1);
i.state.siteForm.taglines = None; // force rerender of table rows i.state.siteForm.taglines = None; // force rerender of table rows
@ -1222,7 +1173,7 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
event: InfernoMouseEvent<HTMLButtonElement> event: InfernoMouseEvent<HTMLButtonElement>
) { ) {
event.preventDefault(); event.preventDefault();
if (i.state.siteForm.taglines.isNone()){ if (i.state.siteForm.taglines.isNone()) {
i.state.siteForm.taglines = Some([]); i.state.siteForm.taglines = Some([]);
} }
i.state.siteForm.taglines.unwrap().push(""); i.state.siteForm.taglines.unwrap().push("");
@ -1438,11 +1389,6 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
i.setState(i.state); i.setState(i.state);
} }
handleSiteFederationStrictAllowList(i: SiteForm, event: any) {
i.state.siteForm.federation_strict_allowlist = Some(event.target.checked);
i.setState(i.state);
}
handleSiteFederationWorkerCount(i: SiteForm, event: any) { handleSiteFederationWorkerCount(i: SiteForm, event: any) {
i.setState( i.setState(
s => ( s => (
@ -1452,17 +1398,6 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
); );
} }
handleSiteFederationHttpFetchRetryLimit(i: SiteForm, event: any) {
i.setState(
s => (
(s.siteForm.federation_http_fetch_retry_limit = Some(
Number(event.target.value)
)),
s
)
);
}
handleSiteCaptchaEnabled(i: SiteForm, event: any) { handleSiteCaptchaEnabled(i: SiteForm, event: any) {
i.state.siteForm.captcha_enabled = Some(event.target.checked); i.state.siteForm.captcha_enabled = Some(event.target.checked);
i.setState(i.state); i.setState(i.state);

View file

@ -4909,10 +4909,10 @@ lcid@^1.0.0:
dependencies: dependencies:
invert-kv "^1.0.0" invert-kv "^1.0.0"
lemmy-js-client@0.17.0-rc.51: lemmy-js-client@0.17.0-rc.54:
version "0.17.0-rc.51" version "0.17.0-rc.54"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.0-rc.51.tgz#adf554b8837741bc9bb419df090744fc2ef8a1fa" resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.0-rc.54.tgz#cda3aae8149699f944da354b76710b148cf441dc"
integrity sha512-AGXzQptVrdYim/5YrpAnlqAElZl5aTwqZcwffTrzXs4tL91b/APkdoPLUKASGt/5lRng2CP4cQTbykldZyjQRA== integrity sha512-7EhwjfAoq1jmwj6CAFOBNiNQOMOZk/yAsW4kwVRsNGD3pZexW3NrjEoAQx3kFC7mDEUuVbkkRMkl3ND8vUY+Uw==
levn@^0.4.1: levn@^0.4.1:
version "0.4.1" version "0.4.1"