mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-14 16:40:45 +00:00
commit
1292fd3fca
2 changed files with 22 additions and 15 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.12.3...dev)
|
## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.12.3...dev)
|
||||||
- Update AP helpers, reject statuses with invalid dates ([960f3849](https://github.com/pixelfed/pixelfed/commit/960f3849))
|
- Update AP helpers, reject statuses with invalid dates ([960f3849](https://github.com/pixelfed/pixelfed/commit/960f3849))
|
||||||
|
- Update DirectMessage API, fix broken threading ([044d410c](https://github.com/pixelfed/pixelfed/commit/044d410c))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
## [v0.12.4 (2024-11-08)](https://github.com/pixelfed/pixelfed/compare/v0.12.4...dev)
|
## [v0.12.4 (2024-11-08)](https://github.com/pixelfed/pixelfed/compare/v0.12.4...dev)
|
||||||
|
|
|
@ -372,7 +372,7 @@ class DirectMessageController extends Controller
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if ($recipient->domain == null && $hidden == false && ! $nf) {
|
if ($recipient->domain == null && $hidden == false && ! $nf) {
|
||||||
$notification = new Notification();
|
$notification = new Notification;
|
||||||
$notification->profile_id = $recipient->id;
|
$notification->profile_id = $recipient->id;
|
||||||
$notification->actor_id = $profile->id;
|
$notification->actor_id = $profile->id;
|
||||||
$notification->action = 'dm';
|
$notification->action = 'dm';
|
||||||
|
@ -405,6 +405,8 @@ class DirectMessageController extends Controller
|
||||||
{
|
{
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'pid' => 'required',
|
'pid' => 'required',
|
||||||
|
'max_id' => 'sometimes|integer',
|
||||||
|
'min_id' => 'sometimes|integer',
|
||||||
]);
|
]);
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
abort_if($user->has_roles && ! UserRoleService::can('can-direct-message', $user->id), 403, 'Invalid permissions for this action');
|
abort_if($user->has_roles && ! UserRoleService::can('can-direct-message', $user->id), 403, 'Invalid permissions for this action');
|
||||||
|
@ -419,29 +421,33 @@ class DirectMessageController extends Controller
|
||||||
if ($min_id) {
|
if ($min_id) {
|
||||||
$res = DirectMessage::select('*')
|
$res = DirectMessage::select('*')
|
||||||
->where('id', '>', $min_id)
|
->where('id', '>', $min_id)
|
||||||
->where(function ($q) use ($pid, $uid) {
|
->where(function ($query) use ($pid, $uid) {
|
||||||
return $q->where([['from_id', $pid], ['to_id', $uid],
|
$query->where('from_id', $pid)->where('to_id', $uid);
|
||||||
])->orWhere([['from_id', $uid], ['to_id', $pid]]);
|
})->orWhere(function ($query) use ($pid, $uid) {
|
||||||
|
$query->where('from_id', $uid)->where('to_id', $pid);
|
||||||
})
|
})
|
||||||
->latest()
|
->orderBy('id', 'asc')
|
||||||
->take(8)
|
->take(8)
|
||||||
->get();
|
->get()
|
||||||
|
->reverse();
|
||||||
} elseif ($max_id) {
|
} elseif ($max_id) {
|
||||||
$res = DirectMessage::select('*')
|
$res = DirectMessage::select('*')
|
||||||
->where('id', '<', $max_id)
|
->where('id', '<', $max_id)
|
||||||
->where(function ($q) use ($pid, $uid) {
|
->where(function ($query) use ($pid, $uid) {
|
||||||
return $q->where([['from_id', $pid], ['to_id', $uid],
|
$query->where('from_id', $pid)->where('to_id', $uid);
|
||||||
])->orWhere([['from_id', $uid], ['to_id', $pid]]);
|
})->orWhere(function ($query) use ($pid, $uid) {
|
||||||
|
$query->where('from_id', $uid)->where('to_id', $pid);
|
||||||
})
|
})
|
||||||
->latest()
|
->orderBy('id', 'desc')
|
||||||
->take(8)
|
->take(8)
|
||||||
->get();
|
->get();
|
||||||
} else {
|
} else {
|
||||||
$res = DirectMessage::where(function ($q) use ($pid, $uid) {
|
$res = DirectMessage::where(function ($query) use ($pid, $uid) {
|
||||||
return $q->where([['from_id', $pid], ['to_id', $uid],
|
$query->where('from_id', $pid)->where('to_id', $uid);
|
||||||
])->orWhere([['from_id', $uid], ['to_id', $pid]]);
|
})->orWhere(function ($query) use ($pid, $uid) {
|
||||||
|
$query->where('from_id', $uid)->where('to_id', $pid);
|
||||||
})
|
})
|
||||||
->latest()
|
->orderBy('id', 'desc')
|
||||||
->take(8)
|
->take(8)
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
@ -636,7 +642,7 @@ class DirectMessageController extends Controller
|
||||||
$status->in_reply_to_profile_id = $recipient->id;
|
$status->in_reply_to_profile_id = $recipient->id;
|
||||||
$status->save();
|
$status->save();
|
||||||
|
|
||||||
$media = new Media();
|
$media = new Media;
|
||||||
$media->status_id = $status->id;
|
$media->status_id = $status->id;
|
||||||
$media->profile_id = $profile->id;
|
$media->profile_id = $profile->id;
|
||||||
$media->user_id = $user->id;
|
$media->user_id = $user->id;
|
||||||
|
|
Loading…
Reference in a new issue