mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
Silence CSS logging in development - it's way too noisy
This commit is contained in:
@ -22,6 +22,7 @@ export default {
|
|||||||
|
|
||||||
// Observe file changes
|
// Observe file changes
|
||||||
messageBus.subscribe("/file-change", function(data) {
|
messageBus.subscribe("/file-change", function(data) {
|
||||||
|
|
||||||
if (Handlebars.compile && !Ember.TEMPLATES.empty) {
|
if (Handlebars.compile && !Ember.TEMPLATES.empty) {
|
||||||
// hbs notifications only happen in dev
|
// hbs notifications only happen in dev
|
||||||
Ember.TEMPLATES.empty = Handlebars.compile("<div></div>");
|
Ember.TEMPLATES.empty = Handlebars.compile("<div></div>");
|
||||||
|
@ -4,9 +4,14 @@ class StylesheetCache < ActiveRecord::Base
|
|||||||
MAX_TO_KEEP = 50
|
MAX_TO_KEEP = 50
|
||||||
|
|
||||||
def self.add(target, digest, content, source_map)
|
def self.add(target, digest, content, source_map)
|
||||||
|
old_logger = ActiveRecord::Base.logger
|
||||||
|
|
||||||
return false if where(target: target, digest: digest).exists?
|
return false if where(target: target, digest: digest).exists?
|
||||||
|
|
||||||
|
if Rails.env.development?
|
||||||
|
ActiveRecord::Base.logger = nil
|
||||||
|
end
|
||||||
|
|
||||||
success = create(target: target, digest: digest, content: content, source_map: source_map)
|
success = create(target: target, digest: digest, content: content, source_map: source_map)
|
||||||
|
|
||||||
count = StylesheetCache.count
|
count = StylesheetCache.count
|
||||||
@ -25,6 +30,10 @@ class StylesheetCache < ActiveRecord::Base
|
|||||||
success
|
success
|
||||||
rescue ActiveRecord::RecordNotUnique
|
rescue ActiveRecord::RecordNotUnique
|
||||||
false
|
false
|
||||||
|
ensure
|
||||||
|
if Rails.env.development? && old_logger
|
||||||
|
ActiveRecord::Base.logger = old_logger
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -15,10 +15,10 @@ describe StylesheetCache do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "does nothing if digest is set and already exists" do
|
it "does nothing if digest is set and already exists" do
|
||||||
StylesheetCache.destroy_all
|
StylesheetCache.delete_all
|
||||||
|
|
||||||
StylesheetCache.add("a", "b", "c", "map")
|
expect(StylesheetCache.add("a", "b", "c", "map")).to be_present
|
||||||
StylesheetCache.add("a", "b", "cc", "map")
|
expect(StylesheetCache.add("a", "b", "cc", "map")).to eq(false)
|
||||||
|
|
||||||
expect(StylesheetCache.count).to eq 1
|
expect(StylesheetCache.count).to eq 1
|
||||||
expect(StylesheetCache.first.content).to eq "c"
|
expect(StylesheetCache.first.content).to eq "c"
|
||||||
|
Reference in New Issue
Block a user