forked from GNUsocial/gnu-social
[PLUGIN][Favourite] Report already favoured or unfavoured
This commit is contained in:
parent
0c11fe413c
commit
01689edc66
@ -73,8 +73,11 @@ class Favourite extends FeedController
|
|||||||
$form_add_to_favourite->handleRequest($request);
|
$form_add_to_favourite->handleRequest($request);
|
||||||
|
|
||||||
if ($form_add_to_favourite->isSubmitted()) {
|
if ($form_add_to_favourite->isSubmitted()) {
|
||||||
\Plugin\Favourite\Favourite::favourNote(note_id: $id, actor_id: $actor_id);
|
if (!is_null(\Plugin\Favourite\Favourite::favourNote(note_id: $id, actor_id: $actor_id))) {
|
||||||
DB::flush();
|
DB::flush();
|
||||||
|
} else {
|
||||||
|
throw new ClientException(_m('Note already favoured!'));
|
||||||
|
}
|
||||||
|
|
||||||
// Redirect user to where they came from
|
// Redirect user to where they came from
|
||||||
// Prevent open redirect
|
// Prevent open redirect
|
||||||
@ -129,8 +132,11 @@ class Favourite extends FeedController
|
|||||||
|
|
||||||
$form_remove_favourite->handleRequest($request);
|
$form_remove_favourite->handleRequest($request);
|
||||||
if ($form_remove_favourite->isSubmitted()) {
|
if ($form_remove_favourite->isSubmitted()) {
|
||||||
\Plugin\Favourite\Favourite::unfavourNote(note_id: $id, actor_id: $actor_id);
|
if (!is_null(\Plugin\Favourite\Favourite::unfavourNote(note_id: $id, actor_id: $actor_id))) {
|
||||||
DB::flush();
|
DB::flush();
|
||||||
|
} else {
|
||||||
|
throw new ClientException(_m('Note already unfavoured!'));
|
||||||
|
}
|
||||||
|
|
||||||
// Redirect user to where they came from
|
// Redirect user to where they came from
|
||||||
// Prevent open redirect
|
// Prevent open redirect
|
||||||
|
Loading…
Reference in New Issue
Block a user