drodil / backstage-plugin-qeta

Backstage.io plugin for Q&A
https://www.npmjs.com/package/@drodil/backstage-plugin-qeta
MIT License
81 stars 25 forks source link

With list of allowedTags and allowCreation false configuration tags are not getting attached to question #139

Closed kedaroh-bh closed 5 months ago

kedaroh-bh commented 5 months ago

Description: I have a requirement that we don't want end user to create new tag and they can choose only from predefined tags, so I have configured allowedTags to few pre-defined tags and set the allowCreation to false. However when I attach/select a tag on Ask Question form and post the question the tag is not showing on question.

Steps to reproduce:

  1. Configure allowedTags to list of tags and allowCreation set to false, in app-config.yaml
  2. Click "Ask question" button
  3. Fill the form and select tag from the list.
  4. Post the question
  5. In question tile from question list tag is not displayed.

Attached screenshot question "test5"

However if I set allowCreation to true and add few tags in tags table manually and then post a question with tag then it working fine, screenshot question "test4"

Findings: in plugins\qeta-backend\src\service\routes\questions.ts getTags method below line is filtering out the selected tag when allowCreation is false.

image

image

drodil commented 5 months ago

Hi, good find! I think the filter is wrong and the allowedTags.includes should not be negated like it is now. Do you have possibility to try it out with that change and perhaps submit a PR? I can take a look once I am back from easter vacation next week some time.

kedaroh-bh commented 5 months ago

Hi @drodil, I saw your reply today and looks like you fixed it already, thank you.