Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Notifier] [Discord] Fix exception message + test#39444

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@OskarStark
Copy link
Contributor

QA
Branch?5.2
Bug fix?yes
New feature?no
Deprecations?no
Tickets---
LicenseMIT
Doc PR---

Before this PR the message was wrong, "less than 2000" is not correct, it can have 2000 chars, but not more.

@carsonbotcarsonbot added this to the5.2 milestoneDec 11, 2020
@carsonbotcarsonbot changed the title[Notifier][Discord] Fix exception message + test[Notifier] [Discord] Fix exception message + testDec 11, 2020

if (\strlen($content) >2000) {
thrownewLogicException(sprintf('The subject length of"%s" transportmustbe less than2000 characters.',__CLASS__));
thrownewLogicException('The subject length ofa Discord messagemustnot exceed2000 characters.');
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I am wondering if this should be an InvalidArgumentException 🧐

Copy link
Member

Choose a reason for hiding this comment

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

LengthException could be a good fit.
That's for 5.x anyway I suppose :)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

The fix itself is for 5.2, but we can use LengthException in 5.x, what do you think?

chalasr reacted with thumbs up emoji

Choose a reason for hiding this comment

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

PR welcome now that it's merged.

OskarStark reacted with thumbs up emoji

$content =$message->getSubject();

if (\strlen($content) >2000) {

Choose a reason for hiding this comment

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

maybe time to move this to a private const?
also, we should consider using mb_strlen maybe? that'd require first checking if 2000UTF-8 chars are fine
last but not least, seehttps://support.discord.com/hc/en-us/community/posts/360031093812:

29/10/2020 edit: it's been kinda fixed. Now, if you type over the char limit discord will send the message as a TXT file. Not ideal but it's something.

this is worth a small investigation if anyone is up to trying with an actual Discord server

Choose a reason for hiding this comment

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

@nicolas-grekas
Copy link
Member

Thank you@OskarStark.

@nicolas-grekasnicolas-grekas merged commit25f79ab intosymfony:5.2Dec 14, 2020
@OskarStarkOskarStark deleted the discord-length-message-5.2 branchDecember 14, 2020 11:15
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@fabpotfabpotfabpot approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

5.2

Development

Successfully merging this pull request may close these issues.

5 participants

@OskarStark@nicolas-grekas@fabpot@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp