FEATURE: Admins should be able to create polls even when plugin is disabled.

This commit is contained in:
Guo Xiang Tan
2016-07-07 15:52:56 +08:00
parent 467b35df14
commit c3cab98998
10 changed files with 50 additions and 13 deletions

View File

@@ -7,6 +7,7 @@ export function cook(text) {
const opts = {
getURL: Discourse.getURLWithCDN,
currentUser: Discourse.__container__.lookup('current-user:main'),
siteSettings
};

View File

@@ -12,7 +12,17 @@ export function registerOption(fn) {
export function buildOptions(state) {
setup();
const { siteSettings, getURL, lookupAvatar, getTopicInfo, topicId, categoryHashtagLookup } = state;
const {
siteSettings,
getURL,
lookupAvatar,
getTopicInfo,
topicId,
categoryHashtagLookup,
userId,
getCurrentUser,
currentUser
} = state;
const features = {
'bold-italics': true,
@@ -34,6 +44,9 @@ export function buildOptions(state) {
getTopicInfo,
topicId,
categoryHashtagLookup,
userId,
getCurrentUser,
currentUser,
mentionLookup: state.mentionLookup,
};

View File

@@ -197,12 +197,16 @@ class Post < ActiveRecord::Base
if cook_method == Post.cook_methods[:email]
cooked = EmailCook.new(raw).cook
else
cooked = if !self.user || SiteSetting.tl3_links_no_follow || !self.user.has_trust_level?(TrustLevel[3])
cloned = args.dup
cloned[1] ||= {}
post_user = self.user
cloned[1][:user_id] = post_user.id if post_user
cooked = if !post_user || SiteSetting.tl3_links_no_follow || !post_user.has_trust_level?(TrustLevel[3])
post_analyzer.cook(*args)
else
# At trust level 3, we don't apply nofollow to links
cloned = args.dup
cloned[1] ||= {}
cloned[1][:omit_nofollow] = true
post_analyzer.cook(*cloned)
end