-
Notifications
You must be signed in to change notification settings - Fork 215
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
Fix #1336 missing and invalid properties in rich text block elements #1337
Conversation
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.
comments for reviewers
private final String type = TYPE; | ||
private String url; | ||
private String text; | ||
private Boolean unsafe; |
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.
This is also missing
private String format; | ||
private TextStyle style; | ||
private String url; | ||
private String fallback; |
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.
Added this missing property too
public static final String TYPE = "date"; | ||
private final String type = TYPE; | ||
private String timestamp; | ||
private String format; |
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.
Added this missing property too
@@ -42,7 +69,7 @@ public static class Channel implements RichTextElement { | |||
public static final String TYPE = "channel"; | |||
private final String type = TYPE; | |||
private String channelId; // C12345678 | |||
private TextStyle style; | |||
private NoCodeTextStyle style; |
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.
channel, user, usergroup, team, broadcast, color do not accept code property
@@ -146,7 +150,23 @@ public static class TextStyle { | |||
private boolean bold; | |||
private boolean italic; | |||
private boolean strike; | |||
private boolean highlight; |
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.
these are not mentioned in the documents but actually these properties work for all elements
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.
🤔 this makes sense, from what I was able to find there are currently only 2 versions of these style objects
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class NoCodeTextStyle { |
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.
Added this for the ones that do not accept code
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.
It seems like this object may be referenced as limited_style
, what do you think about naming this LimitedTextStyle
?
public static class NoCodeTextStyle { | |
public static class LimitedTextStyle { |
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.
Sounds good. Renamed it.
@Test | ||
public void parseRichTextElements() { | ||
String json = "{\n" + | ||
" \"blocks\": [\n" + |
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.
Used this JSON data in Block Kit Builder for verifying
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1337 +/- ##
============================================
+ Coverage 74.77% 74.81% +0.03%
- Complexity 4177 4181 +4
============================================
Files 451 451
Lines 12930 12930
Branches 1331 1331
============================================
+ Hits 9668 9673 +5
+ Misses 2487 2483 -4
+ Partials 775 774 -1 ☔ View full report in Codecov by Sentry. |
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.
Great catches 💯
Left one comment worth addressing but it is none-blocking
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class NoCodeTextStyle { |
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.
It seems like this object may be referenced as limited_style
, what do you think about naming this LimitedTextStyle
?
public static class NoCodeTextStyle { | |
public static class LimitedTextStyle { |
@@ -146,7 +150,23 @@ public static class TextStyle { | |||
private boolean bold; | |||
private boolean italic; | |||
private boolean strike; | |||
private boolean highlight; |
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.
🤔 this makes sense, from what I was able to find there are currently only 2 versions of these style objects
This pull request resolves #1336
Category (place an
x
in each of the[ ]
)Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.