login: Don't show an empty / undefined code of conduct.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 10m26s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 10m26s
This commit is contained in:
@@ -75,6 +75,10 @@
|
|||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
|
#code_of_conduct:has(>textarea:empty) {
|
||||||
|
display: none;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<div style="display: flex; flex-direction: column; max-width: 1280px; margin: auto">
|
<div style="display: flex; flex-direction: column; max-width: 1280px; margin: auto">
|
||||||
<h1 ?hidden=${this.name}>Welcome.</h1>
|
<h1 ?hidden=${this.name}>Welcome.</h1>
|
||||||
@@ -126,8 +130,10 @@
|
|||||||
There is currently no administrator. You will be made administrator.
|
There is currently no administrator. You will be made administrator.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="code_of_conduct">
|
||||||
<h2>Code of Conduct</h2>
|
<h2>Code of Conduct</h2>
|
||||||
<textarea readonly rows="20" cols="80" style="resize: none">${this.code_of_conduct}</textarea>
|
<textarea readonly rows="20" style="resize: none; width: 100%">${this.code_of_conduct}</textarea>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ static void _httpd_endpoint_login_work(tf_ssb_t* ssb, void* user_data)
|
|||||||
{
|
{
|
||||||
JSValue settings_value = JS_ParseJSON(context, login->settings, strlen(login->settings), NULL);
|
JSValue settings_value = JS_ParseJSON(context, login->settings, strlen(login->settings), NULL);
|
||||||
JSValue code_of_conduct_value = JS_GetPropertyStr(context, settings_value, "code_of_conduct");
|
JSValue code_of_conduct_value = JS_GetPropertyStr(context, settings_value, "code_of_conduct");
|
||||||
const char* code_of_conduct = JS_ToCString(context, code_of_conduct_value);
|
const char* code_of_conduct = JS_IsString(code_of_conduct_value) ? JS_ToCString(context, code_of_conduct_value) : NULL;
|
||||||
const char* result = tf_strdup(code_of_conduct);
|
const char* result = tf_strdup(code_of_conduct);
|
||||||
JS_FreeCString(context, code_of_conduct);
|
JS_FreeCString(context, code_of_conduct);
|
||||||
JS_FreeValue(context, code_of_conduct_value);
|
JS_FreeValue(context, code_of_conduct_value);
|
||||||
|
|||||||
Reference in New Issue
Block a user