-
Notifications
You must be signed in to change notification settings - Fork 904
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
Inline tipping media data is now generalized #2723
Conversation
55268e1
to
23beae3
Compare
23beae3
to
bb17c03
Compare
Blocked on #2665 |
cdb70b6
to
a700b92
Compare
eaa3a4f
to
93fc6aa
Compare
63a5593
to
c2d86dd
Compare
"userId": { | ||
"type": "string", | ||
"description": "User ID of tweet author" | ||
}, | ||
"name": { | ||
"twitterName": { | ||
"type": "string", | ||
"description": "Name of tweet author" |
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.
Does this description need an update as well?
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.
I don't think so. This is still going to a twitter designated function.
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.
I see, I misread that diff!
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.
LGTM
@jasonrsadler is it possible to merge |
@@ -79,7 +79,8 @@ chrome.runtime.onConnect.addListener(function () { | |||
}) | |||
}) | |||
|
|||
const tipTwitterUser = (tweetMetaData: RewardsTip.TweetMetaData) => { | |||
const tipTwitterMedia = (mediaMetaData: RewardsTip.MediaMetaData) => { |
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.
can we merge tipTwitterMedia
and tipTwitterMedia
?
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.
see comment
getTipBanner = (url: string, publisher: RewardsTip.Publisher, tweetMetaData?: RewardsTip.TweetMetaData, redditMetaData?: RewardsTip.RedditMetaData) => { | ||
if (tweetMetaData) { | ||
getTipBanner = (url: string, publisher: RewardsTip.Publisher, mediaMetaData: RewardsTip.MediaMetaData | undefined) => { | ||
if (mediaMetaData && mediaMetaData.mediaType === 'twitter') { | ||
return ( | ||
<TipTwitterUser |
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.
Do we need separate components for TipTwitterUser
and TipRedditUser
?
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.
No. Fixed.
return | ||
} | ||
|
||
if (!this.props.mediaMetaData || |
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 check is not needed as you check at the top already
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.
removed
if (!this.props.tweetMetaData || | ||
!this.props.tweetMetaData.tweetText || | ||
this.props.tweetMetaData.tweetText.length === 0) { | ||
if (!this.props.mediaMetaData || this.props.mediaMetaData.mediaType !== 'twitter') { |
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.
could we save this.props.mediaMetaData
into mediaMetaData
so that it's cleaner
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.
done
if (!this.props.redditMetaData || | ||
!this.props.redditMetaData.postText || | ||
this.props.redditMetaData.postText.length === 0) { | ||
if (!this.props.mediaMetaData || this.props.mediaMetaData.mediaType !== 'reddit') { |
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.
same comments as for twitter text
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.
done
@@ -210,9 +216,9 @@ class Banner extends React.Component<Props, State> { | |||
addFundsLink={this.addFundsLink} | |||
> | |||
{ | |||
this.props.tweetMetaData | |||
this.props.mediaMetaData && this.props.mediaMetaData.mediaType === 'twitter' |
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.
let's check first for !this.props.mediaMetaData
so that we don't need to check for every platform
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.
done
redditMetaData && | ||
redditMetaData.postText && | ||
redditMetaData.postText.length > 0 | ||
mediaMetaData && |
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 should be on line 40
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.
file is removed
I attempted to on the first implementation but in the background.ts portion that gets |
720bd26
to
8437a56
Compare
|
||
if (mediaMetaData.mediaType === 'twitter') { | ||
const key = | ||
mediaMetaData && |
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.
Since this is inside a conditional for mediaMetaData
can we remove this check?
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.
removed
publisher.title = getLocale(key, { user: mediaMetaData.screenName }) | ||
} else if (mediaMetaData.mediaType === 'reddit') { | ||
const key = | ||
mediaMetaData && |
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.
same as above
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.
removed
8437a56
to
8ab359e
Compare
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.
LGTM
Fixes brave/brave-browser#4907
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
Follow test plan at #2665 and #2195
Reviewer Checklist:
After-merge Checklist:
changes has landed on.