Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

グループメンバーの一括追加・削除の実装 #4476

Merged
merged 6 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@mdi/js": "^7.4.47",
"@sapphi-red/web-noise-suppressor": "^0.3.5",
"@shiguredo/virtual-background": "^2023.2.0",
"@traptitech/traq": "^3.17.0-3",
"@traptitech/traq": "^3.20.1-1",
"@traptitech/traq-markdown-it": "^6.3.0",
"autosize": "^6.0.1",
"cropperjs": "^1.6.2",
Expand Down
9 changes: 1 addition & 8 deletions src/components/GroupManager/GroupMemberList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,8 @@
const onClickDeleteAll = async () => {
if (!confirm('本当に全メンバーを削除しますか?')) return

const ONCE = 10
try {
for (let i = 0; i < Math.ceil(props.members.length / ONCE); i++) {
await Promise.all(
props.members
.slice(i * ONCE, (i + 1) * ONCE)
.map(m => apis.removeUserGroupMember(props.groupId, m.id))
)
}
apis.removeUserGroupMembers(props.groupId)

Check warning on line 61 in src/components/GroupManager/GroupMemberList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/GroupManager/GroupMemberList.vue#L61

Added line #L61 was not covered by tests
} catch {
addErrorToast('全メンバーの削除に失敗しました')
}
Expand Down
11 changes: 5 additions & 6 deletions src/components/Modal/GroupMemberAddModal/GroupMemberAddModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@
const isAdding = ref(false)
const add = async () => {
isAdding.value = true
const reqIds = Array.from(userIds.value)

Check warning on line 54 in src/components/Modal/GroupMemberAddModal/GroupMemberAddModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Modal/GroupMemberAddModal/GroupMemberAddModal.vue#L54

Added line #L54 was not covered by tests
try {
for (const userId of userIds.value) {
await apis.addUserGroupMember(props.id, {
id: userId,
role: role.value
})
}
await apis.addUserGroupMember(
props.id,
reqIds.map(id => ({ id, role: role.value }))
)

Check warning on line 59 in src/components/Modal/GroupMemberAddModal/GroupMemberAddModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Modal/GroupMemberAddModal/GroupMemberAddModal.vue#L56-L59

Added lines #L56 - L59 were not covered by tests
} catch {
addErrorToast('グループメンバーの追加に失敗しました')
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/apis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {
WebRTCUserStateSessionsInner,
ChannelEvent,
ChannelEventTypeEnum,
ChildCreatedEvent,
Expand All @@ -8,6 +7,7 @@ import type {
ParentChangedEvent,
PinAddedEvent,
PinRemovedEvent,
Session,
SubscribersChangedEvent,
TopicChangedEvent,
VisibilityChangedEvent
Expand All @@ -18,7 +18,7 @@ import { DEV_SERVER } from '/@/lib/define'
import type { AxiosError } from 'axios'
import { constructFilesPath } from '/@/router'

export type { WebRTCUserStateSessionsInner as WebRTCUserStateSessions }
export type { Session as WebRTCUserStateSessions }

export const BASE_PATH = '/api/v3'
export const WEBSOCKET_ENDPOINT = '/api/v3/ws'
Expand Down
Loading