-
Notifications
You must be signed in to change notification settings - Fork 24
FEATURE: Allow QnA mode on any topic. #44
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
base: master
Are you sure you want to change the base?
Conversation
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`.
80a0955
to
662d57b
Compare
There was a problem hiding this 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 && |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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"); | ||
}); |
There was a problem hiding this comment.
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.
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.
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 asquestion
.