Skip to content
Snippets Groups Projects
Commit 208ae725 authored by George Secrieru's avatar George Secrieru
Browse files

Applying newly-added file upload settings.

parent 51ffb4f5
No related branches found
No related tags found
No related merge requests found
......@@ -221,6 +221,9 @@ Template.room.helpers
compactView: ->
return 'compact' if Meteor.user()?.settings?.preferences?.compactView
fileUploadAllowedMediaTypes: ->
return RocketChat.settings.get('FileUpload_MediaTypeWhiteList')
Template.room.events
"touchstart .message": (e, t) ->
message = this._arguments[1]
......
......@@ -81,7 +81,7 @@
<div style="display: flex">
<div class="file">
<i class="octicon octicon-cloud-upload file"></i>
<input type="file" accept="image/*">
<input type="file" accept="{{fileUploadAllowedMediaTypes}}">
</div>
<div class="input-message-container">
{{> messagePopupConfig getPupupConfig}}
......@@ -152,4 +152,4 @@
{{> Template.dynamic template=flexTemplate data=flexData}}
</section>
</div>
</template>
</template>
\ No newline at end of file
if UploadFS?
@fileCollection = new Mongo.Collection 'rocketchat_uploads'
fileCollection.allow
insert: (userId, doc) ->
return userId
......@@ -11,14 +10,23 @@ if UploadFS?
remove: (userId, doc) ->
return userId is doc.userId
Meteor.fileStore = new UploadFS.store.GridFS
collection: fileCollection
name: 'rocketchat_uploads'
collectionName: 'rocketchat_uploads'
filter: new UploadFS.Filter
maxSize: 2097152
contentTypes: ['image/*', 'audio/*']
onFinishUpload: ->
console.log arguments
onRead: (fileId, file, req, res) ->
res.setHeader 'content-disposition', 'download'
initFileStore = ->
Meteor.fileStore = new UploadFS.store.GridFS
collection: fileCollection
name: 'rocketchat_uploads'
collectionName: 'rocketchat_uploads'
filter: new UploadFS.Filter
maxSize: RocketChat.settings.get('FileUpload_MaxFileSize')
contentTypes: _.map(RocketChat.settings.get('FileUpload_MediaTypeWhiteList').split(','), (item) -> return item.trim() )
onFinishUpload: ->
console.log arguments
onRead: (fileId, file, req, res) ->
res.setHeader 'content-disposition', 'download'
if Meteor.isServer
initFileStore()
else
Tracker.autorun (c) ->
if RocketChat.settings.subscription.ready()
initFileStore()
c.stop()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment