Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Allow QnA mode on any topic. #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

romanrizzi
Copy link

@romanrizzi romanrizzi commented Sep 15, 2021

If the enable_qa_globally setting is enabled, users can turn on QnA for new topics from the composer. Internally, this sets the topic subtype as question.

Screen Shot 2021-09-15 at 15 36 32

If the `enable_qa_globally` setting is enabled, users can turn on QnA for new topics from the composer. Internally, this sets the topic subtype as `question`.
Copy link
Member

@angusmcleod angusmcleod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romanrizzi Cool! This wasn't working for me out of the box though (see file extension comment). As long as it's working, happy to merge.

As an aside, I can see an argument for serializing subtype directly, instead of setting it via the property is_question. The archetype is already being serialized and having the subtype alongside may make more sense in situations like topic creation via the api. Perhaps you'd have a list of public subtypes, i.e. those that can be set in the client or via the api.

Up to you how you want to handle that one, but it may be useful to standardise clientside subtype switching.

export default {
shouldRender(args, component) {
return (
component.siteSettings.qa_enabled_globally &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this dependent on siteSettings.qa_enabled too?

@@ -0,0 +1,20 @@
import { withPluginApi } from "discourse/lib/plugin-api";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not running for me locally. I think it's due to the extension, i.e. it should be .js.es6?

) {
withPluginApi("0.12.3", (api) => {
api.serializeOnCreate("is_question", "isQuestion");
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More a matter of opinion, but you could add api.serializeToDraft here to keep the state between drafts.

angusmcleod pushed a commit that referenced this pull request Sep 9, 2022
We basically rewrote the plugin from the ground up and is actively
removing code from the fork. Eventually, we will delete this fork and
publish the code in this repository to a new repository.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants