File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
web/src/components/modals/GroupDetail Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ export const groupConfigNames = [
10
10
// 隐藏群组成员标识位
11
11
'hideGroupMemberDiscriminator' ,
12
12
13
+ // 禁止从群组中发起私信
14
+ 'disableCreateConverseFromGroup' ,
15
+
13
16
// 群组背景图
14
17
'groupBackgroundImage' ,
15
18
] as const ;
Original file line number Diff line number Diff line change @@ -75,6 +75,27 @@ const groupSlice = createSlice({
75
75
} ;
76
76
}
77
77
} ,
78
+ updateGroupConfig (
79
+ state ,
80
+ action : PayloadAction < {
81
+ groupId : string ;
82
+ configName : string ;
83
+ configValue : any ;
84
+ } >
85
+ ) {
86
+ const { groupId, configName, configValue } = action . payload ;
87
+
88
+ const groupInfo = state . groups [ groupId ] ;
89
+ if ( groupInfo ) {
90
+ state . groups [ groupId ] = {
91
+ ...groupInfo ,
92
+ config : {
93
+ ...( groupInfo . config ?? { } ) ,
94
+ [ configName ] : configValue ,
95
+ } ,
96
+ } ;
97
+ }
98
+ } ,
78
99
} ,
79
100
} ) ;
80
101
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import {
3
+ groupActions ,
3
4
model ,
4
5
showSuccessToasts ,
5
6
t ,
6
7
UploadFileResult ,
8
+ useAppDispatch ,
7
9
useAsyncRequest ,
8
10
useGroupInfo ,
9
11
} from 'tailchat-shared' ;
@@ -21,10 +23,18 @@ export const GroupConfig: React.FC<{
21
23
} > = React . memo ( ( props ) => {
22
24
const groupId = props . groupId ;
23
25
const groupInfo = useGroupInfo ( groupId ) ;
26
+ const dispatch = useAppDispatch ( ) ;
24
27
25
28
const [ { loading } , handleModifyConfig ] = useAsyncRequest (
26
29
async ( configName : model . group . GroupConfigNames , configValue : any ) => {
27
30
await model . group . modifyGroupConfig ( groupId , configName , configValue ) ;
31
+ dispatch (
32
+ groupActions . updateGroupConfig ( {
33
+ groupId,
34
+ configName,
35
+ configValue,
36
+ } )
37
+ ) ;
28
38
showSuccessToasts ( ) ;
29
39
} ,
30
40
[ groupId ]
You can’t perform that action at this time.
0 commit comments