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
f17df4cf
Commit
f17df4cf
authored
9 years ago
by
Marcelo Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
Fixed message editing by non-admins
parent
46d7a2f9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/methods/updateMessage.coffee
+9
-8
9 additions, 8 deletions
server/methods/updateMessage.coffee
with
9 additions
and
8 deletions
server/methods/updateMessage.coffee
+
9
−
8
View file @
f17df4cf
...
...
@@ -6,21 +6,22 @@ Meteor.methods
if
not
RocketChat
.
settings
.
get
'Message_AllowEditing'
throw
new
Meteor
.
Error
'message-editing-not-allowed'
,
"[methods] updateMessage -> Message editing not allowed"
user
=
Meteor
.
users
.
findOne
Meteor
.
userId
()
user
=
Meteor
.
users
.
findOne
Meteor
.
userId
()
unless
user
?
.
admin
is
true
or
message
.
u
.
_id
is
Meteor
.
userId
()
originalMessage
=
ChatMessage
.
findOne
message
.
_id
unless
user
?
.
admin
is
true
or
originalMessage
?
.
u
?
.
_id
is
Meteor
.
userId
()
throw
new
Meteor
.
Error
'not-authorized'
,
'[methods] updateMessage -> Not authorized'
console
.
log
'[methods] updateMessage -> '
.
green
,
'userId:'
,
Meteor
.
userId
(),
'arguments:'
,
arguments
# If we keep history of edits, insert a new message to store history information
if
RocketChat
.
settings
.
get
'Message_KeepHistory'
history
=
ChatMessage
.
findOne
message
.
_id
history
.
_hidden
=
true
history
.
parent
=
history
.
_id
history
.
ets
=
new
Date
()
delete
history
.
_id
ChatMessage
.
insert
history
originalMessage
.
_hidden
=
true
originalMessage
.
parent
=
originalMessage
.
_id
originalMessage
.
ets
=
new
Date
()
delete
originalMessage
.
_id
ChatMessage
.
insert
originalMessage
message
.
ets
=
new
Date
()
...
...
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