-
Notifications
You must be signed in to change notification settings - Fork 153
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
Show a preview of long messages on IRC #529
Conversation
05e9552
to
51d82de
Compare
How does this handle pure code blocks? Edit: to elaborate, a message containing only a code block (starting and ending with |
51d82de
to
b50589f
Compare
This will need rebasing onto the current develop because we dropped node 4 :(. Also, unit tests on the behavior would be good. |
b50589f
to
9de711a
Compare
Thanking you, will review. |
@@ -133,6 +133,56 @@ function Client(addr, nick, opts) { | |||
return this.chans[channel]; | |||
} | |||
|
|||
// Copied over from irc.js and modified slightly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a huge fan of this, but it looks like the IRC lib for some reason contains code that really aught to be split out. I'll allow it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, crazy idea. Could we put these two functions in a new class in util/MessageFormatting.js or something rather than using the unsafeClient version. I think it would be better than reimplementing them in a mock.
msgtype: "m.text", | ||
body: messagePreview + truncatedMsg | ||
}; | ||
} | ||
} | ||
else { | ||
req.log.warn("Sending truncated message"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small complaint: This should probably be info rather than warn. I know you didn't write the code, but it's just annoying me 😆
I think this is looking very promising, if we fix these up I'll take another look and hopefully merge :) |
Since our move to Typescript, this PR will no longer cleanly merge into the codebase. I'm going to close this rather than request changes. Feel free to re-open the PR if you want to continue to work on it. |
Bringing this back in #1430 since it's still an annoying issue for IRC users. Thanks for contributing it, @14mRh4X0r! |
This gives users on the IRC side an idea what the long message is about, without flooding the channel with text. This solves an issue some people have where IRC users aren't willing to click to content they can't see, and is more in line with other services.