1
0
Fork 0

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 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

View File

@ -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);
}

View File

@ -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

View File

@ -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

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">
<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">