Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
208ae725
Commit
208ae725
authored
9 years ago
by
George Secrieru
Browse files
Options
Downloads
Patches
Plain Diff
Applying newly-added file upload settings.
parent
51ffb4f5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client/views/app/room.coffee
+3
-0
3 additions, 0 deletions
client/views/app/room.coffee
client/views/app/room.html
+2
-2
2 additions, 2 deletions
client/views/app/room.html
lib/fileUpload.coffee
+20
-12
20 additions, 12 deletions
lib/fileUpload.coffee
with
25 additions
and
14 deletions
client/views/app/room.coffee
+
3
−
0
View file @
208ae725
...
...
@@ -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
]
...
...
This diff is collapsed.
Click to expand it.
client/views/app/room.html
+
2
−
2
View file @
208ae725
...
...
@@ -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
This diff is collapsed.
Click to expand it.
lib/fileUpload.coffee
+
20
−
12
View file @
208ae725
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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment