Skip to content

Commit

Permalink
Merge pull request #719 from TheRestartProject/RES-1970_retry_discour…
Browse files Browse the repository at this point in the history
…se_thread_creation

RES-1970 Discourse private message creation is broken
  • Loading branch information
edwh committed Jan 29, 2024
2 parents 8d22ed5 + 48ff1d0 commit f9665b9
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
53 changes: 53 additions & 0 deletions app/Console/Commands/DiscourseCreateThread.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace App\Console\Commands;

use App\Events\ApproveEvent;
use App\Group;
use App\Helpers\Geocoder;
use App\Listeners\CreateDiscourseThreadForEvent;
use App\Party;
use App\Services\DiscourseService;
use Illuminate\Console\Command;
use Riverline\MultiPartParser\Part;

class DiscourseCreateThread extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'discourse:create:thread {partyid}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Retry creating a Discourse thread for a party';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct(DiscourseService $discourseService)
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle(DiscourseService $discourseService)
{
$id = $this->argument('partyid');

$party = Party::findOrFail($id);
$event = new ApproveEvent($party);
(new CreateDiscourseThreadForEvent())->handle($event);
}
}
2 changes: 1 addition & 1 deletion app/Listeners/CreateDiscourseThreadForEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function handle(ApproveEvent $event)
$params = [
'raw' => $intro,
'title' => $theParty->venue.' '.$theParty->event_date_local,
'target_usernames' => $host->username,
'target_recipients' => $host->username,
'archetype' => 'private_message',
];

Expand Down

0 comments on commit f9665b9

Please sign in to comment.