mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
that fix should have been in the emoji plugin
This commit is contained in:
parent
be835785f8
commit
1457a3792d
3 changed files with 8 additions and 10 deletions
|
@ -111,7 +111,7 @@ class Post < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.white_listed_image_classes
|
||||
@white_listed_image_classes ||= ['avatar', 'favicon', 'thumbnail', 'emoji']
|
||||
@white_listed_image_classes ||= ['avatar', 'favicon', 'thumbnail']
|
||||
end
|
||||
|
||||
def post_analyzer
|
||||
|
|
|
@ -5,3 +5,10 @@
|
|||
|
||||
register_asset('javascripts/emoji.js.erb', :server_side)
|
||||
register_asset('stylesheets/emoji.css')
|
||||
|
||||
after_initialize do
|
||||
|
||||
# whitelist emojis so that new user can post emojis
|
||||
Post::white_listed_image_classes << "emoji"
|
||||
|
||||
end
|
||||
|
|
|
@ -125,7 +125,6 @@ describe Post do
|
|||
let(:post_with_favicon) { post_with_body('<img src="/assets/favicons/wikipedia.png" class="favicon">', newuser) }
|
||||
let(:post_with_thumbnail) { post_with_body('<img src="/assets/emoji/smiley.png" class="thumbnail">', newuser) }
|
||||
let(:post_with_two_classy_images) { post_with_body("<img src='http://discourse.org/logo.png' class='classy'> <img src='http://bbc.co.uk/sherlock.jpg' class='classy'>", newuser) }
|
||||
let(:post_with_emojis) { post_with_body("<img src='/plugins/emoji/images/smile.png' title=':smile:' class='emoji' alt='smile'><img src='/plugins/emoji/images/wink.png' title=':wink:' class='emoji' alt='wink'>", newuser) }
|
||||
|
||||
it "returns 0 images for an empty post" do
|
||||
Fabricate.build(:post).image_count.should == 0
|
||||
|
@ -151,10 +150,6 @@ describe Post do
|
|||
post_with_thumbnail.image_count.should == 0
|
||||
end
|
||||
|
||||
it "doesn't count emojies as images" do
|
||||
post_with_emojis.image_count.should == 0
|
||||
end
|
||||
|
||||
it "doesn't count whitelisted images" do
|
||||
Post.stubs(:white_listed_image_classes).returns(["classy"])
|
||||
post_with_two_classy_images.image_count.should == 0
|
||||
|
@ -171,10 +166,6 @@ describe Post do
|
|||
post_one_image.should be_valid
|
||||
end
|
||||
|
||||
it "allows a new user to post emojies" do
|
||||
post_with_emojis.should be_valid
|
||||
end
|
||||
|
||||
it "doesn't allow more than the maximum" do
|
||||
post_two_images.should_not be_valid
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue