Skip to content

Commit

Permalink
Merge pull request #4476 from traPtitech/feat/groupMembersBulkInsertD…
Browse files Browse the repository at this point in the history
…eletion

グループメンバーの一括追加・削除の実装
  • Loading branch information
nokhnaton authored Jan 28, 2025
2 parents 2ac6622 + c29a9fa commit d3c98d1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 23 deletions.
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 onClickAdd = () => {
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)
} 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 role = ref('')
const isAdding = ref(false)
const add = async () => {
isAdding.value = true
const reqIds = Array.from(userIds.value)
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 }))
)
} 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

0 comments on commit d3c98d1

Please sign in to comment.