Skip to content

Commit

Permalink
chore : eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
h1ppox99 authored and BichraiX committed Jul 15, 2024
1 parent 75f439c commit 2b2cc45
Show file tree
Hide file tree
Showing 7 changed files with 361 additions and 314 deletions.
16 changes: 8 additions & 8 deletions packages/matrix-client-server/src/rooms/roomId/getEventId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ const GetEventId = (ClientServer: MatrixClientServer): expressAppHandler => {
return
}
const event = rows[0]
const response = {
content: event.content,
event_id: event.event_id,
origin_server_ts: event.origin_server_ts,
room_id: event.room_id,
sender: event.sender,
type: event.type,
const response: ClientEvent = {
content: event.content as Record<string, any>,
event_id: event.event_id as string,
origin_server_ts: event.origin_server_ts as number,
room_id: event.room_id as string,
sender: event.sender as string,
type: event.type as string,
unsigned: {
age: epoch() - (event.origin_server_ts as number)
}
} as ClientEvent
}
if (event.state_key !== null) {
response.state_key = event.state_key as string
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import MatrixClientServer from '../..'
import type MatrixClientServer from '../..'
import { errMsg, send, type expressAppHandler } from '@twake/utils'
import { type RoomMember } from '../../types'

Expand All @@ -18,7 +18,7 @@ const GetJoinedMembers = (
const roomId: string = ((req as Request).params as parameters).roomId
ClientServer.authenticate(req, res, (data, id) => {
// Check if the user has permission to retrieve this event
const userId = data.sub as string
const userId: string = data.sub
ClientServer.matrixDb
.get('local_current_membership', ['membership'], {
user_id: userId,
Expand Down Expand Up @@ -51,14 +51,14 @@ const GetJoinedMembers = (
{ 'local_current_membership.user_id': 'profiles.user_id' }
)
.then((rows) => {
const joined: { [key: string]: RoomMember } = {}
const joined: Record<string, RoomMember> = {}
for (const row of rows) {
joined[row.profiles_user_id as string] = {
avatar_url: row.profiles_avatar_url as string,
display_name: row.profiles_displayname as string
}
}
send(res, 200, { joined: joined })
send(res, 200, { joined })
})
.catch((err) => {
/* istanbul ignore next */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MatrixClientServer from '../..'
import { errMsg, expressAppHandler, send } from '@twake/utils'
import type MatrixClientServer from '../..'
import { errMsg, type expressAppHandler, send } from '@twake/utils'

interface query_parameters {
dir: 'b' | 'f'
Expand Down
4 changes: 2 additions & 2 deletions packages/matrix-client-server/src/rooms/rooms.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,14 @@ describe('Use configuration file', () => {
.set('Accept', 'application/json')
expect(response.statusCode).toBe(200)
expect(response.body).toHaveProperty('joined')
expect(response.body.joined['@testuser:example.com']).toBeDefined
expect(response.body.joined['@testuser:example.com']).toBeDefined()
expect(
response.body.joined['@testuser:example.com']
).toHaveProperty('display_name', 'Test User')
expect(
response.body.joined['@testuser:example.com']
).toHaveProperty('avatar_url', 'http://example.com/avatar.jpg')
expect(response.body.joined['@admin:example.com']).toBeDefined
expect(response.body.joined['@admin:example.com']).toBeDefined()
expect(response.body.joined['@admin:example.com']).toHaveProperty(
'display_name',
'Admin User'
Expand Down
Loading

0 comments on commit 2b2cc45

Please sign in to comment.