Skip to content

Commit

Permalink
🚑 use correct method for mastodon posting (#2353)
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrLevin authored Feb 11, 2024
1 parent 59dae4d commit 539251c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/Backend/Helper/StatusHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct(Status $status, bool $mastodon = false) {
$this->mastodon = $mastodon;
}

public static function getSocialText(Status $status): string {
$self = new self($status);
public static function getSocialText(Status $status, bool $mastodon = false): string {
$self = new self($status, $mastodon);
return $self->generateSocialText();
}

Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/Backend/Social/MastodonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ public static function postStatus(Status $status, bool $shouldPostAsChain = fals
}

try {
$statusText = (new StatusHelper($status, true))->getMastodonBody();
$statusText .= ' ' . url("/status/{$status->id}");
$statusText = StatusHelper::getSocialText($status, true);
$mastodonDomain = MastodonServer::find($status->user->socialProfile->mastodon_server)->domain;
Mastodon::domain($mastodonDomain)->token($status->user->socialProfile->mastodon_token);

Expand Down
4 changes: 4 additions & 0 deletions app/Http/Controllers/Backend/Support/MentionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public static function getBodyWithMentionLinks(Status $status): string {

public static function getMastodonStatus(Status $status): string {
$body = $status->body;
if (empty($body)) {
return '';
}

$replaced = [];
$mentions = $status->mentions;
foreach ($mentions as $mention) {
Expand Down

0 comments on commit 539251c

Please sign in to comment.