 		observer.observe wrapperUl,
 			childList: true
 		# observer.disconnect()
+
+	template.onWindowResize = ->
+		Meteor.defer ->
+			template.sendToBottomIfNecessaryDebounced()
+
+	window.addEventListener 'resize', template.onWindowResize
 
 	wrapper.addEventListener 'mousewheel', ->
 		template.atBottom = false

			evt["click .#{button.id}"] = button.action
			Template.room.events evt

Template.room.onDestroyed ->
	RocketChat.TabBar.resetButtons()

Template.room.onRendered ->
	this.chatMessages = new ChatMessages

	fileUploadAllowedMediaTypes: ->
		return RocketChat.settings.get('FileUpload_MediaTypeWhiteList')


Template.room.events
	"touchstart .message": (e, t) ->
		message = this._arguments[1]
