Merge pull request #1946 from pixelfed/staging

Fix account deletion bug
This commit is contained in:
daniel 2020-01-19 21:52:39 -07:00 committed by GitHub
commit 31620facab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 29 deletions

View file

@ -9,6 +9,7 @@
- Fixed header background bug on MomentUI profiles ([#1933](https://github.com/pixelfed/pixelfed/pull/1933)) - 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 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 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 ### Changed

View file

@ -30,6 +30,8 @@ use App\{
ReportLog, ReportLog,
StatusHashtag, StatusHashtag,
Status, Status,
Story,
StoryView,
User, User,
UserDevice, UserDevice,
UserFilter, UserFilter,
@ -91,11 +93,25 @@ class DeleteAccountPipeline implements ShouldQueue
Like::whereProfileId($id)->forceDelete(); 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) { DB::transaction(function() use ($user) {
$medias = Media::whereUserId($user->id)->get(); $medias = Media::whereUserId($user->id)->get();
foreach($medias as $media) { foreach($medias as $media) {
$path = $media->media_path; $path = storage_path('app/'.$media->media_path);
$thumb = $media->thumbnail_path; $thumb = storage_path('app/'.$media->thumbnail_path);
if(is_file($path)) { if(is_file($path)) {
unlink($path); unlink($path);
} }

View file

@ -24,15 +24,3 @@
</div> </div>
@endsection @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

View file

@ -25,13 +25,3 @@
</div> </div>
@endsection @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

View file

@ -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"> <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"> <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> <span class="navbar-toggler-icon"></span>
@ -29,8 +29,8 @@
<li class="nav-item mx-2 {{request()->is('*users*')?'active':''}}"> <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> <a class="nav-link font-weight-lighter text-muted" href="{{route('admin.users')}}">Users</a>
</li> </li>
<li class="nav-item dropdown mx-2 {{request()->is(['*settings*','*discover*', '*site-news*'])?'active':''}}"> <li class="nav-item dropdown mx-3 {{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"> <a class="nav-link dropdown-toggle px-4" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
More More
</a> </a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown"> <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">