 		ws = RocketChatAssetsInstance.createWriteStream asset, contentType
 		ws.on 'end', Meteor.bindEnvironment ->
 			Meteor.setTimeout ->
-				RocketChat.settings.updateById "Assets_#{asset}", {
+				key = "Assets_#{asset}"
+				value = {
 					url: "assets/#{asset}.#{extension}"
 					defaultUrl: assets[asset].defaultUrl
 				}
+				RocketChat.settings.updateById key, value
+				RocketChat.Assets.processAsset key, value
 			, 200
 
 		rs.pipe ws

		unless hasPermission
			throw new Meteor.Error 'error-action-now-allowed', 'Managing assets not allowed', { method: 'refreshClients', action: 'Managing_assets' }

		RocketChat.Assets.refreshClients


	unsetAsset: (asset) ->

		RocketChat.settings.add "Assets_#{key}", {defaultUrl: value.defaultUrl}, { type: 'asset', group: 'Assets', fileConstraints: value.constraints, i18nLabel: value.label, asset: key, public: true }


RocketChat.models.Settings.find().observe
	added: (record) ->
		RocketChat.Assets.processAsset record._id, record.value
	changed: (record) ->
		RocketChat.Assets.processAsset record._id, record.value
	removed: (record) ->
		RocketChat.Assets.processAsset record._id, undefined

Meteor.startup ->
	Meteor.setTimeout ->
		process.emit('message', {refresh: 'client'})
	, 200

calculateClientHash = WebAppHashing.calculateClientHash
WebAppHashing.calculateClientHash = (manifest, includeFilter, runtimeConfigOverride) ->
	for key, value of assets
		if not value.cache? && not value.defaultUrl?
			continue

		cache = {}
		if value.cache
