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
e043d33f
Unverified
Commit
e043d33f
authored
3 months ago
by
Martin Schoeler
Committed by
GitHub
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
chore: remove unused updateMessage meteor method (#34104)
parent
2c2a35af
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/meteor/client/methods/index.ts
+0
-1
0 additions, 1 deletion
apps/meteor/client/methods/index.ts
apps/meteor/client/methods/updateMessage.ts
+0
-97
0 additions, 97 deletions
apps/meteor/client/methods/updateMessage.ts
with
0 additions
and
98 deletions
apps/meteor/client/methods/index.ts
+
0
−
1
View file @
e043d33f
import
'
./openRoom
'
;
import
'
./openRoom
'
;
import
'
./pinMessage
'
;
import
'
./pinMessage
'
;
import
'
./unpinMessage
'
;
import
'
./unpinMessage
'
;
import
'
./updateMessage
'
;
This diff is collapsed.
Click to expand it.
apps/meteor/client/methods/updateMessage.ts
deleted
100644 → 0
+
0
−
97
View file @
2c2a35af
import
type
{
IEditedMessage
}
from
'
@rocket.chat/core-typings
'
;
import
type
{
ServerMethods
}
from
'
@rocket.chat/ddp-client
'
;
import
{
Meteor
}
from
'
meteor/meteor
'
;
import
{
Tracker
}
from
'
meteor/tracker
'
;
import
moment
from
'
moment
'
;
import
{
hasAtLeastOnePermission
,
hasPermission
}
from
'
../../app/authorization/client
'
;
import
{
Messages
}
from
'
../../app/models/client
'
;
import
{
settings
}
from
'
../../app/settings/client
'
;
import
{
t
}
from
'
../../app/utils/lib/i18n
'
;
import
{
dispatchToastMessage
}
from
'
../lib/toast
'
;
Meteor
.
methods
<
ServerMethods
>
({
updateMessage
(
message
)
{
const
uid
=
Meteor
.
userId
();
if
(
!
uid
)
{
return
;
}
const
originalMessage
=
Messages
.
findOne
(
message
.
_id
);
if
(
!
originalMessage
)
{
return
;
}
const
canEditMessage
=
hasAtLeastOnePermission
(
'
edit-message
'
,
message
.
rid
);
const
editAllowed
=
settings
.
get
(
'
Message_AllowEditing
'
);
let
editOwn
=
false
;
const
msgText
=
originalMessage
?.
attachments
?.[
0
]?.
description
??
originalMessage
.
msg
;
if
(
msgText
===
message
.
msg
)
{
return
;
}
if
(
originalMessage
?.
u
?.
_id
)
{
editOwn
=
originalMessage
.
u
.
_id
===
uid
;
}
const
me
=
Meteor
.
users
.
findOne
(
uid
);
if
(
!
me
)
{
return
;
}
if
(
!
(
canEditMessage
||
(
editAllowed
&&
editOwn
)))
{
dispatchToastMessage
({
type
:
'
error
'
,
message
:
t
(
'
error-action-not-allowed
'
,
{
action
:
t
(
'
Message_editing
'
)
}),
});
return
;
}
const
blockEditInMinutes
=
Number
(
settings
.
get
(
'
Message_AllowEditing_BlockEditInMinutes
'
)
as
number
|
undefined
);
const
bypassBlockTimeLimit
=
hasPermission
(
'
bypass-time-limit-edit-and-delete
'
,
message
.
rid
);
if
(
!
bypassBlockTimeLimit
&&
blockEditInMinutes
!==
0
)
{
if
(
originalMessage
.
ts
)
{
const
msgTs
=
moment
(
originalMessage
.
ts
);
if
(
msgTs
)
{
const
currentTsDiff
=
moment
().
diff
(
msgTs
,
'
minutes
'
);
if
(
currentTsDiff
>
blockEditInMinutes
)
{
dispatchToastMessage
({
type
:
'
error
'
,
message
:
t
(
'
error-message-editing-blocked
'
)
});
return
;
}
}
}
}
Tracker
.
nonreactive
(
async
()
=>
{
message
.
editedAt
=
new
Date
(
Date
.
now
());
message
.
editedBy
=
{
_id
:
uid
,
username
:
me
.
username
,
};
const
messageObject
:
Partial
<
IEditedMessage
>
=
{
editedAt
:
message
.
editedAt
,
editedBy
:
message
.
editedBy
,
msg
:
message
.
msg
,
};
if
(
originalMessage
.
attachments
?.
length
)
{
if
(
originalMessage
.
attachments
[
0
].
description
!==
undefined
)
{
delete
messageObject
.
msg
;
originalMessage
.
attachments
[
0
].
description
=
message
.
msg
;
}
}
Messages
.
update
(
{
'
_id
'
:
message
.
_id
,
'
u._id
'
:
uid
,
},
{
$set
:
messageObject
},
);
});
},
});
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