mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Merge pull request #1946 from pixelfed/staging
Fix account deletion bug
This commit is contained in:
commit
31620facab
5 changed files with 24 additions and 29 deletions
|
@ -9,6 +9,7 @@
|
|||
- Fixed header background bug on MomentUI profiles ([#1933](https://github.com/pixelfed/pixelfed/pull/1933))
|
||||
- Fixed TRUST_PROXIES configuration ([#1941](https://github.com/pixelfed/pixelfed/pull/1941))
|
||||
- Fixed settings page default language ([4223a11e](https://github.com/pixelfed/pixelfed/commit/4223a11e))
|
||||
- Fixed DeleteAccountPipeline bug that did not use proper media paths ([578d2f35](https://github.com/pixelfed/pixelfed/commit/578d2f35))
|
||||
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -30,6 +30,8 @@ use App\{
|
|||
ReportLog,
|
||||
StatusHashtag,
|
||||
Status,
|
||||
Story,
|
||||
StoryView,
|
||||
User,
|
||||
UserDevice,
|
||||
UserFilter,
|
||||
|
@ -91,11 +93,25 @@ class DeleteAccountPipeline implements ShouldQueue
|
|||
Like::whereProfileId($id)->forceDelete();
|
||||
});
|
||||
|
||||
DB::transaction(function() use ($user) {
|
||||
$pid = $this->user->profile_id;
|
||||
|
||||
StoryView::whereProfileId($pid)->delete();
|
||||
$stories = Story::whereProfileId($pid)->get();
|
||||
foreach($stories as $story) {
|
||||
$path = storage_path('app/'.$story->path);
|
||||
if(is_file($path)) {
|
||||
unlink($path);
|
||||
}
|
||||
$story->forceDelete();
|
||||
}
|
||||
});
|
||||
|
||||
DB::transaction(function() use ($user) {
|
||||
$medias = Media::whereUserId($user->id)->get();
|
||||
foreach($medias as $media) {
|
||||
$path = $media->media_path;
|
||||
$thumb = $media->thumbnail_path;
|
||||
$path = storage_path('app/'.$media->media_path);
|
||||
$thumb = storage_path('app/'.$media->thumbnail_path);
|
||||
if(is_file($path)) {
|
||||
unlink($path);
|
||||
}
|
||||
|
|
|
@ -23,16 +23,4 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('a[data-target="#composeModal"]').on('click', function() {
|
||||
$('#composeModal').modal('hide');
|
||||
swal('Not Supported', 'You cannot compose a post from the admin dashboard.', 'error');
|
||||
return;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endsection
|
|
@ -24,14 +24,4 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('a#composeModal').on('click', function() {
|
||||
swal('Not Supported', 'You cannot compose a post from the admin dashboard.', 'error');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endsection
|
|
@ -1,4 +1,4 @@
|
|||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<nav class="navbar navbar-expand-lg navbar-light">
|
||||
<div class="container">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#topbarNav" aria-controls="topbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
|
@ -29,8 +29,8 @@
|
|||
<li class="nav-item mx-2 {{request()->is('*users*')?'active':''}}">
|
||||
<a class="nav-link font-weight-lighter text-muted" href="{{route('admin.users')}}">Users</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown mx-2 {{request()->is(['*settings*','*discover*', '*site-news*'])?'active':''}}">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<li class="nav-item dropdown mx-3 {{request()->is(['*settings*','*discover*', '*site-news*'])?'active':''}}">
|
||||
<a class="nav-link dropdown-toggle px-4" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
More
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
||||
|
|
Loading…
Reference in a new issue