Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
holi-chat-integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
app
holi-chat-integration
Commits
dca58023
Commit
dca58023
authored
1 year ago
by
Mauricio Palma
Browse files
Options
Downloads
Patches
Plain Diff
refactor: rename getPayloadFromEvent to getDataFromEventType
parent
59f0900f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/helpers/rooms.ts
+2
-2
2 additions, 2 deletions
src/helpers/rooms.ts
src/tests/rooms.test.ts
+3
-3
3 additions, 3 deletions
src/tests/rooms.test.ts
with
5 additions
and
5 deletions
src/helpers/rooms.ts
+
2
−
2
View file @
dca58023
...
...
@@ -171,7 +171,7 @@ export async function handleRoomStateEvent(
const
hasSameContent
=
hasSameEventContent
(
event
,
payload
)
if
(
hasSameContent
)
return
const
value
=
get
Payload
FromEvent
(
eventType
,
payload
)
const
value
=
get
Data
FromEvent
Type
(
eventType
,
payload
)
try
{
await
callback
(
spaceRoomId
,
value
)
...
...
@@ -209,7 +209,7 @@ export function hasSameEventContent(event: UknownRoomStateEvent, payload: SpaceP
/**
* @description It gets the payload to update for a specific event.
*/
export
function
get
Payload
FromEvent
(
type
:
EventType
,
payload
:
SpacePayload
)
{
export
function
get
Data
FromEvent
Type
(
type
:
EventType
,
payload
:
SpacePayload
)
{
switch
(
type
)
{
case
EventType
.
RoomName
:
return
payload
.
name
...
...
This diff is collapsed.
Click to expand it.
src/tests/rooms.test.ts
+
3
−
3
View file @
dca58023
import
{
findStateEventByType
,
get
Payload
FromEvent
,
handleRoomStateEvent
,
hasSameEventContent
}
from
'
../helpers/rooms
'
import
{
findStateEventByType
,
get
Data
FromEvent
Type
,
handleRoomStateEvent
,
hasSameEventContent
}
from
'
../helpers/rooms
'
import
{
NEW_ROOM_AVATAR_VALUE_FIXTURE
,
NEW_ROOM_NAME_VALUE_FIXTURE
,
...
...
@@ -64,8 +64,8 @@ describe('Space Updates', () => {
})
it
(
'
should get the value based on the event type
'
,
()
=>
{
expect
(
get
Payload
FromEvent
(
EventType
.
RoomAvatar
,
SPACE_PAYLOAD_FIXTURE
)).
toBe
(
SPACE_PAYLOAD_FIXTURE
.
avatar
)
expect
(
get
Payload
FromEvent
(
EventType
.
RoomName
,
SPACE_PAYLOAD_FIXTURE
)).
toBe
(
SPACE_PAYLOAD_FIXTURE
.
name
)
expect
(
get
Data
FromEvent
Type
(
EventType
.
RoomAvatar
,
SPACE_PAYLOAD_FIXTURE
)).
toBe
(
SPACE_PAYLOAD_FIXTURE
.
avatar
)
expect
(
get
Data
FromEvent
Type
(
EventType
.
RoomName
,
SPACE_PAYLOAD_FIXTURE
)).
toBe
(
SPACE_PAYLOAD_FIXTURE
.
name
)
})
it
(
'
should handle `m.room.name` event content comparison
'
,
()
=>
{
...
...
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