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
75a51d13
Commit
75a51d13
authored
9 years ago
by
Rodrigo Nascimento
Browse files
Options
Downloads
Patches
Plain Diff
Send message with uploaded file after upload ends
parent
c8c9cf7d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/views/app/room.coffee
+1
-7
1 addition, 7 deletions
client/views/app/room.coffee
lib/fileUpload.coffee
+14
-1
14 additions, 1 deletion
lib/fileUpload.coffee
with
15 additions
and
8 deletions
client/views/app/room.coffee
+
1
−
7
View file @
75a51d13
...
@@ -467,16 +467,10 @@ Template.room.events
...
@@ -467,16 +467,10 @@ Template.room.events
FS
?
.
Utility
?
.
eachFile
e
,
(
file
)
->
FS
?
.
Utility
?
.
eachFile
e
,
(
file
)
->
newFile
=
new
(
FS
.
File
)(
file
)
newFile
=
new
(
FS
.
File
)(
file
)
newFile
.
rid
=
Session
.
get
(
'openedRoom'
)
newFile
.
rid
=
Session
.
get
(
'openedRoom'
)
newFile
.
userId
=
Meteor
.
userId
()
Files
.
insert
newFile
,
(
error
,
fileObj
)
->
Files
.
insert
newFile
,
(
error
,
fileObj
)
->
unless
error
unless
error
toastr
.
success
'Upload succeeded!'
toastr
.
success
'Upload succeeded!'
console
.
log
(
'room fileObj'
,
fileObj
)
if
window
.
rocketDebug
Meteor
.
call
'sendMessage'
,
_id
:
Random
.
id
()
rid
:
fileObj
.
rid
msg
:
'File Uploaded: *'
+
fileObj
.
original
.
name
+
'*
\n
'
+
document
.
location
.
origin
+
'/cfs/files/Files/'
+
fileObj
.
_id
file
:
_id
:
fileObj
.
_id
Template
.
room
.
onCreated
->
Template
.
room
.
onCreated
->
# this.scrollOnBottom = true
# this.scrollOnBottom = true
...
...
This diff is collapsed.
Click to expand it.
lib/fileUpload.coffee
+
14
−
1
View file @
75a51d13
if
FS
?
if
FS
?
@
fileStore
=
new
FS
.
Store
.
GridFS
'files'
@
fileStore
=
new
FS
.
Store
.
GridFS
'files'
fileStore
.
on
'stored'
,
Meteor
.
bindEnvironment
(
storeName
,
fileObj
)
->
Meteor
.
runAsUser
fileObj
.
userId
,
->
Meteor
.
call
'sendMessage'
,
_id
:
Random
.
id
()
rid
:
fileObj
.
rid
msg
:
"""
File Uploaded: *
#{
fileObj
.
original
.
name
}
*
#{
Meteor
.
absoluteUrl
()
}
/cfs/files/Files/
#{
fileObj
.
_id
}
"""
file
:
_id
:
fileObj
.
_id
@
Files
=
new
FS
.
Collection
'Files'
,
@
Files
=
new
FS
.
Collection
'Files'
,
stores
:
[
fileStore
],
stores
:
[
fileStore
],
filter
:
filter
:
maxSize
:
1048576
,
maxSize
:
2097152
,
allow
:
allow
:
contentTypes
:
[
'image/*'
]
contentTypes
:
[
'image/*'
]
onInvalid
:
(
message
)
->
onInvalid
:
(
message
)
->
...
...
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