Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Notifier] [BlueSky] Change the value returned as the message ID #59742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected function doSend(MessageInterface $message): SentMessage
if (200 === $statusCode) {
$content = $response->toArray();
$sentMessage = new SentMessage($message, (string) $this);
$sentMessage->setMessageId($content['cid']);
$sentMessage->setMessageId($content['uri']);

return $sentMessage;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
---

* Add option to attach a media
* [BC Break] Change the returned message ID from record's 'cid' to 'uri'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be reverted as changelogs are auto-updated for bugfixes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the main CHANGELOG. Here, we want to signify something unusual, I think it's fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine for me as well, but I think it's worth noticing that we had similar discussions in the past and the conclusion was it's either a bugfix or a BC break, not both.


7.1
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,11 @@ public function testParseFacetsUrlWithTrickyRegex()

public function testWithMedia()
{
$transport = $this->createTransport(new MockHttpClient((function () {
// realistic sample values taken from https://docs.bsky.app/docs/advanced-guides/posts#post-record-structure
$recordUri = 'at://did:plc:u5cwb2mwiv2bfq53cjufe6yn/app.bsky.feed.post/3k4duaz5vfs2b';
$recordCid = 'bafyreibjifzpqj6o6wcq3hejh7y4z4z2vmiklkvykc57tw3pcbx3kxifpm';

$transport = $this->createTransport(new MockHttpClient((function () use ($recordUri, $recordCid) {
yield function (string $method, string $url, array $options) {
$this->assertSame('POST', $method);
$this->assertSame('https://bsky.social/xrpc/com.atproto.server.createSession', $url);
Expand All @@ -299,21 +303,40 @@ public function testWithMedia()
]]);
};

yield function (string $method, string $url, array $options) {
yield function (string $method, string $url, array $options) use ($recordUri, $recordCid) {
$this->assertSame('POST', $method);
$this->assertSame('https://bsky.social/xrpc/com.atproto.repo.createRecord', $url);
$this->assertArrayHasKey('authorization', $options['normalized_headers']);
$this->assertSame('{"repo":null,"collection":"app.bsky.feed.post","record":{"$type":"app.bsky.feed.post","text":"Hello World!","createdAt":"2024-04-28T08:40:17.000000Z","embed":{"$type":"app.bsky.embed.images","images":[{"alt":"A fixture","image":{"$type":"blob","ref":{"$link":"bafkreibabalobzn6cd366ukcsjycp4yymjymgfxcv6xczmlgpemzkz3cfa"},"mimeType":"image\/png","size":760898}}]}}}', $options['body']);

return new JsonMockResponse(['cid' => '103254962155278888']);
return new JsonMockResponse(['uri' => $recordUri, 'cid' => $recordCid]);
};
})()));

$options = (new BlueskyOptions())
->attachMedia(new File(__DIR__.'/fixtures.gif'), 'A fixture');
$result = $transport->send(new ChatMessage('Hello World!', $options));

$this->assertSame('103254962155278888', $result->getMessageId());
$this->assertSame($recordUri, $result->getMessageId());
}

public function testReturnedMessageId()
{
// realistic sample values taken from https://docs.bsky.app/docs/advanced-guides/posts#post-record-structure
$recordUri = 'at://did:plc:u5cwb2mwiv2bfq53cjufe6yn/app.bsky.feed.post/3k4duaz5vfs2b';
$recordCid = 'bafyreibjifzpqj6o6wcq3hejh7y4z4z2vmiklkvykc57tw3pcbx3kxifpm';

$client = new MockHttpClient(function () use ($recordUri, $recordCid) {
return new JsonMockResponse([
'uri' => $recordUri,
'cid' => $recordCid,
]);
});

$transport = self::createTransport($client);
$message = $transport->send(new ChatMessage('Hello!'));

$this->assertSame($recordUri, $message->getMessageId());
}

/**
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.