mirror of
https://github.com/discourse/discourse.git
synced 2025-09-12 21:10:47 +08:00
FEATURE: Admins should be able to create polls even when plugin is disabled.
This commit is contained in:
parent
467b35df14
commit
c3cab98998
10 changed files with 50 additions and 13 deletions
|
@ -114,7 +114,7 @@ module PrettyText
|
|||
end
|
||||
end
|
||||
|
||||
def self.markdown(text, opts=nil)
|
||||
def self.markdown(text, opts={})
|
||||
# we use the exact same markdown converter as the client
|
||||
# TODO: use the same extensions on both client and server (in particular the template for mentions)
|
||||
baked = nil
|
||||
|
@ -143,7 +143,10 @@ module PrettyText
|
|||
context.eval("__optInput.topicId = #{opts[:topicId].to_i};")
|
||||
end
|
||||
|
||||
context.eval("__optInput.userId = #{opts[:user_id].to_i};") if opts[:user_id]
|
||||
|
||||
context.eval("__optInput.getURL = __getURL;")
|
||||
context.eval("__optInput.getCurrentUser = __getCurrentUser;")
|
||||
context.eval("__optInput.lookupAvatar = __lookupAvatar;")
|
||||
context.eval("__optInput.getTopicInfo = __getTopicInfo;")
|
||||
context.eval("__optInput.categoryHashtagLookup = __categoryLookup;")
|
||||
|
|
|
@ -68,6 +68,12 @@ module PrettyText
|
|||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def get_current_user(user_id)
|
||||
user = User.find_by(id: user_id)
|
||||
staff = user ? user.staff? : false
|
||||
{ staff: staff }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -46,6 +46,10 @@ function __lookupAvatar(p) {
|
|||
return __utils.avatarImg({size: "tiny", avatarTemplate: __helpers.avatar_template(p) }, __getURL);
|
||||
}
|
||||
|
||||
function __getCurrentUser(userId) {
|
||||
return __helpers.get_current_user(userId);
|
||||
}
|
||||
|
||||
I18n = {
|
||||
t: function(a,b) { return __helpers.t(a,b); }
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue