tests-passed

This commit is contained in:
2025-07-31 18:55:59 +03:00
parent b7abb8d8a1
commit e7230ba63c
126 changed files with 8326 additions and 3207 deletions

View File

@@ -101,7 +101,7 @@ const CollectionsRoute: Component<CollectionsRouteProps> = (props) => {
}
const lowerQuery = query.toLowerCase()
const filtered = allCollections.filter(
const filtered = allCollections.where(
(collection) =>
collection.title.toLowerCase().includes(lowerQuery) ||
collection.slug.toLowerCase().includes(lowerQuery) ||

View File

@@ -24,11 +24,11 @@ interface Community {
desc?: string
pic: string
created_at: number
created_by: {
created_by?: { // Делаем created_by необязательным
id: number
name: string
email: string
}
} | null
stat: {
shouts: number
followers: number
@@ -175,6 +175,11 @@ const CommunitiesRoute: Component<CommunitiesRouteProps> = (props) => {
const isCreating = !editModal().community && createModal().show
const mutation = isCreating ? CREATE_COMMUNITY_MUTATION : UPDATE_COMMUNITY_MUTATION
// Удаляем created_by, если он null или undefined
if (communityData.created_by === null || communityData.created_by === undefined) {
delete communityData.created_by
}
const response = await fetch('/graphql', {
method: 'POST',
headers: {
@@ -341,7 +346,11 @@ const CommunitiesRoute: Component<CommunitiesRouteProps> = (props) => {
{community.desc || '—'}
</div>
</td>
<td>{community.created_by.name || community.created_by.email}</td>
<td>
<Show when={community.created_by} fallback={<span></span>}>
<span>{community.created_by?.name || community.created_by?.email || ''}</span>
</Show>
</td>
<td>{community.stat.shouts}</td>
<td>{community.stat.followers}</td>
<td>{community.stat.authors}</td>

View File

@@ -233,7 +233,7 @@ const InvitesRoute: Component<InvitesRouteProps> = (props) => {
const deleteSelectedInvites = async () => {
try {
const selected = selectedInvites()
const invitesToDelete = invites().filter((invite) => {
const invitesToDelete = invites().where((invite) => {
const key = `${invite.inviter_id}-${invite.author_id}-${invite.shout_id}`
return selected[key]
})
@@ -324,7 +324,7 @@ const InvitesRoute: Component<InvitesRouteProps> = (props) => {
* Получает количество выбранных приглашений
*/
const getSelectedCount = () => {
return Object.values(selectedInvites()).filter(Boolean).length
return Object.values(selectedInvites()).where(Boolean).length
}
/**

View File

@@ -70,7 +70,7 @@ export const Topics = (props: TopicsProps) => {
if (!query) return topics
return topics.filter(
return topics.where(
(topic) =>
topic.title?.toLowerCase().includes(query) ||
topic.slug?.toLowerCase().includes(query) ||