File tree Expand file tree Collapse file tree 4 files changed +21
-0
lines changed
Expand file tree Collapse file tree 4 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ The main reasoning behind this choice is the software is not built to be extende
1919- Added a user event when investigation is created from a report, rather than only when it is manually created separately.
2020- Added validation to require supplying evidence to reports.
2121- Added the ` barryvdh/laravel-dompdf ` library for generating PDFs from investigations.
22+ - Added check that a user no longer exists in MediaWiki when approving a DPA.
2223
2324### Fixed
2425
Original file line number Diff line number Diff line change 1313use Illuminate \Contracts \View \View ;
1414use Illuminate \Http \RedirectResponse ;
1515use Illuminate \Http \Request ;
16+ use Illuminate \Support \Facades \Http ;
1617use function back ;
1718use function now ;
1819use function redirect ;
@@ -99,6 +100,19 @@ public function create(): View
99100 public function update ( DPA $ dpa , Request $ request ): RedirectResponse
100101 {
101102 if ( $ request ->boolean ( 'approve ' ) ) {
103+ $ response = Http::get ( 'https://login.miraheze.org/w/api.php ' , [
104+ 'format ' => 'json ' ,
105+ 'action ' => 'query ' ,
106+ 'meta ' => 'globaluserinfo ' ,
107+ 'guiuser ' => $ dpa ->user ->username ,
108+ ] );
109+
110+ if ( isset ( $ response ['query ' ]['globaluserinfo ' ]['id ' ] ) ) {
111+ // Username still exists
112+ $ request ->session ()->flash ( 'errorFlash ' , __ ( 'username-still-exists ' ) );
113+ return back ();
114+ }
115+
102116 $ dpa ->update ( [ 'completed ' => now () ] );
103117 $ dpa ->user ->update ( [
104118 'username ' => 'MirahezeGDPR ' . $ dpa ->id ,
Original file line number Diff line number Diff line change 244244 "username" : " Username" ,
245245 "username-exist" : " The username must be a valid Miraheze username." ,
246246 "username-not-same" : " You are not currently logged in as this user account." ,
247+ "username-still-exists" : " This user still exists in MediaWiki. It must be processed in MediaWiki before you can approve this request." ,
247248 "users" : " Users" ,
248249 "users-list" : " List All Users" ,
249250 "wiki" : " Wiki" ,
Original file line number Diff line number Diff line change 44 </x-slot >
55 <x-slot name =" content" >
66 <h3 class =" text-dark mb-4 fw-semibold" >{{ __ ( ' dpa-new' ) } } </h3 >
7+ @if ( session ( ' errorFlash' ) )
8+ <div class =" alert alert-danger text-center shadow-sm border-0" >
9+ {{ session ( ' errorFlash' ) } }
10+ </div >
11+ @endif
712 <div class =" row mb-3" >
813 @if ( $dpa -> reject )
914 <div role =" alert" class =" alert alert-danger text-center shadow-sm border-0" >
You can’t perform that action at this time.
0 commit comments