mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 05:23:17 +00:00
Merge pull request #4955 from pixelfed/staging
Update Curated Onboarding dashboard, improve application filtering an…
This commit is contained in:
commit
507f45f139
7 changed files with 91 additions and 15 deletions
|
@ -17,6 +17,7 @@
|
|||
- Update AdminCuratedRegisterController, show oldest applications first ([c4dde641](https://github.com/pixelfed/pixelfed/commit/c4dde641))
|
||||
- Update Directory logic, add curated onboarding support ([59c70239](https://github.com/pixelfed/pixelfed/commit/59c70239))
|
||||
- Update Inbox and StatusObserver, fix silently rejected direct messages due to saveQuietly which failed to generate a snowflake id ([089ba3c4](https://github.com/pixelfed/pixelfed/commit/089ba3c4))
|
||||
- Update Curated Onboarding dashboard, improve application filtering and make it easier to distinguish response state ([2b5d7235](https://github.com/pixelfed/pixelfed/commit/2b5d7235))
|
||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||
|
||||
## [v0.11.12 (2024-02-16)](https://github.com/pixelfed/pixelfed/compare/v0.11.11...v0.11.12)
|
||||
|
|
|
@ -22,27 +22,43 @@ class AdminCuratedRegisterController extends Controller
|
|||
public function index(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'filter' => 'sometimes|in:open,all,awaiting,approved,rejected'
|
||||
'filter' => 'sometimes|in:open,all,awaiting,approved,rejected,responses',
|
||||
'sort' => 'sometimes|in:asc,desc'
|
||||
]);
|
||||
$filter = $request->input('filter', 'open');
|
||||
$sort = $request->input('sort', 'asc');
|
||||
$records = CuratedRegister::when($filter, function($q, $filter) {
|
||||
if($filter === 'open') {
|
||||
return $q->where('is_rejected', false)
|
||||
->where(function($query) {
|
||||
return $query->where('user_has_responded', true)->orWhere('is_awaiting_more_info', false);
|
||||
})
|
||||
->whereNotNull('email_verified_at')
|
||||
->whereIsClosed(false);
|
||||
} else if($filter === 'all') {
|
||||
return $q;
|
||||
} else if($filter === 'responses') {
|
||||
return $q->whereIsClosed(false)
|
||||
->whereNotNull('email_verified_at')
|
||||
->where('user_has_responded', true)
|
||||
->where('is_awaiting_more_info', true);
|
||||
} elseif ($filter === 'awaiting') {
|
||||
return $q->whereIsClosed(false)
|
||||
->whereNull('is_rejected')
|
||||
->whereNull('is_approved');
|
||||
->where('is_rejected', false)
|
||||
->where('is_approved', false)
|
||||
->where('user_has_responded', false)
|
||||
->where('is_awaiting_more_info', true);
|
||||
} elseif ($filter === 'approved') {
|
||||
return $q->whereIsClosed(true)->whereIsApproved(true);
|
||||
} elseif ($filter === 'rejected') {
|
||||
return $q->whereIsClosed(true)->whereIsRejected(true);
|
||||
}
|
||||
})
|
||||
->paginate(10);
|
||||
->when($sort, function($query, $sort) {
|
||||
return $query->orderBy('id', $sort);
|
||||
})
|
||||
->paginate(10)
|
||||
->withQueryString();
|
||||
return view('admin.curated-register.index', compact('records', 'filter'));
|
||||
}
|
||||
|
||||
|
@ -160,6 +176,7 @@ class AdminCuratedRegisterController extends Controller
|
|||
$activity->message = $request->input('message');
|
||||
$activity->save();
|
||||
$record->is_awaiting_more_info = true;
|
||||
$record->user_has_responded = false;
|
||||
$record->save();
|
||||
Mail::to($record->email)->send(new CuratedRegisterRequestDetailsFromUser($record, $activity));
|
||||
return $request->all();
|
||||
|
|
|
@ -105,6 +105,7 @@ class CuratedRegisterController extends Controller
|
|||
'action_required' => true,
|
||||
]);
|
||||
|
||||
CuratedRegister::findOrFail($crid)->update(['user_has_responded' => true]);
|
||||
$request->session()->pull('cur-reg-con');
|
||||
$request->session()->pull('cur-reg-con-attempt');
|
||||
|
||||
|
|
|
@ -9,25 +9,43 @@ class CuratedRegister extends Model
|
|||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'user_has_responded'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'autofollow_account_ids' => 'array',
|
||||
'admin_notes' => 'array',
|
||||
'email_verified_at' => 'datetime',
|
||||
'admin_notified_at' => 'datetime',
|
||||
'action_taken_at' => 'datetime',
|
||||
'user_has_responded' => 'boolean',
|
||||
'is_awaiting_more_info' => 'boolean',
|
||||
'is_accepted' => 'boolean',
|
||||
'is_rejected' => 'boolean',
|
||||
'is_closed' => 'boolean',
|
||||
];
|
||||
|
||||
public function adminStatusLabel()
|
||||
{
|
||||
if($this->user_has_responded) {
|
||||
return '<span class="border border-warning px-3 py-1 rounded text-white font-weight-bold">Awaiting Admin Response</span>';
|
||||
}
|
||||
if(!$this->email_verified_at) {
|
||||
return '<span class="border border-danger px-3 py-1 rounded text-white font-weight-bold">Unverified email</span>';
|
||||
}
|
||||
if($this->is_accepted) { return 'Approved'; }
|
||||
if($this->is_rejected) { return 'Rejected'; }
|
||||
if($this->is_awaiting_more_info ) {
|
||||
return '<span class="border border-info px-3 py-1 rounded text-white font-weight-bold">Awaiting Details</span>';
|
||||
if($this->is_approved) {
|
||||
return '<span class="badge badge-success bg-success text-dark">Approved</span>';
|
||||
}
|
||||
if($this->is_rejected) {
|
||||
return '<span class="badge badge-danger bg-danger text-white">Rejected</span>';
|
||||
}
|
||||
if($this->is_awaiting_more_info ) {
|
||||
return '<span class="border border-info px-3 py-1 rounded text-white font-weight-bold">Awaiting User Response</span>';
|
||||
}
|
||||
if($this->is_closed ) {
|
||||
return '<span class="border border-muted px-3 py-1 rounded text-white font-weight-bold" style="opacity:0.5">Closed</span>';
|
||||
}
|
||||
if($this->is_closed ) { return 'Closed'; }
|
||||
|
||||
return '<span class="border border-success px-3 py-1 rounded text-white font-weight-bold">Open</span>';
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use App\Models\CuratedRegister;
|
||||
use App\Models\CuratedRegisterActivity;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('curated_registers', function (Blueprint $table) {
|
||||
$table->boolean('user_has_responded')->default(false)->index()->after('is_awaiting_more_info');
|
||||
});
|
||||
|
||||
CuratedRegisterActivity::whereFromUser(true)->get()->each(function($cra) {
|
||||
$cr = CuratedRegister::find($cra->register_id);
|
||||
$cr->user_has_responded = true;
|
||||
$cr->save();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('curated_registers', function (Blueprint $table) {
|
||||
$table->dropColumn('user_has_responded');
|
||||
});
|
||||
}
|
||||
};
|
|
@ -26,7 +26,7 @@
|
|||
<tr>
|
||||
<th scope="col">ID</th>
|
||||
<th scope="col">Username</th>
|
||||
@if(in_array($filter, ['all', 'open']))
|
||||
@if(in_array($filter, ['all', 'open', 'awaiting', 'responses']))
|
||||
<th scope="col">Status</th>
|
||||
@endif
|
||||
<th scope="col">Reason for Joining</th>
|
||||
|
@ -47,7 +47,7 @@
|
|||
@{{ $record->username }}
|
||||
</p>
|
||||
</td>
|
||||
@if(in_array($filter, ['all', 'open']))
|
||||
@if(in_array($filter, ['all', 'open', 'awaiting', 'responses']))
|
||||
<td class="align-middle">
|
||||
{!! $record->adminStatusLabel() !!}
|
||||
</td>
|
||||
|
|
|
@ -18,16 +18,19 @@
|
|||
<a class="nav-link {{request()->has('filter') ? '':'active'}}" href="/i/admin/curated-onboarding/home">Open Applications</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{request()->has('filter') && request()->filter == 'all' ? 'active':''}}" href="/i/admin/curated-onboarding/home?filter=all">All Applications</a>
|
||||
<a class="nav-link {{request()->has('filter') && request()->filter == 'responses' ? 'active':''}}" href="/i/admin/curated-onboarding/home?filter=responses">User Response Replies</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{request()->has('filter') && request()->filter == 'awaiting' ? 'active':''}}" href="/i/admin/curated-onboarding/home?filter=awaiting">Awaiting Info</a>
|
||||
<a class="nav-link {{request()->has('filter') && request()->filter == 'awaiting' ? 'active':''}}" href="/i/admin/curated-onboarding/home?filter=awaiting">Awaiting User Response</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{request()->has('filter') && request()->filter == 'approved' ? 'active':''}}" href="/i/admin/curated-onboarding/home?filter=approved">Approved Applications</a>
|
||||
<a class="nav-link {{request()->has('filter') && request()->filter == 'approved' ? 'active':''}}" href="/i/admin/curated-onboarding/home?filter=approved&sort=desc">Approved Applications</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{request()->has('filter') && request()->filter == 'rejected' ? 'active':''}}" href="/i/admin/curated-onboarding/home?filter=rejected">Rejected Applications</a>
|
||||
<a class="nav-link {{request()->has('filter') && request()->filter == 'rejected' ? 'active':''}}" href="/i/admin/curated-onboarding/home?filter=rejected&sort=desc">Rejected Applications</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{request()->has('filter') && request()->filter == 'all' ? 'active':''}}" href="/i/admin/curated-onboarding/home?filter=all&sort=desc">All Applications</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue