You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@answer.apache.org by "Dinesht04 (via GitHub)" <gi...@apache.org> on 2025/10/17 11:28:44 UTC

[PR] feat(internal,ui): add optional question body [answer]

Dinesht04 opened a new pull request, #1403:
URL: https://github.com/apache/answer/pull/1403

   fix #842 
   
   Video showing fix:
   
   https://github.com/user-attachments/assets/d3e634f3-c2d4-4a23-90e6-7dbd64f19601
   
   - Included the addition on min_content in Migration v28 under the version 1.7.0 
   
   Any feedback on this PR would be very welcome 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org


Re: [PR] feat(internal,ui): add optional question body [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on code in PR #1403:
URL: https://github.com/apache/answer/pull/1403#discussion_r2446911116


##########
internal/schema/siteinfo_schema.go:
##########
@@ -75,6 +75,7 @@ type SiteBrandingReq struct {
 
 // SiteWriteReq site write request
 type SiteWriteReq struct {
+	MinimumContent                 int             `validate:"omitempty" json:"min_content"`

Review Comment:
   `validate:"omitempty,min=0"` will be better.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org


Re: [PR] feat(internal,ui): add optional question body [answer]

Posted by "Dinesht04 (via GitHub)" <gi...@apache.org>.
Dinesht04 commented on code in PR #1403:
URL: https://github.com/apache/answer/pull/1403#discussion_r2447703829


##########
internal/schema/siteinfo_schema.go:
##########
@@ -75,6 +75,7 @@ type SiteBrandingReq struct {
 
 // SiteWriteReq site write request
 type SiteWriteReq struct {
+	MinimumContent                 int             `validate:"omitempty" json:"min_content"`

Review Comment:
   I agree, thank you.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org


Re: [PR] feat(internal,ui): add optional question body [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars merged PR #1403:
URL: https://github.com/apache/answer/pull/1403


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org


Re: [PR] feat(internal,ui): add optional question body [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1403:
URL: https://github.com/apache/answer/pull/1403#discussion_r2446824561


##########
ui/src/pages/Questions/Ask/index.tsx:
##########
@@ -423,6 +425,24 @@ const Ask = () => {
   usePageTags({
     title: pageTitle,
   });
+
+  const handleContentHint = () => {
+    if (
+      !writeInfo ||
+      writeInfo.min_content === undefined ||
+      !writeInfo.min_content
+    ) {
+      return t(`form.fields.body.hint.optional_body`);
+    }
+
+    let str: string = t(`form.fields.body.hint.minimum_characters`);
+    str = str.replace(
+      `{{ min_content_length }}`,
+      writeInfo.min_content.toString(),
+    );
+    return str;

Review Comment:
   i18next can pass variables, {{}} is the placeholder for the variable
   
   <img width="993" height="520" alt="image" src="https://github.com/user-attachments/assets/6e6c7571-75da-45e1-8b13-ddb3d0e68dbe" />
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org


Re: [PR] feat(internal,ui): add optional question body [answer]

Posted by "Dinesht04 (via GitHub)" <gi...@apache.org>.
Dinesht04 commented on code in PR #1403:
URL: https://github.com/apache/answer/pull/1403#discussion_r2447702745


##########
ui/src/pages/Questions/Ask/index.tsx:
##########
@@ -423,6 +425,24 @@ const Ask = () => {
   usePageTags({
     title: pageTitle,
   });
+
+  const handleContentHint = () => {
+    if (
+      !writeInfo ||
+      writeInfo.min_content === undefined ||
+      !writeInfo.min_content
+    ) {
+      return t(`form.fields.body.hint.optional_body`);
+    }
+
+    let str: string = t(`form.fields.body.hint.minimum_characters`);
+    str = str.replace(
+      `{{ min_content_length }}`,
+      writeInfo.min_content.toString(),
+    );
+    return str;

Review Comment:
   Thank you for pointing this out, I didn't know that we can pass variables in the i18n function 😅



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org