Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
matrix-android-sdk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Circles
matrix-android-sdk
Commits
715fca39
Commit
715fca39
authored
1 year ago
by
Taras
Browse files
Options
Downloads
Patches
Plain Diff
Removed m.new_content validation
parent
87a366b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/EventEditValidator.kt
+8
-6
8 additions, 6 deletions
...x/android/sdk/internal/session/room/EventEditValidator.kt
with
8 additions
and
6 deletions
matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/EventEditValidator.kt
+
8
−
6
View file @
715fca39
...
@@ -51,6 +51,8 @@ internal class EventEditValidator @Inject constructor(val cryptoStore: IMXCommon
...
@@ -51,6 +51,8 @@ internal class EventEditValidator @Inject constructor(val cryptoStore: IMXCommon
*
*
* If the original event was encrypted, the replacement should be too.
* If the original event was encrypted, the replacement should be too.
*/
*/
// Removed m.new_content validation for Circles
fun
validateEdit
(
originalEvent
:
Event
?,
replaceEvent
:
Event
):
EditValidity
{
fun
validateEdit
(
originalEvent
:
Event
?,
replaceEvent
:
Event
):
EditValidity
{
// we might not know the original event at that time. In this case we can't perform the validation
// we might not know the original event at that time. In this case we can't perform the validation
// Edits should be revalidated when the original event is received
// Edits should be revalidated when the original event is received
...
@@ -98,9 +100,9 @@ internal class EventEditValidator @Inject constructor(val cryptoStore: IMXCommon
...
@@ -98,9 +100,9 @@ internal class EventEditValidator @Inject constructor(val cryptoStore: IMXCommon
if
(
originalDecrypted
.
type
!=
replaceDecrypted
.
type
)
{
if
(
originalDecrypted
.
type
!=
replaceDecrypted
.
type
)
{
return
EditValidity
.
Invalid
(
"replacement and original events must have the same type"
)
return
EditValidity
.
Invalid
(
"replacement and original events must have the same type"
)
}
}
if
(!
hasNewContent
(
replaceDecrypted
.
type
,
replaceDecrypted
.
clearContent
))
{
//
if (!hasNewContent(replaceDecrypted.type, replaceDecrypted.clearContent)) {
return
EditValidity
.
Invalid
(
"replacement event must have an m.new_content property"
)
//
return EditValidity.Invalid("replacement event must have an m.new_content property")
}
//
}
}
else
{
}
else
{
if
(
originalEvent
.
getRelationContent
()
?.
type
==
RelationType
.
REPLACE
)
{
if
(
originalEvent
.
getRelationContent
()
?.
type
==
RelationType
.
REPLACE
)
{
return
EditValidity
.
Invalid
(
"The original event must not, itself, have a rel_type of m.replace "
)
return
EditValidity
.
Invalid
(
"The original event must not, itself, have a rel_type of m.replace "
)
...
@@ -113,9 +115,9 @@ internal class EventEditValidator @Inject constructor(val cryptoStore: IMXCommon
...
@@ -113,9 +115,9 @@ internal class EventEditValidator @Inject constructor(val cryptoStore: IMXCommon
if
(
originalEvent
.
type
!=
replaceEvent
.
type
)
{
if
(
originalEvent
.
type
!=
replaceEvent
.
type
)
{
return
EditValidity
.
Invalid
(
"replacement and original events must have the same type"
)
return
EditValidity
.
Invalid
(
"replacement and original events must have the same type"
)
}
}
if
(!
hasNewContent
(
replaceEvent
.
type
,
replaceEvent
.
content
))
{
//
if (!hasNewContent(replaceEvent.type, replaceEvent.content)) {
return
EditValidity
.
Invalid
(
"replacement event must have an m.new_content property"
)
//
return EditValidity.Invalid("replacement event must have an m.new_content property")
}
//
}
}
}
return
EditValidity
.
Valid
return
EditValidity
.
Valid
...
...
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