mirror of
https://github.com/discourse/discourse.git
synced 2026-09-05 04:40:41 -05:00
FEATURE: site setting enable_mentions to turn on/off mentions
This commit is contained in:
committed by
Robin Ward
parent
3e4f02a180
commit
fd99e1ef56
@@ -77,16 +77,18 @@ export default Ember.Component.extend({
|
||||
const $input = this.$('.d-editor-input');
|
||||
const $preview = this.$('.d-editor-preview-wrapper');
|
||||
|
||||
$input.autocomplete({
|
||||
template: findRawTemplate('user-selector-autocomplete'),
|
||||
dataSource: term => userSearch({
|
||||
term,
|
||||
topicId,
|
||||
includeMentionableGroups: true
|
||||
}),
|
||||
key: "@",
|
||||
transformComplete: v => v.username || v.name
|
||||
});
|
||||
if (this.siteSettings.enable_mentions) {
|
||||
$input.autocomplete({
|
||||
template: findRawTemplate('user-selector-autocomplete'),
|
||||
dataSource: term => userSearch({
|
||||
term,
|
||||
topicId,
|
||||
includeMentionableGroups: true
|
||||
}),
|
||||
key: "@",
|
||||
transformComplete: v => v.username || v.name
|
||||
});
|
||||
}
|
||||
|
||||
if (this._enableAdvancedEditorPreviewSync()) {
|
||||
this._initInputPreviewSync($input, $preview);
|
||||
|
||||
@@ -154,13 +154,15 @@ export function applySearchAutocomplete($input, siteSettings, appEvents, options
|
||||
afterComplete
|
||||
}, options));
|
||||
|
||||
$input.autocomplete(_.merge({
|
||||
template: findRawTemplate('user-selector-autocomplete'),
|
||||
key: "@",
|
||||
width: '100%',
|
||||
treatAsTextarea: true,
|
||||
transformComplete: v => v.username || v.name,
|
||||
dataSource: term => userSearch({ term, includeGroups: true }),
|
||||
afterComplete
|
||||
}, options));
|
||||
if (Discourse.SiteSettings.enable_mentions) {
|
||||
$input.autocomplete(_.merge({
|
||||
template: findRawTemplate('user-selector-autocomplete'),
|
||||
key: "@",
|
||||
width: '100%',
|
||||
treatAsTextarea: true,
|
||||
transformComplete: v => v.username || v.name,
|
||||
dataSource: term => userSearch({ term, includeGroups: true }),
|
||||
afterComplete
|
||||
}, options));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -38,6 +38,10 @@ function addMention(buffer, matches, state) {
|
||||
}
|
||||
|
||||
export function setup(helper) {
|
||||
helper.registerOptions((opts, siteSettings) => {
|
||||
opts.features.mentions = !!siteSettings.enable_mentions;
|
||||
});
|
||||
|
||||
helper.registerPlugin(md => {
|
||||
|
||||
const rule = {
|
||||
|
||||
Reference in New Issue
Block a user