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
a02754a0
Commit
a02754a0
authored
9 years ago
by
Rodrigo Nascimento
Browse files
Options
Downloads
Patches
Plain Diff
Allow upsert messages with _id and use upsert in file upload
parent
eb9256c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/fileUpload.coffee
+1
-0
1 addition, 0 deletions
lib/fileUpload.coffee
packages/rocketchat-lib/server/sendMessage.coffee
+5
-2
5 additions, 2 deletions
packages/rocketchat-lib/server/sendMessage.coffee
server/methods/sendMessage.coffee
+2
-2
2 additions, 2 deletions
server/methods/sendMessage.coffee
with
8 additions
and
4 deletions
lib/fileUpload.coffee
+
1
−
0
View file @
a02754a0
...
@@ -14,6 +14,7 @@ if FS?
...
@@ -14,6 +14,7 @@ if FS?
"""
"""
file
:
file
:
_id
:
fileObj
.
_id
_id
:
fileObj
.
_id
,
{
upsert
:
true
}
@
Files
=
new
FS
.
Collection
'Files'
,
@
Files
=
new
FS
.
Collection
'Files'
,
stores
:
[
fileStore
],
stores
:
[
fileStore
],
...
...
This diff is collapsed.
Click to expand it.
packages/rocketchat-lib/server/sendMessage.coffee
+
5
−
2
View file @
a02754a0
RocketChat
.
sendMessage
=
(
user
,
message
,
room
)
->
RocketChat
.
sendMessage
=
(
user
,
message
,
room
,
options
)
->
if
not
user
or
not
message
or
not
room
.
_id
if
not
user
or
not
message
or
not
room
.
_id
return
false
return
false
...
@@ -15,7 +15,10 @@ RocketChat.sendMessage = (user, message, room) ->
...
@@ -15,7 +15,10 @@ RocketChat.sendMessage = (user, message, room) ->
message
=
RocketChat
.
callbacks
.
run
'beforeSaveMessage'
,
message
message
=
RocketChat
.
callbacks
.
run
'beforeSaveMessage'
,
message
message
.
_id
=
ChatMessage
.
insert
message
if
message
.
_id
?
and
options
?
.
upsert
is
true
ChatMessage
.
upsert
{
_id
:
message
.
_id
},
message
else
message
.
_id
=
ChatMessage
.
insert
message
###
###
Defer other updates as their return is not interesting to the user
Defer other updates as their return is not interesting to the user
...
...
This diff is collapsed.
Click to expand it.
server/methods/sendMessage.coffee
+
2
−
2
View file @
a02754a0
Meteor
.
methods
Meteor
.
methods
sendMessage
:
(
message
)
->
sendMessage
:
(
message
,
options
)
->
if
message
.
msg
?
.
length
>
RocketChat
.
settings
.
get
(
'Message_MaxAllowedSize'
)
if
message
.
msg
?
.
length
>
RocketChat
.
settings
.
get
(
'Message_MaxAllowedSize'
)
throw
new
Meteor
.
Error
400
,
'[methods] sendMessage -> Message size exceed Message_MaxAllowedSize'
throw
new
Meteor
.
Error
400
,
'[methods] sendMessage -> Message size exceed Message_MaxAllowedSize'
...
@@ -15,4 +15,4 @@ Meteor.methods
...
@@ -15,4 +15,4 @@ Meteor.methods
if
not
room
if
not
room
return
false
return
false
RocketChat
.
sendMessage
user
,
message
,
room
RocketChat
.
sendMessage
user
,
message
,
room
,
options
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