mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-04-05 17:15:40 +00:00
lint fixes
This commit is contained in:
parent
3a21c36d02
commit
0ff766f457
@ -43,7 +43,12 @@
|
||||
<profile-avatar :profile="option" size="small" />
|
||||
<div class="chat-search-result-info">
|
||||
<span class="chat-search-result-name">
|
||||
<os-icon v-if="option.__typename === 'Group'" :icon="icons.group" class="chat-search-group-icon" />{{ option.name }}
|
||||
<os-icon
|
||||
v-if="option.__typename === 'Group'"
|
||||
:icon="icons.group"
|
||||
class="chat-search-group-icon"
|
||||
/>
|
||||
{{ option.name }}
|
||||
</span>
|
||||
<span class="chat-search-result-detail">
|
||||
{{ option.__typename === 'Group' ? `&${option.slug}` : `@${option.slug}` }}
|
||||
|
||||
@ -1129,7 +1129,9 @@ describe('Chat.vue', () => {
|
||||
it('replaces rooms instead of appending', async () => {
|
||||
wrapper = Wrapper()
|
||||
wrapper.vm.rooms = [mockRoom({ id: 'old', roomId: 'old' })]
|
||||
mocks.$apollo.query.mockResolvedValue({ data: { Room: [mockRoom({ id: 'new', roomId: 'new' })] } })
|
||||
mocks.$apollo.query.mockResolvedValue({
|
||||
data: { Room: [mockRoom({ id: 'new', roomId: 'new' })] },
|
||||
})
|
||||
await wrapper.vm.fetchRooms({ replace: true })
|
||||
expect(wrapper.vm.rooms).toHaveLength(1)
|
||||
expect(wrapper.vm.rooms[0].id).toBe('new')
|
||||
|
||||
@ -71,7 +71,11 @@
|
||||
</div>
|
||||
|
||||
<div slot="room-header-avatar">
|
||||
<component :is="roomHeaderLink ? 'nuxt-link' : 'span'" :to="roomHeaderLink" class="chat-header-profile-link">
|
||||
<component
|
||||
:is="roomHeaderLink ? 'nuxt-link' : 'span'"
|
||||
:to="roomHeaderLink"
|
||||
class="chat-header-profile-link"
|
||||
>
|
||||
<profile-avatar
|
||||
v-if="selectedRoom"
|
||||
:profile="selectedRoomProfile"
|
||||
@ -82,14 +86,27 @@
|
||||
|
||||
<div slot="room-header-info">
|
||||
<div class="vac-room-name vac-text-ellipsis">
|
||||
<component :is="roomHeaderLink ? 'nuxt-link' : 'span'" :to="roomHeaderLink" class="chat-header-profile-link">
|
||||
<os-icon v-if="selectedRoom && selectedRoom.isGroupRoom" :icon="icons.group" class="room-group-icon" />
|
||||
<component
|
||||
:is="roomHeaderLink ? 'nuxt-link' : 'span'"
|
||||
:to="roomHeaderLink"
|
||||
class="chat-header-profile-link"
|
||||
>
|
||||
<os-icon
|
||||
v-if="selectedRoom && selectedRoom.isGroupRoom"
|
||||
:icon="icons.group"
|
||||
class="room-group-icon"
|
||||
/>
|
||||
{{ selectedRoom ? selectedRoom.roomName : '' }}
|
||||
</component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-for="room in rooms" v-if="room.isGroupRoom" :slot="'room-list-info_' + room.roomId" :key="'info-' + room.id">
|
||||
<div
|
||||
v-for="room in rooms"
|
||||
v-if="room.isGroupRoom"
|
||||
:slot="'room-list-info_' + room.roomId"
|
||||
:key="'info-' + room.id"
|
||||
>
|
||||
<div class="vac-room-name vac-text-ellipsis room-name-with-icon">
|
||||
<os-icon :icon="icons.group" class="room-group-icon" />
|
||||
{{ room.roomName }}
|
||||
@ -110,7 +127,7 @@
|
||||
:key="'avatar-' + msg._id"
|
||||
:profile="messageUserProfile(msg.senderId)"
|
||||
class="vac-message-avatar"
|
||||
style="align-self: flex-end; margin: 0 0 2px; cursor: pointer;"
|
||||
style="align-self: flex-end; margin: 0 0 2px; cursor: pointer"
|
||||
@click.native="navigateToUserProfile(msg.senderId)"
|
||||
/>
|
||||
</template>
|
||||
@ -262,7 +279,9 @@ export default {
|
||||
},
|
||||
selectedRoomProfile() {
|
||||
if (!this.selectedRoom) return null
|
||||
return this.selectedRoom.isGroupRoom ? this.selectedRoom.groupProfile : this.selectedRoom.userProfile
|
||||
return this.selectedRoom.isGroupRoom
|
||||
? this.selectedRoom.groupProfile
|
||||
: this.selectedRoom.userProfile
|
||||
},
|
||||
roomHeaderLink() {
|
||||
if (!this.selectedRoom) return null
|
||||
@ -785,7 +804,8 @@ export default {
|
||||
saved: true,
|
||||
_rawDate: new Date().toISOString(),
|
||||
_originalAvatar:
|
||||
this.selectedRoom?.users?.find((u) => u.id === this.currentUser.id)?.avatar || this.initialsAvatarUrl(this.currentUser.name),
|
||||
this.selectedRoom?.users?.find((u) => u.id === this.currentUser.id)?.avatar ||
|
||||
this.initialsAvatarUrl(this.currentUser.name),
|
||||
senderId: this.currentUser.id,
|
||||
files:
|
||||
messageDetails.files?.map((file) => ({
|
||||
@ -926,7 +946,9 @@ export default {
|
||||
|
||||
async fetchServerRoom(variables) {
|
||||
try {
|
||||
const { data: { Room } } = await this.$apollo.query({
|
||||
const {
|
||||
data: { Room },
|
||||
} = await this.$apollo.query({
|
||||
query: roomQuery(),
|
||||
variables,
|
||||
fetchPolicy: 'no-cache',
|
||||
@ -971,7 +993,11 @@ export default {
|
||||
if (await this.fetchServerRoom({ userId })) return
|
||||
|
||||
// Create a virtual room (no backend call — room is created on first message)
|
||||
const currentUserProfile = { id: this.currentUser.id, name: this.currentUser.name, avatar: this.currentUser.avatar }
|
||||
const currentUserProfile = {
|
||||
id: this.currentUser.id,
|
||||
name: this.currentUser.name,
|
||||
avatar: this.currentUser.avatar,
|
||||
}
|
||||
const otherUserProfile = { id: userId, name: userName, avatar: userAvatarObj }
|
||||
const virtualRoom = {
|
||||
id: `temp-${userId}`,
|
||||
@ -1009,7 +1035,9 @@ export default {
|
||||
if (await this.fetchServerRoom({ groupId })) return
|
||||
|
||||
try {
|
||||
const { data: { CreateGroupRoom } } = await this.$apollo.mutate({
|
||||
const {
|
||||
data: { CreateGroupRoom },
|
||||
} = await this.$apollo.mutate({
|
||||
mutation: createGroupRoom(),
|
||||
variables: { groupId },
|
||||
})
|
||||
|
||||
@ -38,7 +38,14 @@ export const roomQuery = () => gql`
|
||||
${imageUrls}
|
||||
|
||||
query Room($first: Int, $before: String, $id: ID, $userId: ID, $groupId: ID, $search: String) {
|
||||
Room(first: $first, before: $before, id: $id, userId: $userId, groupId: $groupId, search: $search) {
|
||||
Room(
|
||||
first: $first
|
||||
before: $before
|
||||
id: $id
|
||||
userId: $userId
|
||||
groupId: $groupId
|
||||
search: $search
|
||||
) {
|
||||
id
|
||||
roomId
|
||||
roomName
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user