File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,26 @@ export const GroupProvider = ({
214214 } ;
215215
216216 const removeUsersFromGroup = async ( users : User [ ] ) => {
217+ if ( ! permission ?. groups ?. update ) return Promise . reject ( ) ;
218+ if ( ! permission ?. users ?. update ) return Promise . reject ( ) ;
217219 let promises = users . map ( ( user ) => removeUserFromGroup ( user , true ) ) ;
220+
221+ const user = users . length === 1 ? users [ 0 ] : undefined ;
222+
223+ const choice = await confirm ( {
224+ title : user
225+ ? `Remove user '${ user ?. name ?? user ?. id } ' from '${ group . name } '?`
226+ : `Remove users from '${ group . name } '?` ,
227+ description : user
228+ ? `Are you sure you want to remove this user from the group? You can add it back later if needed.`
229+ : `Are you sure you want to remove these users from the group? You can add them back later if needed.` ,
230+ confirmText : "Remove" ,
231+ cancelText : "Cancel" ,
232+ type : "warning" ,
233+ maxWidthClass : "max-w-lg" ,
234+ } ) ;
235+ if ( ! choice ) return Promise . resolve ( ) ;
236+
218237 const promise = Promise . all ( promises ) . then ( ( ) => {
219238 if ( isDetailPage ) mutate ( `/groups/${ group . id } ` ) ;
220239 mutate ( "/groups" ) ;
You can’t perform that action at this time.
0 commit comments