diff --git a/app/Config/Events.php b/app/Config/Events.php
index 0ed8a413..b2288b94 100644
--- a/app/Config/Events.php
+++ b/app/Config/Events.php
@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Config;
use App\Entities\Actor;
-use App\Entities\Note;
+use App\Entities\Status;
use App\Entities\User;
use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\FrameworkException;
@@ -120,82 +120,82 @@ Events::on('on_undo_follow', function ($actor, $targetActor): void {
});
/**
- * @param Note $note
+ * @param Status $status
*/
-Events::on('on_note_add', function ($note): void {
- if ($note->in_reply_to_id !== null) {
- $note = $note->reply_to_note;
+Events::on('on_status_add', function ($status): void {
+ if ($status->in_reply_to_id !== null) {
+ $status = $status->reply_to_status;
}
- if ($note->episode_id) {
+ if ($status->episode_id) {
model('EpisodeModel')
- ->where('id', $note->episode_id)
- ->increment('notes_total');
+ ->where('id', $status->episode_id)
+ ->increment('statuses_total');
}
- if ($note->actor->is_podcast) {
+ if ($status->actor->is_podcast) {
// Removing all of the podcast pages is a bit overkill, but works to avoid caching bugs
// same for other events below
cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("podcast#{$status->actor->podcast->id}*");
cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("page_podcast#{$status->actor->podcast->id}*");
}
});
/**
- * @param Note $note
+ * @param Status $status
*/
-Events::on('on_note_remove', function ($note): void {
- if ($note->in_reply_to_id !== null) {
- Events::trigger('on_note_remove', $note->reply_to_note);
+Events::on('on_status_remove', function ($status): void {
+ if ($status->in_reply_to_id !== null) {
+ Events::trigger('on_status_remove', $status->reply_to_status);
}
- if ($episodeId = $note->episode_id) {
+ if ($episodeId = $status->episode_id) {
model('EpisodeModel')
->where('id', $episodeId)
- ->decrement('notes_total', 1 + $note->reblogs_count);
+ ->decrement('statuses_total', 1 + $status->reblogs_count);
model('EpisodeModel')
->where('id', $episodeId)
- ->decrement('reblogs_total', $note->reblogs_count);
+ ->decrement('reblogs_total', $status->reblogs_count);
model('EpisodeModel')
->where('id', $episodeId)
- ->decrement('favourites_total', $note->favourites_count);
+ ->decrement('favourites_total', $status->favourites_count);
}
- if ($note->actor->is_podcast) {
+ if ($status->actor->is_podcast) {
cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("podcast#{$status->actor->podcast->id}*");
cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("page_podcast#{$status->actor->podcast->id}*");
}
cache()
- ->deleteMatching("page_note#{$note->id}*");
+ ->deleteMatching("page_status#{$status->id}*");
});
/**
* @param Actor $actor
- * @param Note $note
+ * @param Status $status
*/
-Events::on('on_note_reblog', function ($actor, $note): void {
- if ($episodeId = $note->episode_id) {
+Events::on('on_status_reblog', function ($actor, $status): void {
+ if ($episodeId = $status->episode_id) {
model('EpisodeModel')
->where('id', $episodeId)
->increment('reblogs_total');
model('EpisodeModel')
->where('id', $episodeId)
- ->increment('notes_total');
+ ->increment('statuses_total');
}
- if ($note->actor->is_podcast) {
+ if ($status->actor->is_podcast) {
cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("podcast#{$status->actor->podcast->id}*");
cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("page_podcast#{$status->actor->podcast->id}*");
}
if ($actor->is_podcast) {
@@ -205,111 +205,111 @@ Events::on('on_note_reblog', function ($actor, $note): void {
}
cache()
- ->deleteMatching("page_note#{$note->id}*");
+ ->deleteMatching("page_status#{$status->id}*");
- if ($note->in_reply_to_id !== null) {
- cache()->deleteMatching("page_note#{$note->in_reply_to_id}");
+ if ($status->in_reply_to_id !== null) {
+ cache()->deleteMatching("page_status#{$status->in_reply_to_id}");
}
});
/**
- * @param Note $reblogNote
+ * @param Status $reblogStatus
*/
-Events::on('on_note_undo_reblog', function ($reblogNote): void {
- $note = $reblogNote->reblog_of_note;
- if ($episodeId = $note->episode_id) {
+Events::on('on_status_undo_reblog', function ($reblogStatus): void {
+ $status = $reblogStatus->reblog_of_status;
+ if ($episodeId = $status->episode_id) {
model('EpisodeModel')
->where('id', $episodeId)
->decrement('reblogs_total');
model('EpisodeModel')
->where('id', $episodeId)
- ->decrement('notes_total');
+ ->decrement('statuses_total');
}
- if ($note->actor->is_podcast) {
+ if ($status->actor->is_podcast) {
cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("podcast#{$status->actor->podcast->id}*");
cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("page_podcast#{$status->actor->podcast->id}*");
}
cache()
- ->deleteMatching("page_note#{$note->id}*");
+ ->deleteMatching("page_status#{$status->id}*");
cache()
- ->deleteMatching("page_note#{$reblogNote->id}*");
+ ->deleteMatching("page_status#{$reblogStatus->id}*");
- if ($note->in_reply_to_id !== null) {
- cache()->deleteMatching("page_note#{$note->in_reply_to_id}");
+ if ($status->in_reply_to_id !== null) {
+ cache()->deleteMatching("page_status#{$status->in_reply_to_id}");
}
- if ($reblogNote->actor->is_podcast) {
+ if ($reblogStatus->actor->is_podcast) {
cache()
- ->deleteMatching("podcast#{$reblogNote->actor->podcast->id}*");
+ ->deleteMatching("podcast#{$reblogStatus->actor->podcast->id}*");
cache()
- ->deleteMatching("page_podcast#{$reblogNote->actor->podcast->id}*");
+ ->deleteMatching("page_podcast#{$reblogStatus->actor->podcast->id}*");
}
});
/**
- * @param Note $reply
+ * @param Status $reply
*/
-Events::on('on_note_reply', function ($reply): void {
- $note = $reply->reply_to_note;
+Events::on('on_status_reply', function ($reply): void {
+ $status = $reply->reply_to_status;
- if ($note->actor->is_podcast) {
+ if ($status->actor->is_podcast) {
cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("podcast#{$status->actor->podcast->id}*");
cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("page_podcast#{$status->actor->podcast->id}*");
}
cache()
- ->deleteMatching("page_note#{$note->id}*");
+ ->deleteMatching("page_status#{$status->id}*");
});
/**
- * @param Note $reply
+ * @param Status $reply
*/
Events::on('on_reply_remove', function ($reply): void {
- $note = $reply->reply_to_note;
+ $status = $reply->reply_to_status;
- if ($note->actor->is_podcast) {
+ if ($status->actor->is_podcast) {
cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("page_podcast#{$status->actor->podcast->id}*");
cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("podcast#{$status->actor->podcast->id}*");
}
cache()
- ->deleteMatching("page_note#{$note->id}*");
+ ->deleteMatching("page_status#{$status->id}*");
cache()
- ->deleteMatching("page_note#{$reply->id}*");
+ ->deleteMatching("page_status#{$reply->id}*");
});
/**
* @param Actor $actor
- * @param Note $note
+ * @param Status $status
*/
-Events::on('on_note_favourite', function ($actor, $note): void {
- if ($note->episode_id) {
+Events::on('on_status_favourite', function ($actor, $status): void {
+ if ($status->episode_id) {
model('EpisodeModel')
- ->where('id', $note->episode_id)
+ ->where('id', $status->episode_id)
->increment('favourites_total');
}
- if ($note->actor->is_podcast) {
+ if ($status->actor->is_podcast) {
cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("podcast#{$status->actor->podcast->id}*");
cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("page_podcast#{$status->actor->podcast->id}*");
}
cache()
- ->deleteMatching("page_note#{$note->id}*");
+ ->deleteMatching("page_status#{$status->id}*");
- if ($note->in_reply_to_id !== null) {
- cache()->deleteMatching("page_note#{$note->in_reply_to_id}*");
+ if ($status->in_reply_to_id !== null) {
+ cache()->deleteMatching("page_status#{$status->in_reply_to_id}*");
}
if ($actor->is_podcast) {
@@ -321,27 +321,27 @@ Events::on('on_note_favourite', function ($actor, $note): void {
/**
* @param Actor $actor
- * @param Note $note
+ * @param Status $status
*/
-Events::on('on_note_undo_favourite', function ($actor, $note): void {
- if ($note->episode_id) {
+Events::on('on_status_undo_favourite', function ($actor, $status): void {
+ if ($status->episode_id) {
model('EpisodeModel')
- ->where('id', $note->episode_id)
+ ->where('id', $status->episode_id)
->decrement('favourites_total');
}
- if ($note->actor->is_podcast) {
+ if ($status->actor->is_podcast) {
cache()
- ->deleteMatching("podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("podcast#{$status->actor->podcast->id}*");
cache()
- ->deleteMatching("page_podcast#{$note->actor->podcast->id}*");
+ ->deleteMatching("page_podcast#{$status->actor->podcast->id}*");
}
cache()
- ->deleteMatching("page_note#{$note->id}*");
+ ->deleteMatching("page_status#{$status->id}*");
- if ($note->in_reply_to_id !== null) {
- cache()->deleteMatching("page_note#{$note->in_reply_to_id}*");
+ if ($status->in_reply_to_id !== null) {
+ cache()->deleteMatching("page_status#{$status->in_reply_to_id}*");
}
if ($actor->is_podcast) {
@@ -356,7 +356,7 @@ Events::on('on_block_actor', function (int $actorId): void {
cache()
->deleteMatching('podcast*');
cache()
- ->deleteMatching('page_note*');
+ ->deleteMatching('page_status*');
});
Events::on('on_unblock_actor', function (int $actorId): void {
@@ -364,7 +364,7 @@ Events::on('on_unblock_actor', function (int $actorId): void {
cache()
->deleteMatching('podcast*');
cache()
- ->deleteMatching('page_note*');
+ ->deleteMatching('page_status*');
});
Events::on('on_block_domain', function (string $domainName): void {
@@ -372,7 +372,7 @@ Events::on('on_block_domain', function (string $domainName): void {
cache()
->deleteMatching('podcast*');
cache()
- ->deleteMatching('page_note*');
+ ->deleteMatching('page_status*');
});
Events::on('on_unblock_domain', function (string $domainName): void {
@@ -380,5 +380,5 @@ Events::on('on_unblock_domain', function (string $domainName): void {
cache()
->deleteMatching('podcast*');
cache()
- ->deleteMatching('page_note*');
+ ->deleteMatching('page_status*');
});
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index edef6a7e..f93778a8 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -35,7 +35,7 @@ $routes->addPlaceholder('podcastName', '[a-zA-Z0-9\_]{1,32}');
$routes->addPlaceholder('slug', '[a-zA-Z0-9\-]{1,191}');
$routes->addPlaceholder('base64', '[A-Za-z0-9\.\_]+\-{0,2}');
$routes->addPlaceholder('platformType', '\bpodcasting|\bsocial|\bfunding');
-$routes->addPlaceholder('noteAction', '\bfavourite|\breblog|\breply');
+$routes->addPlaceholder('statusAction', '\bfavourite|\breblog|\breply');
$routes->addPlaceholder('embeddablePlayerTheme', '\blight|\bdark|\blight-transparent|\bdark-transparent');
$routes->addPlaceholder(
'uuid',
@@ -746,71 +746,71 @@ $routes->post('interact-as-actor', 'AuthController::attemptInteractAsActor', [
* Overwriting ActivityPub routes file
*/
$routes->group('@(:podcastName)', function ($routes): void {
- $routes->post('notes/new', 'NoteController::attemptCreate/$1', [
- 'as' => 'note-attempt-create',
+ $routes->post('statuses/new', 'StatusController::attemptCreate/$1', [
+ 'as' => 'status-attempt-create',
'filter' => 'permission:podcast-manage_publications',
]);
- // Note
- $routes->group('notes/(:uuid)', function ($routes): void {
- $routes->get('/', 'NoteController::view/$1/$2', [
- 'as' => 'note',
+ // Status
+ $routes->group('statuses/(:uuid)', function ($routes): void {
+ $routes->get('/', 'StatusController::view/$1/$2', [
+ 'as' => 'status',
'alternate-content' => [
'application/activity+json' => [
'namespace' => 'ActivityPub\Controllers',
- 'controller-method' => 'NoteController/$2',
+ 'controller-method' => 'StatusController/$2',
],
'application/ld+json; profile="https://www.w3.org/ns/activitystreams' => [
'namespace' => 'ActivityPub\Controllers',
- 'controller-method' => 'NoteController/$2',
+ 'controller-method' => 'StatusController/$2',
],
],
]);
- $routes->get('replies', 'NoteController/$1/$2', [
- 'as' => 'note-replies',
+ $routes->get('replies', 'StatusController/$1/$2', [
+ 'as' => 'status-replies',
'alternate-content' => [
'application/activity+json' => [
'namespace' => 'ActivityPub\Controllers',
- 'controller-method' => 'NoteController::replies/$2',
+ 'controller-method' => 'StatusController::replies/$2',
],
'application/ld+json; profile="https://www.w3.org/ns/activitystreams' => [
'namespace' => 'ActivityPub\Controllers',
- 'controller-method' => 'NoteController::replies/$2',
+ 'controller-method' => 'StatusController::replies/$2',
],
],
]);
// Actions
- $routes->post('action', 'NoteController::attemptAction/$1/$2', [
- 'as' => 'note-attempt-action',
+ $routes->post('action', 'StatusController::attemptAction/$1/$2', [
+ 'as' => 'status-attempt-action',
'filter' => 'permission:podcast-interact_as',
]);
$routes->post(
'block-actor',
- 'NoteController::attemptBlockActor/$1/$2',
+ 'StatusController::attemptBlockActor/$1/$2',
[
- 'as' => 'note-attempt-block-actor',
+ 'as' => 'status-attempt-block-actor',
'filter' => 'permission:fediverse-block_actors',
],
);
$routes->post(
'block-domain',
- 'NoteController::attemptBlockDomain/$1/$2',
+ 'StatusController::attemptBlockDomain/$1/$2',
[
- 'as' => 'note-attempt-block-domain',
+ 'as' => 'status-attempt-block-domain',
'filter' => 'permission:fediverse-block_domains',
],
);
- $routes->post('delete', 'NoteController::attemptDelete/$1/$2', [
- 'as' => 'note-attempt-delete',
+ $routes->post('delete', 'StatusController::attemptDelete/$1/$2', [
+ 'as' => 'status-attempt-delete',
'filter' => 'permission:podcast-manage_publications',
]);
$routes->get(
- 'remote/(:noteAction)',
- 'NoteController::remoteAction/$1/$2/$3',
+ 'remote/(:statusAction)',
+ 'StatusController::remoteAction/$1/$2/$3',
[
- 'as' => 'note-remote-action',
+ 'as' => 'status-remote-action',
],
);
});
diff --git a/app/Controllers/Admin/EpisodeController.php b/app/Controllers/Admin/EpisodeController.php
index 18484c75..28ad1a85 100644
--- a/app/Controllers/Admin/EpisodeController.php
+++ b/app/Controllers/Admin/EpisodeController.php
@@ -13,12 +13,12 @@ namespace App\Controllers\Admin;
use App\Entities\Episode;
use App\Entities\Image;
use App\Entities\Location;
-use App\Entities\Note;
use App\Entities\Podcast;
+use App\Entities\Status;
use App\Models\EpisodeModel;
-use App\Models\NoteModel;
use App\Models\PodcastModel;
use App\Models\SoundbiteModel;
+use App\Models\StatusModel;
use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\I18n\Time;
@@ -426,7 +426,7 @@ class EpisodeController extends BaseController
$db = db_connect();
$db->transStart();
- $newNote = new Note([
+ $newStatus = new Status([
'actor_id' => $this->podcast->actor_id,
'episode_id' => $this->episode->id,
'message' => $this->request->getPost('message'),
@@ -453,15 +453,15 @@ class EpisodeController extends BaseController
$this->episode->published_at = Time::now();
}
- $newNote->published_at = $this->episode->published_at;
+ $newStatus->published_at = $this->episode->published_at;
- $noteModel = new NoteModel();
- if (! $noteModel->addNote($newNote)) {
+ $statusModel = new StatusModel();
+ if (! $statusModel->addStatus($newStatus)) {
$db->transRollback();
return redirect()
->back()
->withInput()
- ->with('errors', $noteModel->errors());
+ ->with('errors', $statusModel->errors());
}
$episodeModel = new EpisodeModel();
@@ -486,7 +486,7 @@ class EpisodeController extends BaseController
$data = [
'podcast' => $this->podcast,
'episode' => $this->episode,
- 'note' => (new NoteModel())
+ 'status' => (new StatusModel())
->where([
'actor_id' => $this->podcast->actor_id,
'episode_id' => $this->episode->id,
@@ -506,7 +506,7 @@ class EpisodeController extends BaseController
public function attemptPublishEdit(): RedirectResponse
{
$rules = [
- 'note_id' => 'required',
+ 'status_id' => 'required',
'publication_method' => 'required',
'scheduled_publication_date' =>
'valid_date[Y-m-d H:i]|permit_empty',
@@ -542,19 +542,19 @@ class EpisodeController extends BaseController
$this->episode->published_at = Time::now();
}
- $note = (new NoteModel())->getNoteById($this->request->getPost('note_id'));
+ $status = (new StatusModel())->getStatusById($this->request->getPost('status_id'));
- if ($note !== null) {
- $note->message = $this->request->getPost('message');
- $note->published_at = $this->episode->published_at;
+ if ($status !== null) {
+ $status->message = $this->request->getPost('message');
+ $status->published_at = $this->episode->published_at;
- $noteModel = new NoteModel();
- if (! $noteModel->editNote($note)) {
+ $statusModel = new StatusModel();
+ if (! $statusModel->editStatus($status)) {
$db->transRollback();
return redirect()
->back()
->withInput()
- ->with('errors', $noteModel->errors());
+ ->with('errors', $statusModel->errors());
}
}
@@ -609,13 +609,13 @@ class EpisodeController extends BaseController
$db->transStart();
- $allNotesLinkedToEpisode = (new NoteModel())
+ $allStatusesLinkedToEpisode = (new StatusModel())
->where([
'episode_id' => $this->episode->id,
])
->findAll();
- foreach ($allNotesLinkedToEpisode as $note) {
- (new NoteModel())->removeNote($note);
+ foreach ($allStatusesLinkedToEpisode as $status) {
+ (new StatusModel())->removeStatus($status);
}
// set episode published_at to null to unpublish
diff --git a/app/Controllers/PodcastController.php b/app/Controllers/PodcastController.php
index b3dd5351..c8702746 100644
--- a/app/Controllers/PodcastController.php
+++ b/app/Controllers/PodcastController.php
@@ -13,8 +13,8 @@ namespace App\Controllers;
use Analytics\AnalyticsTrait;
use App\Entities\Podcast;
use App\Models\EpisodeModel;
-use App\Models\NoteModel;
use App\Models\PodcastModel;
+use App\Models\StatusModel;
use CodeIgniter\Exceptions\PageNotFoundException;
class PodcastController extends BaseController
@@ -64,7 +64,7 @@ class PodcastController extends BaseController
if (! ($cachedView = cache($cacheName))) {
$data = [
'podcast' => $this->podcast,
- 'notes' => (new NoteModel())->getActorPublishedNotes($this->podcast->actor_id),
+ 'statuses' => (new StatusModel())->getActorPublishedStatuses($this->podcast->actor_id),
];
// if user is logged in then send to the authenticated activity view
diff --git a/app/Controllers/NoteController.php b/app/Controllers/StatusController.php
similarity index 77%
rename from app/Controllers/NoteController.php
rename to app/Controllers/StatusController.php
index 39831e1c..9d19f136 100644
--- a/app/Controllers/NoteController.php
+++ b/app/Controllers/StatusController.php
@@ -10,21 +10,21 @@ declare(strict_types=1);
namespace App\Controllers;
-use ActivityPub\Controllers\NoteController as ActivityPubNoteController;
-use ActivityPub\Entities\Note as ActivityPubNote;
+use ActivityPub\Controllers\StatusController as ActivityPubStatusController;
+use ActivityPub\Entities\Status as ActivityPubStatus;
use Analytics\AnalyticsTrait;
use App\Entities\Actor;
-use App\Entities\Note as CastopodNote;
use App\Entities\Podcast;
+use App\Entities\Status as CastopodStatus;
use App\Models\EpisodeModel;
-use App\Models\NoteModel;
use App\Models\PodcastModel;
+use App\Models\StatusModel;
use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\URI;
use CodeIgniter\I18n\Time;
-class NoteController extends ActivityPubNoteController
+class StatusController extends ActivityPubStatusController
{
use AnalyticsTrait;
@@ -50,9 +50,9 @@ class NoteController extends ActivityPubNoteController
if (
count($params) > 1 &&
- ($note = (new NoteModel())->getNoteById($params[1])) !== null
+ ($status = (new StatusModel())->getStatusById($params[1])) !== null
) {
- $this->note = $note;
+ $this->status = $status;
unset($params[0]);
unset($params[1]);
@@ -72,7 +72,7 @@ class NoteController extends ActivityPubNoteController
'_',
array_filter([
'page',
- "note#{$this->note->id}",
+ "status#{$this->status->id}",
service('request')
->getLocale(),
can_user_interact() ? '_authenticated' : null,
@@ -83,15 +83,15 @@ class NoteController extends ActivityPubNoteController
$data = [
'podcast' => $this->podcast,
'actor' => $this->actor,
- 'note' => $this->note,
+ 'status' => $this->status,
];
// if user is logged in then send to the authenticated activity view
if (can_user_interact()) {
helper('form');
- return view('podcast/note_authenticated', $data);
+ return view('podcast/status_authenticated', $data);
}
- return view('podcast/note', $data, [
+ return view('podcast/status', $data, [
'cache' => DECADE,
'cache_name' => $cacheName,
]);
@@ -116,7 +116,7 @@ class NoteController extends ActivityPubNoteController
$message = $this->request->getPost('message');
- $newNote = new CastopodNote([
+ $newStatus = new CastopodStatus([
'actor_id' => interact_as_actor_id(),
'published_at' => Time::now(),
'created_by' => user_id(),
@@ -129,23 +129,23 @@ class NoteController extends ActivityPubNoteController
($params = extract_params_from_episode_uri(new URI($episodeUri))) &&
($episode = (new EpisodeModel())->getEpisodeBySlug($params['podcastName'], $params['episodeSlug']))
) {
- $newNote->episode_id = $episode->id;
+ $newStatus->episode_id = $episode->id;
}
- $newNote->message = $message;
+ $newStatus->message = $message;
- $noteModel = new NoteModel();
+ $statusModel = new StatusModel();
if (
- ! $noteModel
- ->addNote($newNote, ! (bool) $newNote->episode_id, true)
+ ! $statusModel
+ ->addStatus($newStatus, ! (bool) $newStatus->episode_id, true)
) {
return redirect()
->back()
->withInput()
- ->with('errors', $noteModel->errors());
+ ->with('errors', $statusModel->errors());
}
- // Note has been successfully created
+ // Status has been successfully created
return redirect()->back();
}
@@ -162,36 +162,36 @@ class NoteController extends ActivityPubNoteController
->with('errors', $this->validator->getErrors());
}
- $newNote = new ActivityPubNote([
+ $newStatus = new ActivityPubStatus([
'actor_id' => interact_as_actor_id(),
- 'in_reply_to_id' => $this->note->id,
+ 'in_reply_to_id' => $this->status->id,
'message' => $this->request->getPost('message'),
'published_at' => Time::now(),
'created_by' => user_id(),
]);
- $noteModel = new NoteModel();
- if (! $noteModel->addReply($newNote)) {
+ $statusModel = new StatusModel();
+ if (! $statusModel->addReply($newStatus)) {
return redirect()
->back()
->withInput()
- ->with('errors', $noteModel->errors());
+ ->with('errors', $statusModel->errors());
}
- // Reply note without preview card has been successfully created
+ // Reply status without preview card has been successfully created
return redirect()->back();
}
public function attemptFavourite(): RedirectResponse
{
- model('FavouriteModel')->toggleFavourite(interact_as_actor(), $this->note);
+ model('FavouriteModel')->toggleFavourite(interact_as_actor(), $this->status);
return redirect()->back();
}
public function attemptReblog(): RedirectResponse
{
- (new NoteModel())->toggleReblog(interact_as_actor(), $this->note);
+ (new StatusModel())->toggleReblog(interact_as_actor(), $this->status);
return redirect()->back();
}
@@ -230,20 +230,20 @@ class NoteController extends ActivityPubNoteController
$cacheName = implode(
'_',
- array_filter(['page', "note#{$this->note->id}", "remote_{$action}", service('request') ->getLocale()]),
+ array_filter(['page', "status#{$this->status->id}", "remote_{$action}", service('request') ->getLocale()]),
);
if (! ($cachedView = cache($cacheName))) {
$data = [
'podcast' => $this->podcast,
'actor' => $this->actor,
- 'note' => $this->note,
+ 'status' => $this->status,
'action' => $action,
];
helper('form');
- return view('podcast/note_remote_action', $data, [
+ return view('podcast/status_remote_action', $data, [
'cache' => DECADE,
'cache_name' => $cacheName,
]);
diff --git a/app/Database/Migrations/2020-06-05-170000_add_episodes.php b/app/Database/Migrations/2020-06-05-170000_add_episodes.php
index e54794a6..a6d51796 100644
--- a/app/Database/Migrations/2020-06-05-170000_add_episodes.php
+++ b/app/Database/Migrations/2020-06-05-170000_add_episodes.php
@@ -157,7 +157,7 @@ class AddEpisodes extends Migration
'unsigned' => true,
'default' => 0,
],
- 'notes_total' => [
+ 'statuses_total' => [
'type' => 'INT',
'unsigned' => true,
'default' => 0,
diff --git a/app/Database/Migrations/2021-02-23-100000_add_episode_id_to_notes.php b/app/Database/Migrations/2021-02-23-100000_add_episode_id_to_statuses.php
similarity index 52%
rename from app/Database/Migrations/2021-02-23-100000_add_episode_id_to_notes.php
rename to app/Database/Migrations/2021-02-23-100000_add_episode_id_to_statuses.php
index 958b0119..a81a782f 100644
--- a/app/Database/Migrations/2021-02-23-100000_add_episode_id_to_notes.php
+++ b/app/Database/Migrations/2021-02-23-100000_add_episode_id_to_statuses.php
@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
- * Class AddEpisodeIdToNotes Adds episode_id field to activitypub_notes table in database
+ * Class AddEpisodeIdToStatuses Adds episode_id field to activitypub_statuses table in database
*
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@@ -14,23 +14,23 @@ namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
-class AddEpisodeIdToNotes extends Migration
+class AddEpisodeIdToStatuses extends Migration
{
public function up(): void
{
$prefix = $this->db->getPrefix();
$createQuery = <<db->query($createQuery);
}
public function down(): void
{
- $this->forge->dropForeignKey('activitypub_notes', 'activitypub_notes_episode_id_foreign');
- $this->forge->dropColumn('activitypub_notes', 'episode_id');
+ $this->forge->dropForeignKey('activitypub_statuses', 'activitypub_statuses_episode_id_foreign');
+ $this->forge->dropColumn('activitypub_statuses', 'episode_id');
}
}
diff --git a/app/Database/Migrations/2021-03-09-113000_add_created_by_to_notes.php b/app/Database/Migrations/2021-03-09-113000_add_created_by_to_statuses.php
similarity index 52%
rename from app/Database/Migrations/2021-03-09-113000_add_created_by_to_notes.php
rename to app/Database/Migrations/2021-03-09-113000_add_created_by_to_statuses.php
index 496bf902..2f9a29d6 100644
--- a/app/Database/Migrations/2021-03-09-113000_add_created_by_to_notes.php
+++ b/app/Database/Migrations/2021-03-09-113000_add_created_by_to_statuses.php
@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
- * Class AddCreatedByToNotes Adds created_by field to activitypub_notes table in database
+ * Class AddCreatedByToStatuses Adds created_by field to activitypub_statuses table in database
*
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@@ -14,23 +14,23 @@ namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
-class AddCreatedByToNotes extends Migration
+class AddCreatedByToStatuses extends Migration
{
public function up(): void
{
$prefix = $this->db->getPrefix();
$createQuery = <<db->query($createQuery);
}
public function down(): void
{
- $this->forge->dropForeignKey('activitypub_notes', 'activitypub_notes_created_by_foreign');
- $this->forge->dropColumn('activitypub_notes', 'created_by');
+ $this->forge->dropForeignKey('activitypub_statuses', 'activitypub_statuses_created_by_foreign');
+ $this->forge->dropColumn('activitypub_statuses', 'created_by');
}
}
diff --git a/app/Database/Seeds/AuthSeeder.php b/app/Database/Seeds/AuthSeeder.php
index 88e4baa8..1e46d1ad 100644
--- a/app/Database/Seeds/AuthSeeder.php
+++ b/app/Database/Seeds/AuthSeeder.php
@@ -162,13 +162,13 @@ class AuthSeeder extends Seeder
[
'name' => 'manage_publications',
'description' =>
- 'Publish / unpublish episodes & notes of a podcast',
+ 'Publish / unpublish episodes & statuses of a podcast',
'has_permission' => ['podcast_admin'],
],
[
'name' => 'interact_as',
'description' =>
- 'Interact as the podcast to favourite / share or reply to notes.',
+ 'Interact as the podcast to favourite / share or reply to statuses.',
'has_permission' => ['podcast_admin'],
],
],
diff --git a/app/Entities/Episode.php b/app/Entities/Episode.php
index 8760dd4a..c10cbb17 100644
--- a/app/Entities/Episode.php
+++ b/app/Entities/Episode.php
@@ -11,10 +11,10 @@ declare(strict_types=1);
namespace App\Entities;
use App\Libraries\SimpleRSSElement;
-use App\Models\NoteModel;
use App\Models\PersonModel;
use App\Models\PodcastModel;
use App\Models\SoundbiteModel;
+use App\Models\StatusModel;
use CodeIgniter\Entity\Entity;
use CodeIgniter\Files\File;
use CodeIgniter\HTTP\Files\UploadedFile;
@@ -67,7 +67,7 @@ use RuntimeException;
* @property string $custom_rss_string
* @property int $favourites_total
* @property int $reblogs_total
- * @property int $notes_total
+ * @property int $statuses_total
* @property int $created_by
* @property int $updated_by
* @property string $publication_status;
@@ -117,9 +117,9 @@ class Episode extends Entity
protected ?array $soundbites = null;
/**
- * @var Note[]|null
+ * @var Status[]|null
*/
- protected ?array $notes = null;
+ protected ?array $statuses = null;
protected ?Location $location = null;
@@ -165,7 +165,7 @@ class Episode extends Entity
'custom_rss' => '?json-array',
'favourites_total' => 'integer',
'reblogs_total' => 'integer',
- 'notes_total' => 'integer',
+ 'statuses_total' => 'integer',
'created_by' => 'integer',
'updated_by' => 'integer',
];
@@ -382,19 +382,19 @@ class Episode extends Entity
}
/**
- * @return Note[]
+ * @return Status[]
*/
- public function getNotes(): array
+ public function getStatuses(): array
{
if ($this->id === null) {
throw new RuntimeException('Episode must be created before getting soundbites.');
}
- if ($this->notes === null) {
- $this->notes = (new NoteModel())->getEpisodeNotes($this->id);
+ if ($this->statuses === null) {
+ $this->statuses = (new StatusModel())->getEpisodeStatuses($this->id);
}
- return $this->notes;
+ return $this->statuses;
}
public function getLink(): string
diff --git a/app/Entities/Note.php b/app/Entities/Status.php
similarity index 83%
rename from app/Entities/Note.php
rename to app/Entities/Status.php
index 5dc0c8bd..4e39e359 100644
--- a/app/Entities/Note.php
+++ b/app/Entities/Status.php
@@ -10,7 +10,7 @@ declare(strict_types=1);
namespace App\Entities;
-use ActivityPub\Entities\Note as ActivityPubNote;
+use ActivityPub\Entities\Status as ActivityPubStatus;
use App\Models\EpisodeModel;
use RuntimeException;
@@ -18,7 +18,7 @@ use RuntimeException;
* @property int|null $episode_id
* @property Episode|null $episode
*/
-class Note extends ActivityPubNote
+class Status extends ActivityPubStatus
{
protected ?Episode $episode = null;
@@ -41,12 +41,12 @@ class Note extends ActivityPubNote
];
/**
- * Returns the note's attached episode
+ * Returns the status' attached episode
*/
public function getEpisode(): ?Episode
{
if ($this->episode_id === null) {
- throw new RuntimeException('Note must have an episode_id before getting episode.');
+ throw new RuntimeException('Status must have an episode_id before getting episode.');
}
if ($this->episode === null) {
diff --git a/app/Language/en/Episode.php b/app/Language/en/Episode.php
index 0226b6ea..80fe2ec7 100644
--- a/app/Language/en/Episode.php
+++ b/app/Language/en/Episode.php
@@ -26,7 +26,7 @@ return [
one {# total share}
other {# total shares}
}',
- 'total_notes' => '{numberOfTotalNotes, plural,
+ 'total_statuses' => '{numberOfTotalStatuses, plural,
one {# note}
other {# total notes}
}',
@@ -112,8 +112,8 @@ return [
'submit_edit' => 'Save episode',
],
'publish_form' => [
- 'note' => 'Your note',
- 'note_hint' =>
+ 'status' => 'Your note',
+ 'status_hint' =>
'The message you write will be broadcasted to all your followers in the fediverse.',
'publication_date' => 'Publication date',
'publication_method' => [
diff --git a/app/Language/en/Podcast.php b/app/Language/en/Podcast.php
index 03e857a4..fa9279f4 100644
--- a/app/Language/en/Podcast.php
+++ b/app/Language/en/Podcast.php
@@ -223,7 +223,7 @@ return [
one {# follower}
other {# followers}
}',
- 'notes' => '{numberOfNotes, plural,
+ 'statuses' => '{numberOfStatuses, plural,
one {# note}
other {# notes}
}',
diff --git a/app/Language/en/Note.php b/app/Language/en/Status.php
similarity index 95%
rename from app/Language/en/Note.php
rename to app/Language/en/Status.php
index 7a6cca3c..8fa9bcdc 100644
--- a/app/Language/en/Note.php
+++ b/app/Language/en/Status.php
@@ -10,7 +10,7 @@ declare(strict_types=1);
return [
'title' => "{actorDisplayName}'s Note",
- 'back_to_actor_notes' => 'Back to {actor} notes',
+ 'back_to_actor_statuses' => 'Back to {actor} notes',
'actor_shared' => '{actor} shared',
'reply_to' => 'Reply to @{actorUsername}',
'form' => [
diff --git a/app/Language/fr/Episode.php b/app/Language/fr/Episode.php
index 9e360cbe..86233cfa 100644
--- a/app/Language/fr/Episode.php
+++ b/app/Language/fr/Episode.php
@@ -26,7 +26,7 @@ return [
one {# partage en tout}
other {# partages en tout}
}',
- 'total_notes' => '{numberOfTotalNotes, plural,
+ 'total_statuses' => '{numberOfTotalStatuses, plural,
one {# note}
other {# notes}
}',
@@ -115,8 +115,8 @@ return [
'submit_edit' => 'Enregistrer l’épisode',
],
'publish_form' => [
- 'note' => 'Votre note',
- 'note_hint' =>
+ 'status' => 'Votre note',
+ 'status_hint' =>
'Le message que vous écrirez sera diffusé à toutes les personnes qui vous suivent dans le fédiverse.',
'publication_date' => 'Date de publication',
'publication_date_clear' => 'Effacer la date de publication',
diff --git a/app/Language/fr/Podcast.php b/app/Language/fr/Podcast.php
index f01fc101..c93d2893 100644
--- a/app/Language/fr/Podcast.php
+++ b/app/Language/fr/Podcast.php
@@ -225,7 +225,7 @@ return [
one {# abonné·e}
other {# abonné·e·s}
}',
- 'notes' => '{numberOfNotes, plural,
+ 'notes' => '{numberOfStatuses, plural,
one {# note}
other {# notes}
}',
diff --git a/app/Language/fr/Note.php b/app/Language/fr/Status.php
similarity index 95%
rename from app/Language/fr/Note.php
rename to app/Language/fr/Status.php
index 682686f1..034308d6 100644
--- a/app/Language/fr/Note.php
+++ b/app/Language/fr/Status.php
@@ -10,7 +10,7 @@ declare(strict_types=1);
return [
'title' => 'Note de {actorDisplayName}',
- 'back_to_actor_notes' => 'Retour aux notes de {actor}',
+ 'back_to_actor_statuses' => 'Retour aux notes de {actor}',
'actor_shared' => '{actor} a partagé',
'reply_to' => 'Répondre à @{actorUsername}',
'form' => [
diff --git a/app/Libraries/ActivityPub/Activities/AnnounceActivity.php b/app/Libraries/ActivityPub/Activities/AnnounceActivity.php
index d258c46a..3eb4ba50 100644
--- a/app/Libraries/ActivityPub/Activities/AnnounceActivity.php
+++ b/app/Libraries/ActivityPub/Activities/AnnounceActivity.php
@@ -14,19 +14,19 @@ declare(strict_types=1);
namespace ActivityPub\Activities;
use ActivityPub\Core\Activity;
-use ActivityPub\Entities\Note;
+use ActivityPub\Entities\Status;
class AnnounceActivity extends Activity
{
protected string $type = 'Announce';
- public function __construct(Note $reblogNote)
+ public function __construct(Status $reblogStatus)
{
- $this->actor = $reblogNote->actor->uri;
- $this->object = $reblogNote->reblog_of_note->uri;
+ $this->actor = $reblogStatus->actor->uri;
+ $this->object = $reblogStatus->reblog_of_status->uri;
- $this->published = $reblogNote->published_at->format(DATE_W3C);
+ $this->published = $reblogStatus->published_at->format(DATE_W3C);
- $this->cc = [$reblogNote->actor->uri, $reblogNote->actor->followers_url];
+ $this->cc = [$reblogStatus->actor->uri, $reblogStatus->actor->followers_url];
}
}
diff --git a/app/Libraries/ActivityPub/Config/Routes.php b/app/Libraries/ActivityPub/Config/Routes.php
index fede9094..a667e721 100644
--- a/app/Libraries/ActivityPub/Config/Routes.php
+++ b/app/Libraries/ActivityPub/Config/Routes.php
@@ -13,7 +13,7 @@ $routes->addPlaceholder(
'uuid',
'[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}',
);
-$routes->addPlaceholder('noteAction', '\bfavourite|\breblog|\breply');
+$routes->addPlaceholder('statusAction', '\bfavourite|\breblog|\breply');
/**
* ActivityPub routes file
@@ -54,24 +54,24 @@ $routes->group('', [
]);
});
- // Note
- $routes->post('notes/new', 'NoteController::attemptCreate/$1', [
- 'as' => 'note-attempt-create',
+ // Status
+ $routes->post('statuses/new', 'StatusController::attemptCreate/$1', [
+ 'as' => 'status-attempt-create',
]);
- $routes->get('notes/(:uuid)', 'NoteController/$1', [
- 'as' => 'note',
+ $routes->get('statuses/(:uuid)', 'StatusController/$1', [
+ 'as' => 'status',
]);
- $routes->get('notes/(:uuid)/replies', 'NoteController/$1', [
- 'as' => 'note-replies',
+ $routes->get('statuses/(:uuid)/replies', 'StatusController/$1', [
+ 'as' => 'status-replies',
]);
$routes->post(
- 'notes/(:uuid)/remote/(:noteAction)',
- 'NoteController::attemptRemoteAction/$1/$2/$3',
+ 'statuses/(:uuid)/remote/(:statusAction)',
+ 'StatusController::attemptRemoteAction/$1/$2/$3',
[
- 'as' => 'note-attempt-remote-action',
+ 'as' => 'status-attempt-remote-action',
],
);
diff --git a/app/Libraries/ActivityPub/Controllers/ActorController.php b/app/Libraries/ActivityPub/Controllers/ActorController.php
index 41ab1e1f..6bb9167c 100644
--- a/app/Libraries/ActivityPub/Controllers/ActorController.php
+++ b/app/Libraries/ActivityPub/Controllers/ActorController.php
@@ -12,7 +12,7 @@ namespace ActivityPub\Controllers;
use ActivityPub\Config\ActivityPub;
use ActivityPub\Entities\Actor;
-use ActivityPub\Entities\Note;
+use ActivityPub\Entities\Status;
use ActivityPub\Objects\OrderedCollectionObject;
use ActivityPub\Objects\OrderedCollectionPage;
use CodeIgniter\Controller;
@@ -101,30 +101,30 @@ class ActorController extends Controller
->setJSON([]);
}
- $replyToNote = model('NoteModel')
- ->getNoteByUri($payload->object->inReplyTo);
+ $replyToStatus = model('StatusModel')
+ ->getStatusByUri($payload->object->inReplyTo);
$reply = null;
- if ($replyToNote !== null) {
+ if ($replyToStatus !== null) {
// TODO: strip content from html to retrieve message
// remove all html tags and reconstruct message with mentions?
extract_text_from_html($payload->object->content);
- $reply = new Note([
+ $reply = new Status([
'uri' => $payload->object->id,
'actor_id' => $payloadActor->id,
- 'in_reply_to_id' => $replyToNote->id,
+ 'in_reply_to_id' => $replyToStatus->id,
'message' => $payload->object->content,
'published_at' => Time::parse($payload->object->published),
]);
}
if ($reply !== null) {
- $noteId = model('NoteModel')
+ $statusId = model('StatusModel')
->addReply($reply, true, false);
model('ActivityModel')
->update($activityId, [
- 'note_id' => $noteId,
+ 'status_id' => $statusId,
]);
}
@@ -135,12 +135,12 @@ class ActorController extends Controller
return $this->response->setStatusCode(501)
->setJSON([]);
case 'Delete':
- $noteToDelete = model('NoteModel')
- ->getNoteByUri($payload->object->id);
+ $statusToDelete = model('StatusModel')
+ ->getStatusByUri($payload->object->id);
- if ($noteToDelete !== null) {
- model('NoteModel')
- ->removeNote($noteToDelete, false);
+ if ($statusToDelete !== null) {
+ model('StatusModel')
+ ->removeStatus($statusToDelete, false);
}
return $this->response->setStatusCode(200)
@@ -158,35 +158,35 @@ class ActorController extends Controller
->setJSON([]);
case 'Like':
- // get favourited note
- $note = model('NoteModel')
- ->getNoteByUri($payload->object);
+ // get favourited status
+ $status = model('StatusModel')
+ ->getStatusByUri($payload->object);
- if ($note !== null) {
+ if ($status !== null) {
// Like side-effect
model('FavouriteModel')
- ->addFavourite($payloadActor, $note, false);
+ ->addFavourite($payloadActor, $status, false);
model('ActivityModel')
->update($activityId, [
- 'note_id' => $note->id,
+ 'status_id' => $status->id,
]);
}
return $this->response->setStatusCode(200)
->setJSON([]);
case 'Announce':
- $note = model('NoteModel')
- ->getNoteByUri($payload->object);
+ $status = model('StatusModel')
+ ->getStatusByUri($payload->object);
- if ($note !== null) {
+ if ($status !== null) {
model('ActivityModel')
->update($activityId, [
- 'note_id' => $note->id,
+ 'status_id' => $status->id,
]);
- model('NoteModel')
- ->reblog($payloadActor, $note, false);
+ model('StatusModel')
+ ->reblog($payloadActor, $status, false);
}
return $this->response->setStatusCode(200)
@@ -204,45 +204,45 @@ class ActorController extends Controller
return $this->response->setStatusCode(202)
->setJSON([]);
case 'Like':
- $note = model('NoteModel')
- ->getNoteByUri($payload->object->object);
+ $status = model('StatusModel')
+ ->getStatusByUri($payload->object->object);
- if ($note !== null) {
+ if ($status !== null) {
// revert side-effect by removing favourite from database
model('FavouriteModel')
- ->removeFavourite($payloadActor, $note, false);
+ ->removeFavourite($payloadActor, $status, false);
model('ActivityModel')
->update($activityId, [
- 'note_id' => $note->id,
+ 'status_id' => $status->id,
]);
}
return $this->response->setStatusCode(200)
->setJSON([]);
case 'Announce':
- $note = model('NoteModel')
- ->getNoteByUri($payload->object->object);
+ $status = model('StatusModel')
+ ->getStatusByUri($payload->object->object);
- $reblogNote = null;
- if ($note !== null) {
- $reblogNote = model('NoteModel')
+ $reblogStatus = null;
+ if ($status !== null) {
+ $reblogStatus = model('StatusModel')
->where([
'actor_id' => $payloadActor->id,
'reblog_of_id' => service('uuid')
- ->fromString($note->id)
+ ->fromString($status->id)
->getBytes(),
])
->first();
}
- if ($reblogNote !== null) {
- model('NoteModel')
- ->undoReblog($reblogNote, false);
+ if ($reblogStatus !== null) {
+ model('StatusModel')
+ ->undoReblog($reblogStatus, false);
model('ActivityModel')
->update($activityId, [
- 'note_id' => $note->id,
+ 'status_id' => $status->id,
]);
}
diff --git a/app/Libraries/ActivityPub/Controllers/SchedulerController.php b/app/Libraries/ActivityPub/Controllers/SchedulerController.php
index 22abde21..057360a3 100644
--- a/app/Libraries/ActivityPub/Controllers/SchedulerController.php
+++ b/app/Libraries/ActivityPub/Controllers/SchedulerController.php
@@ -36,7 +36,7 @@ class SchedulerController extends Controller
// set activity status to delivered
model('ActivityModel')
->update($scheduledActivity->id, [
- 'status' => 'delivered',
+ 'task_status' => 'delivered',
]);
}
}
diff --git a/app/Libraries/ActivityPub/Controllers/NoteController.php b/app/Libraries/ActivityPub/Controllers/StatusController.php
similarity index 81%
rename from app/Libraries/ActivityPub/Controllers/NoteController.php
rename to app/Libraries/ActivityPub/Controllers/StatusController.php
index 05b748d6..e43b433e 100644
--- a/app/Libraries/ActivityPub/Controllers/NoteController.php
+++ b/app/Libraries/ActivityPub/Controllers/StatusController.php
@@ -11,7 +11,7 @@ declare(strict_types=1);
namespace ActivityPub\Controllers;
use ActivityPub\Config\ActivityPub;
-use ActivityPub\Entities\Note;
+use ActivityPub\Entities\Status;
use ActivityPub\Objects\OrderedCollectionObject;
use ActivityPub\Objects\OrderedCollectionPage;
use CodeIgniter\Controller;
@@ -21,14 +21,14 @@ use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\I18n\Time;
-class NoteController extends Controller
+class StatusController extends Controller
{
/**
* @var string[]
*/
protected $helpers = ['activitypub'];
- protected Note $note;
+ protected Status $status;
protected ActivityPub $config;
@@ -39,11 +39,11 @@ class NoteController extends Controller
public function _remap(string $method, string ...$params): mixed
{
- if (($note = model('NoteModel')->getNoteById($params[0])) === null) {
+ if (($status = model('StatusModel')->getStatusById($params[0])) === null) {
throw PageNotFoundException::forPageNotFound();
}
- $this->note = $note;
+ $this->status = $status;
unset($params[0]);
@@ -56,7 +56,7 @@ class NoteController extends Controller
public function index(): Response
{
$noteObjectClass = $this->config->noteObject;
- $noteObject = new $noteObjectClass($this->note);
+ $noteObject = new $noteObjectClass($this->status);
return $this->response
->setContentType('application/activity+json')
@@ -69,22 +69,22 @@ class NoteController extends Controller
public function replies(): Response
{
/**
- * get note replies
+ * get status replies
*/
- $noteReplies = model('NoteModel')
- ->where('in_reply_to_id', service('uuid') ->fromString($this->note->id) ->getBytes())
+ $statusReplies = model('StatusModel')
+ ->where('in_reply_to_id', service('uuid') ->fromString($this->status->id) ->getBytes())
->where('`published_at` <= NOW()', null, false)
->orderBy('published_at', 'ASC');
$pageNumber = (int) $this->request->getGet('page');
if ($pageNumber < 1) {
- $noteReplies->paginate(12);
- $pager = $noteReplies->pager;
+ $statusReplies->paginate(12);
+ $pager = $statusReplies->pager;
$collection = new OrderedCollectionObject(null, $pager);
} else {
- $paginatedReplies = $noteReplies->paginate(12, 'default', $pageNumber);
- $pager = $noteReplies->pager;
+ $paginatedReplies = $statusReplies->paginate(12, 'default', $pageNumber);
+ $pager = $statusReplies->pager;
$orderedItems = [];
$noteObjectClass = $this->config->noteObject;
@@ -118,21 +118,21 @@ class NoteController extends Controller
->with('errors', $this->validator->getErrors());
}
- $newNote = new Note([
+ $newStatus = new Status([
'actor_id' => $this->request->getPost('actor_id'),
'message' => $this->request->getPost('message'),
'published_at' => Time::now(),
]);
- if (! model('NoteModel')->addNote($newNote)) {
+ if (! model('StatusModel')->addStatus($newStatus)) {
return redirect()
->back()
->withInput()
// TODO: translate
- ->with('error', "Couldn't create Note");
+ ->with('error', "Couldn't create Status");
}
- // Note without preview card has been successfully created
+ // Status without preview card has been successfully created
return redirect()->back();
}
@@ -153,7 +153,7 @@ class NoteController extends Controller
->getActorById($this->request->getPost('actor_id'));
model('FavouriteModel')
- ->toggleFavourite($actor, $this->note->id);
+ ->toggleFavourite($actor, $this->status->id);
return redirect()->back();
}
@@ -174,8 +174,8 @@ class NoteController extends Controller
$actor = model('ActorModel')
->getActorById($this->request->getPost('actor_id'));
- model('NoteModel')
- ->toggleReblog($actor, $this->note);
+ model('StatusModel')
+ ->toggleReblog($actor, $this->status);
return redirect()->back();
}
@@ -194,14 +194,14 @@ class NoteController extends Controller
->with('errors', $this->validator->getErrors());
}
- $newReplyNote = new Note([
+ $newReplyStatus = new Status([
'actor_id' => $this->request->getPost('actor_id'),
- 'in_reply_to_id' => $this->note->id,
+ 'in_reply_to_id' => $this->status->id,
'message' => $this->request->getPost('message'),
'published_at' => Time::now(),
]);
- if (! model('NoteModel')->addReply($newReplyNote)) {
+ if (! model('StatusModel')->addReply($newReplyStatus)) {
return redirect()
->back()
->withInput()
@@ -209,7 +209,7 @@ class NoteController extends Controller
->with('error', "Couldn't create Reply");
}
- // Reply note without preview card has been successfully created
+ // Reply status without preview card has been successfully created
return redirect()->back();
}
@@ -249,33 +249,33 @@ class NoteController extends Controller
);
if (! $ostatusKey) {
- // TODO: error, couldn't remote favourite/share/reply to note
- // The instance doesn't allow its users remote actions on notes
+ // TODO: error, couldn't remote favourite/share/reply to status
+ // The instance doesn't allow its users remote actions on statuses
return $this->response->setJSON([]);
}
return redirect()->to(
- str_replace('{uri}', urlencode($this->note->uri), $data->links[$ostatusKey]->template),
+ str_replace('{uri}', urlencode($this->status->uri), $data->links[$ostatusKey]->template),
);
}
public function attemptBlockActor(): RedirectResponse
{
- model('ActorModel')->blockActor($this->note->actor->id);
+ model('ActorModel')->blockActor($this->status->actor->id);
return redirect()->back();
}
public function attemptBlockDomain(): RedirectResponse
{
- model('BlockedDomainModel')->blockDomain($this->note->actor->domain);
+ model('BlockedDomainModel')->blockDomain($this->status->actor->domain);
return redirect()->back();
}
public function attemptDelete(): RedirectResponse
{
- model('NoteModel', false)->removeNote($this->note);
+ model('StatusModel', false)->removeStatus($this->status);
return redirect()->back();
}
diff --git a/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-010000_add_actors.php b/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-010000_add_actors.php
index 23183a0d..4fcc2973 100644
--- a/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-010000_add_actors.php
+++ b/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-010000_add_actors.php
@@ -93,7 +93,7 @@ class AddActors extends Migration
'unsigned' => true,
'default' => 0,
],
- 'notes_count' => [
+ 'statuses_count' => [
'type' => 'INT',
'unsigned' => true,
'default' => 0,
diff --git a/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-020000_add_notes.php b/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-020000_add_statuses.php
similarity index 87%
rename from app/Libraries/ActivityPub/Database/Migrations/2018-01-01-020000_add_notes.php
rename to app/Libraries/ActivityPub/Database/Migrations/2018-01-01-020000_add_statuses.php
index 8ef29e06..68fe53fc 100644
--- a/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-020000_add_notes.php
+++ b/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-020000_add_statuses.php
@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
- * Class AddNotes Creates activitypub_notes table in database
+ * Class AddStatuses Creates activitypub_statuses table in database
*
* @copyright 2021 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@@ -14,7 +14,7 @@ namespace ActivityPub\Database\Migrations;
use CodeIgniter\Database\Migration;
-class AddNotes extends Migration
+class AddStatuses extends Migration
{
public function up(): void
{
@@ -76,16 +76,16 @@ class AddNotes extends Migration
]);
$this->forge->addPrimaryKey('id');
$this->forge->addUniqueKey('uri');
- // FIXME: an actor must reblog a note only once
+ // FIXME: an actor must reblog a status only once
// $this->forge->addUniqueKey(['actor_id', 'reblog_of_id']);
$this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE');
- $this->forge->addForeignKey('in_reply_to_id', 'activitypub_notes', 'id', '', 'CASCADE');
- $this->forge->addForeignKey('reblog_of_id', 'activitypub_notes', 'id', '', 'CASCADE');
- $this->forge->createTable('activitypub_notes');
+ $this->forge->addForeignKey('in_reply_to_id', 'activitypub_statuses', 'id', '', 'CASCADE');
+ $this->forge->addForeignKey('reblog_of_id', 'activitypub_statuses', 'id', '', 'CASCADE');
+ $this->forge->createTable('activitypub_statuses');
}
public function down(): void
{
- $this->forge->dropTable('activitypub_notes');
+ $this->forge->dropTable('activitypub_statuses');
}
}
diff --git a/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-100000_add_activities.php b/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-100000_add_activities.php
index a20bafb5..443a3ea9 100644
--- a/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-100000_add_activities.php
+++ b/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-100000_add_activities.php
@@ -32,7 +32,7 @@ class AddActivities extends Migration
'unsigned' => true,
'null' => true,
],
- 'note_id' => [
+ 'status_id' => [
'type' => 'BINARY',
'constraint' => 16,
'null' => true,
@@ -44,7 +44,7 @@ class AddActivities extends Migration
'payload' => [
'type' => 'JSON',
],
- 'status' => [
+ 'task_status' => [
'type' => 'ENUM',
'constraint' => ['queued', 'delivered'],
'null' => true,
@@ -62,7 +62,7 @@ class AddActivities extends Migration
$this->forge->addPrimaryKey('id');
$this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE');
$this->forge->addForeignKey('target_actor_id', 'activitypub_actors', 'id', '', 'CASCADE');
- $this->forge->addForeignKey('note_id', 'activitypub_notes', 'id', '', 'CASCADE');
+ $this->forge->addForeignKey('status_id', 'activitypub_statuses', 'id', '', 'CASCADE');
$this->forge->createTable('activitypub_activities');
}
diff --git a/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-100000_add_favourites.php b/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-100000_add_favourites.php
index d3ff03a9..049284bb 100644
--- a/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-100000_add_favourites.php
+++ b/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-100000_add_favourites.php
@@ -23,15 +23,15 @@ class AddFavourites extends Migration
'type' => 'INT',
'unsigned' => true,
],
- 'note_id' => [
+ 'status_id' => [
'type' => 'BINARY',
'constraint' => 16,
],
]);
$this->forge->addField('`created_at` timestamp NOT NULL DEFAULT current_timestamp()');
- $this->forge->addPrimaryKey(['actor_id', 'note_id']);
+ $this->forge->addPrimaryKey(['actor_id', 'status_id']);
$this->forge->addForeignKey('actor_id', 'activitypub_actors', 'id', '', 'CASCADE');
- $this->forge->addForeignKey('note_id', 'activitypub_notes', 'id', '', 'CASCADE');
+ $this->forge->addForeignKey('status_id', 'activitypub_statuses', 'id', '', 'CASCADE');
$this->forge->createTable('activitypub_favourites');
}
diff --git a/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-110000_add_notes_preview_cards.php b/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-110000_add_statuses_preview_cards.php
similarity index 59%
rename from app/Libraries/ActivityPub/Database/Migrations/2018-01-01-110000_add_notes_preview_cards.php
rename to app/Libraries/ActivityPub/Database/Migrations/2018-01-01-110000_add_statuses_preview_cards.php
index 4c3829eb..fe35855f 100644
--- a/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-110000_add_notes_preview_cards.php
+++ b/app/Libraries/ActivityPub/Database/Migrations/2018-01-01-110000_add_statuses_preview_cards.php
@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
- * Class AddNotePreviewCards Creates activitypub_notes_preview_cards table in database
+ * Class AddStatusesPreviewCards Creates activitypub_statuses_preview_cards table in database
*
* @copyright 2021 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
@@ -14,12 +14,12 @@ namespace ActivityPub\Database\Migrations;
use CodeIgniter\Database\Migration;
-class AddNotesPreviewCards extends Migration
+class AddStatusesPreviewCards extends Migration
{
public function up(): void
{
$this->forge->addField([
- 'note_id' => [
+ 'status_id' => [
'type' => 'BINARY',
'constraint' => 16,
],
@@ -29,14 +29,14 @@ class AddNotesPreviewCards extends Migration
],
]);
- $this->forge->addPrimaryKey(['note_id', 'preview_card_id']);
- $this->forge->addForeignKey('note_id', 'activitypub_notes', 'id', '', 'CASCADE');
+ $this->forge->addPrimaryKey(['status_id', 'preview_card_id']);
+ $this->forge->addForeignKey('status_id', 'activitypub_statuses', 'id', '', 'CASCADE');
$this->forge->addForeignKey('preview_card_id', 'activitypub_preview_cards', 'id', '', 'CASCADE');
- $this->forge->createTable('activitypub_notes_preview_cards');
+ $this->forge->createTable('activitypub_statuses_preview_cards');
}
public function down(): void
{
- $this->forge->dropTable('activitypub_notes_preview_cards');
+ $this->forge->dropTable('activitypub_statuses_preview_cards');
}
}
diff --git a/app/Libraries/ActivityPub/Entities/Activity.php b/app/Libraries/ActivityPub/Entities/Activity.php
index cd9996f5..4a67bdb0 100644
--- a/app/Libraries/ActivityPub/Entities/Activity.php
+++ b/app/Libraries/ActivityPub/Entities/Activity.php
@@ -19,11 +19,11 @@ use RuntimeException;
* @property Actor $actor
* @property int|null $target_actor_id
* @property Actor $target_actor
- * @property string|null $note_id
- * @property Note $note
+ * @property string|null $status_id
+ * @property Status $status
* @property string $type
* @property object $payload
- * @property string|null $status
+ * @property string|null $task_status
* @property Time|null $scheduled_at
* @property Time $created_at
*/
@@ -33,12 +33,12 @@ class Activity extends UuidEntity
protected ?Actor $target_actor = null;
- protected ?Note $note = null;
+ protected ?Status $status = null;
/**
* @var string[]
*/
- protected $uuids = ['id', 'note_id'];
+ protected $uuids = ['id', 'status_id'];
/**
* @var string[]
@@ -52,10 +52,10 @@ class Activity extends UuidEntity
'id' => 'string',
'actor_id' => 'integer',
'target_actor_id' => '?integer',
- 'note_id' => '?string',
+ 'status_id' => '?string',
'type' => 'string',
'payload' => 'json',
- 'status' => '?string',
+ 'task_status' => '?string',
];
public function getActor(): Actor
@@ -86,17 +86,17 @@ class Activity extends UuidEntity
return $this->target_actor;
}
- public function getNote(): Note
+ public function getStatus(): Status
{
- if ($this->note_id === null) {
- throw new RuntimeException('Activity must have a note_id before getting note.');
+ if ($this->status_id === null) {
+ throw new RuntimeException('Activity must have a status_id before getting status.');
}
- if ($this->note === null) {
- $this->note = model('NoteModel', false)
- ->getNoteById($this->note_id);
+ if ($this->status === null) {
+ $this->status = model('StatusModel', false)
+ ->getStatusById($this->status_id);
}
- return $this->note;
+ return $this->status;
}
}
diff --git a/app/Libraries/ActivityPub/Entities/Actor.php b/app/Libraries/ActivityPub/Entities/Actor.php
index 0e7746c7..25845f00 100644
--- a/app/Libraries/ActivityPub/Entities/Actor.php
+++ b/app/Libraries/ActivityPub/Entities/Actor.php
@@ -31,7 +31,7 @@ use RuntimeException;
* @property string|null $outbox_url
* @property string|null $followers_url
* @property int $followers_count
- * @property int $notes_count
+ * @property int $statuses_count
* @property bool $is_blocked
*
* @property Actor[] $followers
@@ -68,7 +68,7 @@ class Actor extends Entity
'outbox_url' => '?string',
'followers_url' => '?string',
'followers_count' => 'integer',
- 'notes_count' => 'integer',
+ 'statuses_count' => 'integer',
'is_blocked' => 'boolean',
];
diff --git a/app/Libraries/ActivityPub/Entities/Favourite.php b/app/Libraries/ActivityPub/Entities/Favourite.php
index 4ba92256..04014bb6 100644
--- a/app/Libraries/ActivityPub/Entities/Favourite.php
+++ b/app/Libraries/ActivityPub/Entities/Favourite.php
@@ -14,20 +14,20 @@ use Michalsn\Uuid\UuidEntity;
/**
* @property int $actor_id
- * @property string $note_id
+ * @property string $status_id
*/
class Favourite extends UuidEntity
{
/**
* @var string[]
*/
- protected $uuids = ['note_id'];
+ protected $uuids = ['status_id'];
/**
* @var array
*/
protected $casts = [
'actor_id' => 'integer',
- 'note_id' => 'string',
+ 'status_id' => 'string',
];
}
diff --git a/app/Libraries/ActivityPub/Entities/PreviewCard.php b/app/Libraries/ActivityPub/Entities/PreviewCard.php
index a2fe1537..630ccde1 100644
--- a/app/Libraries/ActivityPub/Entities/PreviewCard.php
+++ b/app/Libraries/ActivityPub/Entities/PreviewCard.php
@@ -14,7 +14,7 @@ use CodeIgniter\Entity\Entity;
/**
* @property int $id
- * @property string $note_id
+ * @property string $status_id
* @property string $url
* @property string $title
* @property string $description
@@ -33,7 +33,7 @@ class PreviewCard extends Entity
*/
protected $casts = [
'id' => 'integer',
- 'note_id' => 'string',
+ 'status_id' => 'string',
'url' => 'string',
'title' => 'string',
'description' => 'string',
diff --git a/app/Libraries/ActivityPub/Entities/Note.php b/app/Libraries/ActivityPub/Entities/Status.php
similarity index 66%
rename from app/Libraries/ActivityPub/Entities/Note.php
rename to app/Libraries/ActivityPub/Entities/Status.php
index 06199303..94cfa0c7 100644
--- a/app/Libraries/ActivityPub/Entities/Note.php
+++ b/app/Libraries/ActivityPub/Entities/Status.php
@@ -20,9 +20,9 @@ use RuntimeException;
* @property int $actor_id
* @property Actor $actor
* @property string|null $in_reply_to_id
- * @property Note|null $reply_to_note
+ * @property Status|null $reply_to_status
* @property string|null $reblog_of_id
- * @property Note|null $reblog_of_note
+ * @property Status|null $reblog_of_status
* @property string $message
* @property string $message_html
* @property int $favourites_count
@@ -35,30 +35,30 @@ use RuntimeException;
* @property PreviewCard|null $preview_card
*
* @property bool $has_replies
- * @property Note[] $replies
- * @property Note[] $reblogs
+ * @property Status[] $replies
+ * @property Status[] $reblogs
*/
-class Note extends UuidEntity
+class Status extends UuidEntity
{
protected ?Actor $actor = null;
- protected ?Note $reply_to_note = null;
+ protected ?Status $reply_to_status = null;
- protected ?Note $reblog_of_note = null;
+ protected ?Status $reblog_of_status = null;
protected ?PreviewCard $preview_card = null;
protected bool $has_preview_card = false;
/**
- * @var Note[]|null
+ * @var Status[]|null
*/
protected ?array $replies = null;
protected bool $has_replies = false;
/**
- * @var Note[]|null
+ * @var Status[]|null
*/
protected ?array $reblogs = null;
@@ -89,12 +89,12 @@ class Note extends UuidEntity
];
/**
- * Returns the note's actor
+ * Returns the status's actor
*/
public function getActor(): Actor
{
if ($this->actor_id === null) {
- throw new RuntimeException('Note must have an actor_id before getting actor.');
+ throw new RuntimeException('Status must have an actor_id before getting actor.');
}
if ($this->actor === null) {
@@ -108,12 +108,12 @@ class Note extends UuidEntity
public function getPreviewCard(): ?PreviewCard
{
if ($this->id === null) {
- throw new RuntimeException('Note must be created before getting preview_card.');
+ throw new RuntimeException('Status must be created before getting preview_card.');
}
if ($this->preview_card === null) {
$this->preview_card = model('PreviewCardModel', false)
- ->getNotePreviewCard($this->id);
+ ->getStatusPreviewCard($this->id);
}
return $this->preview_card;
@@ -125,17 +125,17 @@ class Note extends UuidEntity
}
/**
- * @return Note[]
+ * @return Status[]
*/
public function getReplies(): array
{
if ($this->id === null) {
- throw new RuntimeException('Note must be created before getting replies.');
+ throw new RuntimeException('Status must be created before getting replies.');
}
if ($this->replies === null) {
- $this->replies = (array) model('NoteModel', false)
- ->getNoteReplies($this->id);
+ $this->replies = (array) model('StatusModel', false)
+ ->getStatusReplies($this->id);
}
return $this->replies;
@@ -146,49 +146,49 @@ class Note extends UuidEntity
return $this->getReplies() !== null;
}
- public function getReplyToNote(): ?self
+ public function getReplyToStatus(): ?self
{
if ($this->in_reply_to_id === null) {
- throw new RuntimeException('Note is not a reply.');
+ throw new RuntimeException('Status is not a reply.');
}
- if ($this->reply_to_note === null) {
- $this->reply_to_note = model('NoteModel', false)
- ->getNoteById($this->in_reply_to_id);
+ if ($this->reply_to_status === null) {
+ $this->reply_to_status = model('StatusModel', false)
+ ->getStatusById($this->in_reply_to_id);
}
- return $this->reply_to_note;
+ return $this->reply_to_status;
}
/**
- * @return Note[]
+ * @return Status[]
*/
public function getReblogs(): array
{
if ($this->id === null) {
- throw new RuntimeException('Note must be created before getting reblogs.');
+ throw new RuntimeException('Status must be created before getting reblogs.');
}
if ($this->reblogs === null) {
- $this->reblogs = (array) model('NoteModel', false)
- ->getNoteReblogs($this->id);
+ $this->reblogs = (array) model('StatusModel', false)
+ ->getStatusReblogs($this->id);
}
return $this->reblogs;
}
- public function getReblogOfNote(): ?self
+ public function getReblogOfStatus(): ?self
{
if ($this->reblog_of_id === null) {
- throw new RuntimeException('Note is not a reblog.');
+ throw new RuntimeException('Status is not a reblog.');
}
- if ($this->reblog_of_note === null) {
- $this->reblog_of_note = model('NoteModel', false)
- ->getNoteById($this->reblog_of_id);
+ if ($this->reblog_of_status === null) {
+ $this->reblog_of_status = model('StatusModel', false)
+ ->getStatusById($this->reblog_of_id);
}
- return $this->reblog_of_note;
+ return $this->reblog_of_status;
}
public function setMessage(string $message): static
diff --git a/app/Libraries/ActivityPub/Models/ActivityModel.php b/app/Libraries/ActivityPub/Models/ActivityModel.php
index 3b00d9db..5e346e45 100644
--- a/app/Libraries/ActivityPub/Models/ActivityModel.php
+++ b/app/Libraries/ActivityPub/Models/ActivityModel.php
@@ -31,7 +31,7 @@ class ActivityModel extends UuidModel
/**
* @var string[]
*/
- protected $uuidFields = ['id', 'note_id'];
+ protected $uuidFields = ['id', 'status_id'];
/**
* @var string[]
@@ -40,10 +40,10 @@ class ActivityModel extends UuidModel
'id',
'actor_id',
'target_actor_id',
- 'note_id',
+ 'status_id',
'type',
'payload',
- 'status',
+ 'task_status',
'scheduled_at',
];
@@ -88,20 +88,20 @@ class ActivityModel extends UuidModel
string $type,
int $actorId,
?int $targetActorId,
- ?string $noteId,
+ ?string $statusId,
string $payload,
DateTimeInterface $scheduledAt = null,
- ?string $status = null
+ ?string $taskStatus = null
): BaseResult | int | string | false {
return $this->insert(
[
'actor_id' => $actorId,
'target_actor_id' => $targetActorId,
- 'note_id' => $noteId,
+ 'status_id' => $statusId,
'type' => $type,
'payload' => $payload,
'scheduled_at' => $scheduledAt,
- 'status' => $status,
+ 'task_status' => $taskStatus,
],
true,
);
diff --git a/app/Libraries/ActivityPub/Models/ActorModel.php b/app/Libraries/ActivityPub/Models/ActorModel.php
index aff67eb2..8fe539a1 100644
--- a/app/Libraries/ActivityPub/Models/ActorModel.php
+++ b/app/Libraries/ActivityPub/Models/ActorModel.php
@@ -41,7 +41,7 @@ class ActorModel extends Model
'outbox_url',
'followers_url',
'followers_count',
- 'notes_count',
+ 'statuses_count',
'is_blocked',
];
diff --git a/app/Libraries/ActivityPub/Models/FavouriteModel.php b/app/Libraries/ActivityPub/Models/FavouriteModel.php
index 57ac63ae..32cc81b6 100644
--- a/app/Libraries/ActivityPub/Models/FavouriteModel.php
+++ b/app/Libraries/ActivityPub/Models/FavouriteModel.php
@@ -14,7 +14,7 @@ use ActivityPub\Activities\LikeActivity;
use ActivityPub\Activities\UndoActivity;
use ActivityPub\Entities\Actor;
use ActivityPub\Entities\Favourite;
-use ActivityPub\Entities\Note;
+use ActivityPub\Entities\Status;
use CodeIgniter\Events\Events;
use Michalsn\Uuid\UuidModel;
@@ -28,12 +28,12 @@ class FavouriteModel extends UuidModel
/**
* @var string[]
*/
- protected $uuidFields = ['note_id'];
+ protected $uuidFields = ['status_id'];
/**
* @var string[]
*/
- protected $allowedFields = ['actor_id', 'note_id'];
+ protected $allowedFields = ['actor_id', 'status_id'];
/**
* @var string
@@ -47,32 +47,32 @@ class FavouriteModel extends UuidModel
protected $updatedField;
- public function addFavourite(Actor $actor, Note $note, bool $registerActivity = true): void
+ public function addFavourite(Actor $actor, Status $status, bool $registerActivity = true): void
{
$this->db->transStart();
$this->insert([
'actor_id' => $actor->id,
- 'note_id' => $note->id,
+ 'status_id' => $status->id,
]);
- model('NoteModel')
- ->where('id', service('uuid') ->fromString($note->id) ->getBytes())
+ model('StatusModel')
+ ->where('id', service('uuid') ->fromString($status->id) ->getBytes())
->increment('favourites_count');
if ($registerActivity) {
$likeActivity = new LikeActivity();
$likeActivity->set('actor', $actor->uri)
- ->set('object', $note->uri);
+ ->set('object', $status->uri);
$activityId = model('ActivityModel')
->newActivity(
'Like',
$actor->id,
null,
- $note->id,
+ $status->id,
$likeActivity->toJSON(),
- $note->published_at,
+ $status->published_at,
'queued',
);
@@ -84,28 +84,28 @@ class FavouriteModel extends UuidModel
]);
}
- Events::trigger('on_note_favourite', $actor, $note);
+ Events::trigger('on_status_favourite', $actor, $status);
- model('NoteModel')
- ->clearCache($note);
+ model('StatusModel')
+ ->clearCache($status);
$this->db->transComplete();
}
- public function removeFavourite(Actor $actor, Note $note, bool $registerActivity = true): void
+ public function removeFavourite(Actor $actor, Status $status, bool $registerActivity = true): void
{
$this->db->transStart();
- model('NoteModel')
- ->where('id', service('uuid') ->fromString($note->id) ->getBytes())
+ model('StatusModel')
+ ->where('id', service('uuid') ->fromString($status->id) ->getBytes())
->decrement('favourites_count');
$this->db
->table('activitypub_favourites')
->where([
'actor_id' => $actor->id,
- 'note_id' => service('uuid')
- ->fromString($note->id)
+ 'status_id' => service('uuid')
+ ->fromString($status->id)
->getBytes(),
])
->delete();
@@ -117,8 +117,8 @@ class FavouriteModel extends UuidModel
->where([
'type' => 'Like',
'actor_id' => $actor->id,
- 'note_id' => service('uuid')
- ->fromString($note->id)
+ 'status_id' => service('uuid')
+ ->fromString($status->id)
->getBytes(),
])
->first();
@@ -127,7 +127,7 @@ class FavouriteModel extends UuidModel
$likeActivity
->set('id', base_url(route_to('activity', $actor->username, $activity->id)))
->set('actor', $actor->uri)
- ->set('object', $note->uri);
+ ->set('object', $status->uri);
$undoActivity
->set('actor', $actor->uri)
@@ -138,9 +138,9 @@ class FavouriteModel extends UuidModel
'Undo',
$actor->id,
null,
- $note->id,
+ $status->id,
$undoActivity->toJSON(),
- $note->published_at,
+ $status->published_at,
'queued',
);
@@ -152,10 +152,10 @@ class FavouriteModel extends UuidModel
]);
}
- Events::trigger('on_note_undo_favourite', $actor, $note);
+ Events::trigger('on_status_undo_favourite', $actor, $status);
- model('NoteModel')
- ->clearCache($note);
+ model('StatusModel')
+ ->clearCache($status);
$this->db->transComplete();
}
@@ -163,19 +163,19 @@ class FavouriteModel extends UuidModel
/**
* Adds or removes favourite from database and increments count
*/
- public function toggleFavourite(Actor $actor, Note $note): void
+ public function toggleFavourite(Actor $actor, Status $status): void
{
if (
$this->where([
'actor_id' => $actor->id,
- 'note_id' => service('uuid')
- ->fromString($note->id)
+ 'status_id' => service('uuid')
+ ->fromString($status->id)
->getBytes(),
])->first()
) {
- $this->removeFavourite($actor, $note);
+ $this->removeFavourite($actor, $status);
} else {
- $this->addFavourite($actor, $note);
+ $this->addFavourite($actor, $status);
}
}
}
diff --git a/app/Libraries/ActivityPub/Models/PreviewCardModel.php b/app/Libraries/ActivityPub/Models/PreviewCardModel.php
index 340dbe05..161052f7 100644
--- a/app/Libraries/ActivityPub/Models/PreviewCardModel.php
+++ b/app/Libraries/ActivityPub/Models/PreviewCardModel.php
@@ -70,18 +70,18 @@ class PreviewCardModel extends Model
return $found;
}
- public function getNotePreviewCard(string $noteId): ?PreviewCard
+ public function getStatusPreviewCard(string $statusId): ?PreviewCard
{
$cacheName =
config('ActivityPub')
- ->cachePrefix . "note#{$noteId}_preview_card";
+ ->cachePrefix . "status#{$statusId}_preview_card";
if (! ($found = cache($cacheName))) {
$found = $this->join(
- 'activitypub_notes_preview_cards',
- 'activitypub_notes_preview_cards.preview_card_id = id',
+ 'activitypub_statuses_preview_cards',
+ 'activitypub_statuses_preview_cards.preview_card_id = id',
'inner',
)
- ->where('note_id', service('uuid') ->fromString($noteId) ->getBytes())
+ ->where('status_id', service('uuid') ->fromString($statusId) ->getBytes())
->first();
cache()
diff --git a/app/Libraries/ActivityPub/Models/NoteModel.php b/app/Libraries/ActivityPub/Models/StatusModel.php
similarity index 58%
rename from app/Libraries/ActivityPub/Models/NoteModel.php
rename to app/Libraries/ActivityPub/Models/StatusModel.php
index 5662bec3..3f911bab 100644
--- a/app/Libraries/ActivityPub/Models/NoteModel.php
+++ b/app/Libraries/ActivityPub/Models/StatusModel.php
@@ -15,7 +15,7 @@ use ActivityPub\Activities\CreateActivity;
use ActivityPub\Activities\DeleteActivity;
use ActivityPub\Activities\UndoActivity;
use ActivityPub\Entities\Actor;
-use ActivityPub\Entities\Note;
+use ActivityPub\Entities\Status;
use ActivityPub\Objects\TombstoneObject;
use CodeIgniter\Database\BaseResult;
use CodeIgniter\Database\Query;
@@ -25,12 +25,12 @@ use CodeIgniter\I18n\Time;
use Exception;
use Michalsn\Uuid\UuidModel;
-class NoteModel extends UuidModel
+class StatusModel extends UuidModel
{
/**
* @var string
*/
- protected $table = 'activitypub_notes';
+ protected $table = 'activitypub_statuses';
/**
* @var string
@@ -62,7 +62,7 @@ class NoteModel extends UuidModel
/**
* @var string
*/
- protected $returnType = Note::class;
+ protected $returnType = Status::class;
/**
* @var bool
@@ -87,14 +87,14 @@ class NoteModel extends UuidModel
/**
* @var string[]
*/
- protected $beforeInsert = ['setNoteId'];
+ protected $beforeInsert = ['setStatusId'];
- public function getNoteById(string $noteId): ?Note
+ public function getStatusById(string $statusId): ?Status
{
$cacheName = config('ActivityPub')
- ->cachePrefix . "note#{$noteId}";
+ ->cachePrefix . "status#{$statusId}";
if (! ($found = cache($cacheName))) {
- $found = $this->find($noteId);
+ $found = $this->find($statusId);
cache()
->save($cacheName, $found, DECADE);
@@ -103,14 +103,14 @@ class NoteModel extends UuidModel
return $found;
}
- public function getNoteByUri(string $noteUri): ?Note
+ public function getStatusByUri(string $statusUri): ?Status
{
- $hashedNoteUri = md5($noteUri);
+ $hashedStatusUri = md5($statusUri);
$cacheName =
config('ActivityPub')
- ->cachePrefix . "note-{$hashedNoteUri}";
+ ->cachePrefix . "status-{$hashedStatusUri}";
if (! ($found = cache($cacheName))) {
- $found = $this->where('uri', $noteUri)
+ $found = $this->where('uri', $statusUri)
->first();
cache()
@@ -121,16 +121,16 @@ class NoteModel extends UuidModel
}
/**
- * Retrieves all published notes for a given actor ordered by publication date
+ * Retrieves all published statuses for a given actor ordered by publication date
*
- * @return Note[]
+ * @return Status[]
*/
- public function getActorPublishedNotes(int $actorId): array
+ public function getActorPublishedStatuses(int $actorId): array
{
$cacheName =
config('ActivityPub')
->cachePrefix .
- "actor#{$actorId}_published_notes";
+ "actor#{$actorId}_published_statuses";
if (! ($found = cache($cacheName))) {
$found = $this->where([
'actor_id' => $actorId,
@@ -140,20 +140,20 @@ class NoteModel extends UuidModel
->orderBy('published_at', 'DESC')
->findAll();
- $secondsToNextUnpublishedNote = $this->getSecondsToNextUnpublishedNote($actorId);
+ $secondsToNextUnpublishedStatus = $this->getSecondsToNextUnpublishedStatuses($actorId);
cache()
- ->save($cacheName, $found, $secondsToNextUnpublishedNote ? $secondsToNextUnpublishedNote : DECADE);
+ ->save($cacheName, $found, $secondsToNextUnpublishedStatus ? $secondsToNextUnpublishedStatus : DECADE);
}
return $found;
}
/**
- * Returns the timestamp difference in seconds between the next note to publish and the current timestamp. Returns
- * false if there's no note to publish
+ * Returns the timestamp difference in seconds between the next status to publish and the current timestamp. Returns
+ * false if there's no status to publish
*/
- public function getSecondsToNextUnpublishedNote(int $actorId): int | false
+ public function getSecondsToNextUnpublishedStatuses(int $actorId): int | false
{
$result = $this->select('TIMESTAMPDIFF(SECOND, NOW(), `published_at`) as timestamp_diff')
->where([
@@ -170,26 +170,26 @@ class NoteModel extends UuidModel
}
/**
- * Retrieves all published replies for a given note. By default, it does not get replies from blocked actors.
+ * Retrieves all published replies for a given status. By default, it does not get replies from blocked actors.
*
- * @return Note[]
+ * @return Status[]
*/
- public function getNoteReplies(string $noteId, bool $withBlocked = false): array
+ public function getStatusReplies(string $statusId, bool $withBlocked = false): array
{
$cacheName =
config('ActivityPub')
->cachePrefix .
- "note#{$noteId}_replies" .
+ "status#{$statusId}_replies" .
($withBlocked ? '_withBlocked' : '');
if (! ($found = cache($cacheName))) {
if (! $withBlocked) {
- $this->select('activitypub_notes.*')
- ->join('activitypub_actors', 'activitypub_actors.id = activitypub_notes.actor_id', 'inner')
+ $this->select('activitypub_statuses.*')
+ ->join('activitypub_actors', 'activitypub_actors.id = activitypub_statuses.actor_id', 'inner')
->where('activitypub_actors.is_blocked', 0);
}
- $this->where('in_reply_to_id', $this->uuid->fromString($noteId) ->getBytes())
+ $this->where('in_reply_to_id', $this->uuid->fromString($statusId) ->getBytes())
->where('`published_at` <= NOW()', null, false)
->orderBy('published_at', 'ASC');
$found = $this->findAll();
@@ -202,18 +202,18 @@ class NoteModel extends UuidModel
}
/**
- * Retrieves all published reblogs for a given note
+ * Retrieves all published reblogs for a given status
*
- * @return Note[]
+ * @return Status[]
*/
- public function getNoteReblogs(string $noteId): array
+ public function getStatusReblogs(string $statusId): array
{
$cacheName =
config('ActivityPub')
- ->cachePrefix . "note#{$noteId}_reblogs";
+ ->cachePrefix . "status#{$statusId}_reblogs";
if (! ($found = cache($cacheName))) {
- $found = $this->where('reblog_of_id', $this->uuid->fromString($noteId) ->getBytes())
+ $found = $this->where('reblog_of_id', $this->uuid->fromString($statusId) ->getBytes())
->where('`published_at` <= NOW()', null, false)
->orderBy('published_at', 'ASC')
->findAll();
@@ -225,23 +225,23 @@ class NoteModel extends UuidModel
return $found;
}
- public function addPreviewCard(string $noteId, int $previewCardId): Query | bool
+ public function addPreviewCard(string $statusId, int $previewCardId): Query | bool
{
- return $this->db->table('activitypub_notes_preview_cards')
+ return $this->db->table('activitypub_statuses_preview_cards')
->insert([
- 'note_id' => $this->uuid->fromString($noteId)
+ 'status_id' => $this->uuid->fromString($statusId)
->getBytes(),
'preview_card_id' => $previewCardId,
]);
}
/**
- * Adds note in database along preview card if relevant
+ * Adds status in database along preview card if relevant
*
- * @return string|false returns the new note id if success or false otherwise
+ * @return string|false returns the new status id if success or false otherwise
*/
- public function addNote(
- Note $note,
+ public function addStatus(
+ Status $status,
bool $createPreviewCard = true,
bool $registerActivity = true
): string | false {
@@ -249,56 +249,56 @@ class NoteModel extends UuidModel
$this->db->transStart();
- if (! ($newNoteId = $this->insert($note, true))) {
+ if (! ($newStatusId = $this->insert($status, true))) {
$this->db->transRollback();
- // Couldn't insert note
+ // Couldn't insert status
return false;
}
if ($createPreviewCard) {
// parse message
- $messageUrls = extract_urls_from_message($note->message);
+ $messageUrls = extract_urls_from_message($status->message);
if (
$messageUrls !== [] &&
($previewCard = get_or_create_preview_card_from_url(new URI($messageUrls[0]))) &&
- ! $this->addPreviewCard($newNoteId, $previewCard->id)
+ ! $this->addPreviewCard($newStatusId, $previewCard->id)
) {
$this->db->transRollback();
- // problem when linking note to preview card
+ // problem when linking status to preview card
return false;
}
}
model('ActorModel')
- ->where('id', $note->actor_id)
- ->increment('notes_count');
+ ->where('id', $status->actor_id)
+ ->increment('statuses_count');
if ($registerActivity) {
- // set note id and uri to construct NoteObject
- $note->id = $newNoteId;
- $note->uri = base_url(route_to('note', $note->actor->username, $newNoteId));
+ // set status id and uri to construct NoteObject
+ $status->id = $newStatusId;
+ $status->uri = base_url(route_to('status', $status->actor->username, $newStatusId));
$createActivity = new CreateActivity();
$noteObjectClass = config('ActivityPub')
->noteObject;
$createActivity
- ->set('actor', $note->actor->uri)
- ->set('object', new $noteObjectClass($note));
+ ->set('actor', $status->actor->uri)
+ ->set('object', new $noteObjectClass($status));
$activityId = model('ActivityModel')
->newActivity(
'Create',
- $note->actor_id,
+ $status->actor_id,
null,
- $newNoteId,
+ $newStatusId,
$createActivity->toJSON(),
- $note->published_at,
+ $status->published_at,
'queued',
);
- $createActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId)));
+ $createActivity->set('id', base_url(route_to('activity', $status->actor->username, $activityId)));
model('ActivityModel')
->update($activityId, [
@@ -306,44 +306,44 @@ class NoteModel extends UuidModel
]);
}
- Events::trigger('on_note_add', $note);
+ Events::trigger('on_status_add', $status);
- $this->clearCache($note);
+ $this->clearCache($status);
$this->db->transComplete();
- return $newNoteId;
+ return $newStatusId;
}
- public function editNote(Note $updatedNote): bool
+ public function editStatus(Status $updatedStatus): bool
{
$this->db->transStart();
- // update note create activity schedule in database
+ // update status create activity schedule in database
$scheduledActivity = model('ActivityModel')
->where([
'type' => 'Create',
- 'note_id' => $this->uuid
- ->fromString($updatedNote->id)
+ 'status_id' => $this->uuid
+ ->fromString($updatedStatus->id)
->getBytes(),
])
->first();
// update published date in payload
$newPayload = $scheduledActivity->payload;
- $newPayload->object->published = $updatedNote->published_at->format(DATE_W3C);
+ $newPayload->object->published = $updatedStatus->published_at->format(DATE_W3C);
model('ActivityModel')
->update($scheduledActivity->id, [
'payload' => json_encode($newPayload, JSON_THROW_ON_ERROR),
- 'scheduled_at' => $updatedNote->published_at,
+ 'scheduled_at' => $updatedStatus->published_at,
]);
- // update note
- $updateResult = $this->update($updatedNote->id, $updatedNote);
+ // update status
+ $updateResult = $this->update($updatedStatus->id, $updatedStatus);
- Events::trigger('on_note_edit', $updatedNote);
+ Events::trigger('on_status_edit', $updatedStatus);
- $this->clearCache($updatedNote);
+ $this->clearCache($updatedStatus);
$this->db->transComplete();
@@ -351,59 +351,59 @@ class NoteModel extends UuidModel
}
/**
- * Removes a note from the database and decrements meta data
+ * Removes a status from the database and decrements meta data
*/
- public function removeNote(Note $note, bool $registerActivity = true): BaseResult | bool
+ public function removeStatus(Status $status, bool $registerActivity = true): BaseResult | bool
{
$this->db->transStart();
model('ActorModel')
- ->where('id', $note->actor_id)
- ->decrement('notes_count');
+ ->where('id', $status->actor_id)
+ ->decrement('statuses_count');
- if ($note->in_reply_to_id !== null) {
- // Note to remove is a reply
- model('NoteModel')
- ->where('id', $this->uuid->fromString($note->in_reply_to_id) ->getBytes())
+ if ($status->in_reply_to_id !== null) {
+ // Status to remove is a reply
+ model('StatusModel')
+ ->where('id', $this->uuid->fromString($status->in_reply_to_id) ->getBytes())
->decrement('replies_count');
- Events::trigger('on_reply_remove', $note);
+ Events::trigger('on_reply_remove', $status);
}
- // remove all note reblogs
- foreach ($note->reblogs as $reblog) {
+ // remove all status reblogs
+ foreach ($status->reblogs as $reblog) {
// FIXME: issue when actor is not local, can't get actor information
- $this->removeNote($reblog);
+ $this->removeStatus($reblog);
}
- // remove all note replies
- foreach ($note->replies as $reply) {
- $this->removeNote($reply);
+ // remove all status replies
+ foreach ($status->replies as $reply) {
+ $this->removeStatus($reply);
}
// check that preview card is no longer used elsewhere before deleting it
if (
- $note->preview_card &&
+ $status->preview_card &&
$this->db
- ->table('activitypub_notes_preview_cards')
- ->where('preview_card_id', $note->preview_card->id)
+ ->table('activitypub_statuses_preview_cards')
+ ->where('preview_card_id', $status->preview_card->id)
->countAll() <= 1
) {
- model('PreviewCardModel')->deletePreviewCard($note->preview_card->id, $note->preview_card->url);
+ model('PreviewCardModel')->deletePreviewCard($status->preview_card->id, $status->preview_card->url);
}
if ($registerActivity) {
$deleteActivity = new DeleteActivity();
$tombstoneObject = new TombstoneObject();
- $tombstoneObject->set('id', $note->uri);
+ $tombstoneObject->set('id', $status->uri);
$deleteActivity
- ->set('actor', $note->actor->uri)
+ ->set('actor', $status->actor->uri)
->set('object', $tombstoneObject);
$activityId = model('ActivityModel')
->newActivity(
'Delete',
- $note->actor_id,
+ $status->actor_id,
null,
null,
$deleteActivity->toJSON(),
@@ -411,7 +411,7 @@ class NoteModel extends UuidModel
'queued',
);
- $deleteActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId)));
+ $deleteActivity->set('id', base_url(route_to('activity', $status->actor->username, $activityId)));
model('ActivityModel')
->update($activityId, [
@@ -419,12 +419,12 @@ class NoteModel extends UuidModel
]);
}
- $result = model('NoteModel', false)
- ->delete($note->id);
+ $result = model('StatusModel', false)
+ ->delete($status->id);
- Events::trigger('on_note_remove', $note);
+ Events::trigger('on_status_remove', $status);
- $this->clearCache($note);
+ $this->clearCache($status);
$this->db->transComplete();
@@ -432,38 +432,38 @@ class NoteModel extends UuidModel
}
public function addReply(
- Note $reply,
+ Status $reply,
bool $createPreviewCard = true,
bool $registerActivity = true
): string | false {
if (! $reply->in_reply_to_id) {
- throw new Exception('Passed note is not a reply!');
+ throw new Exception('Passed status is not a reply!');
}
$this->db->transStart();
- $noteId = $this->addNote($reply, $createPreviewCard, $registerActivity);
+ $statusId = $this->addStatus($reply, $createPreviewCard, $registerActivity);
- model('NoteModel')
+ model('StatusModel')
->where('id', $this->uuid->fromString($reply->in_reply_to_id) ->getBytes())
->increment('replies_count');
- Events::trigger('on_note_reply', $reply);
+ Events::trigger('on_status_reply', $reply);
$this->clearCache($reply);
$this->db->transComplete();
- return $noteId;
+ return $statusId;
}
- public function reblog(Actor $actor, Note $note, bool $registerActivity = true): string | false
+ public function reblog(Actor $actor, Status $status, bool $registerActivity = true): string | false
{
$this->db->transStart();
- $reblog = new Note([
+ $reblog = new Status([
'actor_id' => $actor->id,
- 'reblog_of_id' => $note->id,
+ 'reblog_of_id' => $status->id,
'published_at' => Time::now(),
]);
@@ -472,10 +472,10 @@ class NoteModel extends UuidModel
model('ActorModel')
->where('id', $actor->id)
- ->increment('notes_count');
+ ->increment('statuses_count');
- model('NoteModel')
- ->where('id', $this->uuid->fromString($note->id)->getBytes())
+ model('StatusModel')
+ ->where('id', $this->uuid->fromString($status->id)->getBytes())
->increment('reblogs_count');
if ($registerActivity) {
@@ -486,13 +486,13 @@ class NoteModel extends UuidModel
'Announce',
$actor->id,
null,
- $note->id,
+ $status->id,
$announceActivity->toJSON(),
$reblog->published_at,
'queued',
);
- $announceActivity->set('id', base_url(route_to('activity', $note->actor->username, $activityId)));
+ $announceActivity->set('id', base_url(route_to('activity', $status->actor->username, $activityId)));
model('ActivityModel')
->update($activityId, [
@@ -500,25 +500,25 @@ class NoteModel extends UuidModel
]);
}
- Events::trigger('on_note_reblog', $actor, $note);
+ Events::trigger('on_status_reblog', $actor, $status);
- $this->clearCache($note);
+ $this->clearCache($status);
$this->db->transComplete();
return $reblogId;
}
- public function undoReblog(Note $reblogNote, bool $registerActivity = true): BaseResult | bool
+ public function undoReblog(Status $reblogStatus, bool $registerActivity = true): BaseResult | bool
{
$this->db->transStart();
model('ActorModel')
- ->where('id', $reblogNote->actor_id)
- ->decrement('notes_count');
+ ->where('id', $reblogStatus->actor_id)
+ ->decrement('statuses_count');
- model('NoteModel')
- ->where('id', $this->uuid->fromString($reblogNote->reblog_of_id) ->getBytes())
+ model('StatusModel')
+ ->where('id', $this->uuid->fromString($reblogStatus->reblog_of_id) ->getBytes())
->decrement('reblogs_count');
if ($registerActivity) {
@@ -527,35 +527,35 @@ class NoteModel extends UuidModel
$activity = model('ActivityModel')
->where([
'type' => 'Announce',
- 'actor_id' => $reblogNote->actor_id,
- 'note_id' => $this->uuid
- ->fromString($reblogNote->reblog_of_id)
+ 'actor_id' => $reblogStatus->actor_id,
+ 'status_id' => $this->uuid
+ ->fromString($reblogStatus->reblog_of_id)
->getBytes(),
])
->first();
- $announceActivity = new AnnounceActivity($reblogNote);
+ $announceActivity = new AnnounceActivity($reblogStatus);
$announceActivity->set(
'id',
- base_url(route_to('activity', $reblogNote->actor->username, $activity->id)),
+ base_url(route_to('activity', $reblogStatus->actor->username, $activity->id)),
);
$undoActivity
- ->set('actor', $reblogNote->actor->uri)
+ ->set('actor', $reblogStatus->actor->uri)
->set('object', $announceActivity);
$activityId = model('ActivityModel')
->newActivity(
'Undo',
- $reblogNote->actor_id,
+ $reblogStatus->actor_id,
null,
- $reblogNote->reblog_of_id,
+ $reblogStatus->reblog_of_id,
$undoActivity->toJSON(),
Time::now(),
'queued',
);
- $undoActivity->set('id', base_url(route_to('activity', $reblogNote->actor->username, $activityId)));
+ $undoActivity->set('id', base_url(route_to('activity', $reblogStatus->actor->username, $activityId)));
model('ActivityModel')
->update($activityId, [
@@ -563,54 +563,54 @@ class NoteModel extends UuidModel
]);
}
- $result = model('NoteModel', false)
- ->delete($reblogNote->id);
+ $result = model('StatusModel', false)
+ ->delete($reblogStatus->id);
- Events::trigger('on_note_undo_reblog', $reblogNote);
+ Events::trigger('on_status_undo_reblog', $reblogStatus);
- $this->clearCache($reblogNote);
+ $this->clearCache($reblogStatus);
$this->db->transComplete();
return $result;
}
- public function toggleReblog(Actor $actor, Note $note): void
+ public function toggleReblog(Actor $actor, Status $status): void
{
if (
- ! ($reblogNote = $this->where([
+ ! ($reblogStatus = $this->where([
'actor_id' => $actor->id,
'reblog_of_id' => $this->uuid
- ->fromString($note->id)
+ ->fromString($status->id)
->getBytes(),
])->first())
) {
- $this->reblog($actor, $note);
+ $this->reblog($actor, $status);
} else {
- $this->undoReblog($reblogNote);
+ $this->undoReblog($reblogStatus);
}
}
- public function clearCache(Note $note): void
+ public function clearCache(Status $status): void
{
$cachePrefix = config('ActivityPub')
->cachePrefix;
- $hashedNoteUri = md5($note->uri);
+ $hashedStatusUri = md5($status->uri);
model('ActorModel')
- ->clearCache($note->actor);
+ ->clearCache($status->actor);
cache()
- ->deleteMatching($cachePrefix . "note#{$note->id}*");
+ ->deleteMatching($cachePrefix . "status#{$status->id}*");
cache()
- ->deleteMatching($cachePrefix . "note-{$hashedNoteUri}*");
+ ->deleteMatching($cachePrefix . "status-{$hashedStatusUri}*");
- if ($note->in_reply_to_id !== null) {
- $this->clearCache($note->reply_to_note);
+ if ($status->in_reply_to_id !== null) {
+ $this->clearCache($status->reply_to_status);
}
- if ($note->reblog_of_id !== null) {
- $this->clearCache($note->reblog_of_note);
+ if ($status->reblog_of_id !== null) {
+ $this->clearCache($status->reblog_of_status);
}
}
@@ -618,7 +618,7 @@ class NoteModel extends UuidModel
* @param array> $data
* @return array>
*/
- protected function setNoteId(array $data): array
+ protected function setStatusId(array $data): array
{
$uuid4 = $this->uuid->{$this->uuidVersion}();
$data['data']['id'] = $uuid4->toString();
@@ -627,7 +627,7 @@ class NoteModel extends UuidModel
$actor = model('ActorModel')
->getActorById((int) $data['data']['actor_id']);
- $data['data']['uri'] = base_url(route_to('note', $actor->username, $uuid4->toString()));
+ $data['data']['uri'] = base_url(route_to('status', $actor->username, $uuid4->toString()));
}
return $data;
diff --git a/app/Libraries/ActivityPub/Objects/NoteObject.php b/app/Libraries/ActivityPub/Objects/NoteObject.php
index 31e1b67b..b44d6709 100644
--- a/app/Libraries/ActivityPub/Objects/NoteObject.php
+++ b/app/Libraries/ActivityPub/Objects/NoteObject.php
@@ -15,7 +15,7 @@ declare(strict_types=1);
namespace ActivityPub\Objects;
use ActivityPub\Core\ObjectType;
-use ActivityPub\Entities\Note;
+use ActivityPub\Entities\Status;
class NoteObject extends ObjectType
{
@@ -27,20 +27,20 @@ class NoteObject extends ObjectType
protected string $replies;
- public function __construct(Note $note)
+ public function __construct(Status $status)
{
- $this->id = $note->uri;
+ $this->id = $status->uri;
- $this->content = $note->message_html;
- $this->published = $note->published_at->format(DATE_W3C);
- $this->attributedTo = $note->actor->uri;
+ $this->content = $status->message_html;
+ $this->published = $status->published_at->format(DATE_W3C);
+ $this->attributedTo = $status->actor->uri;
- if ($note->in_reply_to_id !== null) {
- $this->inReplyTo = $note->reply_to_note->uri;
+ if ($status->in_reply_to_id !== null) {
+ $this->inReplyTo = $status->reply_to_status->uri;
}
- $this->replies = base_url(route_to('note-replies', $note->actor->username, $note->id));
+ $this->replies = base_url(route_to('status-replies', $status->actor->username, $status->id));
- $this->cc = [$note->actor->followers_url];
+ $this->cc = [$status->actor->followers_url];
}
}
diff --git a/app/Libraries/NoteObject.php b/app/Libraries/NoteObject.php
index feabd9f6..b69f164a 100644
--- a/app/Libraries/NoteObject.php
+++ b/app/Libraries/NoteObject.php
@@ -11,25 +11,25 @@ declare(strict_types=1);
namespace App\Libraries;
use ActivityPub\Objects\NoteObject as ActivityPubNoteObject;
-use App\Entities\Note;
+use App\Entities\Status;
class NoteObject extends ActivityPubNoteObject
{
/**
- * @param Note $note
+ * @param Status $status
*/
- public function __construct($note)
+ public function __construct($status)
{
- parent::__construct($note);
+ parent::__construct($status);
- if ($note->episode_id) {
+ if ($status->episode_id) {
$this->content =
'' .
- $note->episode->title .
+ $status->episode->title .
'
' .
- $note->message_html;
+ $status->message_html;
}
}
}
diff --git a/app/Models/EpisodeModel.php b/app/Models/EpisodeModel.php
index 275c753f..a9cbb148 100644
--- a/app/Models/EpisodeModel.php
+++ b/app/Models/EpisodeModel.php
@@ -92,7 +92,7 @@ class EpisodeModel extends Model
'custom_rss',
'favourites_total',
'reblogs_total',
- 'notes_total',
+ 'statuses_total',
'published_at',
'created_by',
'updated_by',
diff --git a/app/Models/NoteModel.php b/app/Models/StatusModel.php
similarity index 70%
rename from app/Models/NoteModel.php
rename to app/Models/StatusModel.php
index 5e8833de..08ba7275 100644
--- a/app/Models/NoteModel.php
+++ b/app/Models/StatusModel.php
@@ -10,15 +10,15 @@ declare(strict_types=1);
namespace App\Models;
-use ActivityPub\Models\NoteModel as ActivityPubNoteModel;
-use App\Entities\Note;
+use ActivityPub\Models\StatusModel as ActivityPubStatusModel;
+use App\Entities\Status;
-class NoteModel extends ActivityPubNoteModel
+class StatusModel extends ActivityPubStatusModel
{
/**
* @var string
*/
- protected $returnType = Note::class;
+ protected $returnType = Status::class;
/**
* @var string[]
@@ -40,11 +40,11 @@ class NoteModel extends ActivityPubNoteModel
];
/**
- * Retrieves all published notes for a given episode ordered by publication date
+ * Retrieves all published statuses for a given episode ordered by publication date
*
- * @return Note[]
+ * @return Status[]
*/
- public function getEpisodeNotes(int $episodeId): array
+ public function getEpisodeStatuses(int $episodeId): array
{
return $this->where([
'episode_id' => $episodeId,
diff --git a/app/Views/_assets/styles/index.css b/app/Views/_assets/styles/index.css
index b4b795a5..185afd4f 100644
--- a/app/Views/_assets/styles/index.css
+++ b/app/Views/_assets/styles/index.css
@@ -7,7 +7,7 @@
@import "./radioBtn.css";
@import "./switch.css";
@import "./charts.css";
-@import "./note.css";
+@import "./status.css";
@import "./tabs.css";
@import "./radioToggler.css";
@import "./formInputTabs.css";
diff --git a/app/Views/_assets/styles/note.css b/app/Views/_assets/styles/status.css
similarity index 87%
rename from app/Views/_assets/styles/note.css
rename to app/Views/_assets/styles/status.css
index 510bcda2..e3d2b794 100644
--- a/app/Views/_assets/styles/note.css
+++ b/app/Views/_assets/styles/status.css
@@ -1,11 +1,11 @@
@layer components {
- .note-content {
+ .status-content {
& a {
@apply text-sm font-semibold text-pine-600 hover:underline;
}
}
- .note-replies > * {
+ .status-replies > * {
@apply relative;
& img {
diff --git a/app/Views/admin/episode/publish.php b/app/Views/admin/episode/publish.php
index d6664bbe..d612d903 100644
--- a/app/Views/admin/episode/publish.php
+++ b/app/Views/admin/episode/publish.php
@@ -20,8 +20,8 @@
+ 'Episode.publish_form.status',
+) . hint_tooltip(lang('Episode.publish_form.status_hint'), 'ml-1') ?>
![<?= $podcast
diff --git a/app/Views/admin/episode/publish_edit.php b/app/Views/admin/episode/publish_edit.php
index e98959f1..9c23551d 100644
--- a/app/Views/admin/episode/publish_edit.php
+++ b/app/Views/admin/episode/publish_edit.php
@@ -17,12 +17,12 @@
]) ?>
<?= csrf_field() ?>
<?= form_hidden('client_timezone', 'UTC') ?>
-<?= form_hidden('note_id', $note->id) ?>
+<?= form_hidden('status_id', $status->id) ?>
<label for=](<?= $podcast->actor->avatar_image_url ?>)
= lang(
- 'Episode.publish_form.note',
-) . hint_tooltip(lang('Episode.publish_form.note_hint'), 'ml-1') ?>
+ 'Episode.publish_form.status',
+) . hint_tooltip(lang('Episode.publish_form.status_hint'), 'ml-1') ?>

@= $podcast
->actor->username ?>
-
@@ -51,7 +51,7 @@
'required' => 'required',
'placeholder' => 'Write your message...',
],
- old('message', $note->message, false),
+ old('message', $status->message, false),
['rows' => 2],
) ?>
diff --git a/app/Views/podcast/_partials/header.php b/app/Views/podcast/_partials/header.php
index 38e46073..1c15b4ad 100644
--- a/app/Views/podcast/_partials/header.php
+++ b/app/Views/podcast/_partials/header.php
@@ -50,8 +50,8 @@
= lang('Podcast.notes', [
- 'numberOfNotes' => $podcast->actor->notes_count,
+ ) ?>" class="hover:underline">= lang('Podcast.statuses', [
+ 'numberOfStatuses' => $podcast->actor->statuses_count,
]) ?>
diff --git a/app/Views/podcast/_partials/note.php b/app/Views/podcast/_partials/note.php
deleted file mode 100644
index 5111dd1e..00000000
--- a/app/Views/podcast/_partials/note.php
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
- = $note->message_html ?>
- episode_id): ?>
- = view('podcast/_partials/episode_card', [
- 'episode' => $note->episode,
- ]) ?>
- has_preview_card): ?>
- = view('podcast/_partials/preview_card', [
- 'preview_card' => $note->preview_card,
- ]) ?>
-
- = $this->include('podcast/_partials/note_actions') ?>
-
diff --git a/app/Views/podcast/_partials/note_actions.php b/app/Views/podcast/_partials/note_actions.php
deleted file mode 100644
index ab2f9bf3..00000000
--- a/app/Views/podcast/_partials/note_actions.php
+++ /dev/null
@@ -1,36 +0,0 @@
-
diff --git a/app/Views/podcast/_partials/note_authenticated.php b/app/Views/podcast/_partials/note_authenticated.php
deleted file mode 100644
index 14973c7e..00000000
--- a/app/Views/podcast/_partials/note_authenticated.php
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
- = $note->message_html ?>
- episode_id): ?>
- = view('podcast/_partials/episode_card', [
- 'episode' => $note->episode,
- ]) ?>
- has_preview_card): ?>
- = view('podcast/_partials/preview_card', [
- 'preview_card' => $note->preview_card,
- ]) ?>
-
- = $this->include('podcast/_partials/note_actions_authenticated') ?>
-
diff --git a/app/Views/podcast/_partials/reblog.php b/app/Views/podcast/_partials/reblog.php
index 65d6d9c1..8b192bb9 100644
--- a/app/Views/podcast/_partials/reblog.php
+++ b/app/Views/podcast/_partials/reblog.php
@@ -3,45 +3,45 @@
'repeat',
'text-lg mr-2 text-gray-400',
) .
- lang('Note.actor_shared', [
- 'actor' => $note->actor->display_name,
+ lang('Status.actor_shared', [
+ 'actor' => $status->actor->display_name,
]) ?>
-
+
- = $note->message_html ?>
- episode_id): ?>
+ = $status->message_html ?>
+ episode_id): ?>
= view('podcast/_partials/episode_card', [
- 'episode' => $note->episode,
+ 'episode' => $status->episode,
]) ?>
- has_preview_card): ?>
+ has_preview_card): ?>
= view('podcast/_partials/preview_card', [
- 'preview_card' => $note->preview_card,
+ 'preview_card' => $status->preview_card,
]) ?>
- = $this->include('podcast/_partials/note_actions') ?>
+ = $this->include('podcast/_partials/status_actions') ?>
diff --git a/app/Views/podcast/_partials/reblog_authenticated.php b/app/Views/podcast/_partials/reblog_authenticated.php
index 80c2431e..d3bd79eb 100644
--- a/app/Views/podcast/_partials/reblog_authenticated.php
+++ b/app/Views/podcast/_partials/reblog_authenticated.php
@@ -3,45 +3,45 @@
'repeat',
'text-lg mr-2 text-gray-400',
) .
- lang('Note.actor_shared', [
- 'actor' => $note->actor->display_name,
+ lang('Status.actor_shared', [
+ 'actor' => $status->actor->display_name,
]) ?>
-
+
- = $note->message_html ?>
- episode_id): ?>
+ = $status->message_html ?>
+ episode_id): ?>
= view('podcast/_partials/episode_card', [
- 'episode' => $note->episode,
+ 'episode' => $status->episode,
]) ?>
- has_preview_card): ?>
+ has_preview_card): ?>
= view('podcast/_partials/preview_card', [
- 'preview_card' => $note->preview_card,
+ 'preview_card' => $status->preview_card,
]) ?>
- = $this->include('podcast/_partials/note_actions_authenticated') ?>
+ = $this->include('podcast/_partials/status_actions_authenticated') ?>
diff --git a/app/Views/podcast/_partials/reply.php b/app/Views/podcast/_partials/reply.php
index 8476bfd4..8fb48bf8 100644
--- a/app/Views/podcast/_partials/reply.php
+++ b/app/Views/podcast/_partials/reply.php
@@ -18,7 +18,7 @@
title="= $reply->published_at ?>"
>= lang('Common.mediumDate', [$reply->published_at]) ?>
- = $reply->message_html ?>
+ = $reply->message_html ?>
has_preview_card): ?>
= view('podcast/_partials/preview_card', [
'preview_card' => $reply->preview_card,
diff --git a/app/Views/podcast/_partials/reply_actions.php b/app/Views/podcast/_partials/reply_actions.php
index 572637d7..7e694143 100644
--- a/app/Views/podcast/_partials/reply_actions.php
+++ b/app/Views/podcast/_partials/reply_actions.php
@@ -1,34 +1,34 @@