-
Notifications
You must be signed in to change notification settings - Fork 398
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
Expose whether a version is soft or hard-blocked in the blocked page #13285
Changes from all commits
99a0d52
76f49a0
4b19ec5
0392b31
c575f51
e273341
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -83,52 +83,26 @@ export class BlockBase extends React.Component<InternalProps> { | |||||
); | ||||||
} | ||||||
|
||||||
renderDateAndURL(): React.Node | Array<React.Node | string> { | ||||||
renderURL(): React.Node | Array<React.Node | string> { | ||||||
const { block, i18n } = this.props; | ||||||
|
||||||
if (!block) { | ||||||
return <LoadingText />; | ||||||
} | ||||||
|
||||||
const content: Array<React.Node | string> = [ | ||||||
i18n.sprintf(i18n.gettext('Blocked on %(date)s.'), { | ||||||
date: i18n.moment(block.created).format('ll'), | ||||||
}), | ||||||
]; | ||||||
|
||||||
if (block.url) { | ||||||
content.push( | ||||||
' ', | ||||||
return ( | ||||||
<a key={block.url.url} href={block.url.outgoing} title={block.url.url}> | ||||||
{i18n.gettext('View block request')} | ||||||
</a>, | ||||||
'.', | ||||||
</a> | ||||||
); | ||||||
} | ||||||
|
||||||
return content; | ||||||
} | ||||||
|
||||||
renderVersions(): React.Node | string { | ||||||
const { block, i18n } = this.props; | ||||||
|
||||||
if (!block) { | ||||||
return <LoadingText />; | ||||||
} | ||||||
|
||||||
if (block.is_all_versions) { | ||||||
return i18n.gettext('Versions blocked: all versions.'); | ||||||
} | ||||||
|
||||||
const versions = block.versions.join(', '); | ||||||
|
||||||
return i18n.sprintf(i18n.gettext('Versions blocked: %(versions)s.'), { | ||||||
versions, | ||||||
}); | ||||||
return null; | ||||||
} | ||||||
|
||||||
render(): React.Node { | ||||||
const { block, errorHandler, i18n } = this.props; | ||||||
const { block, errorHandler, i18n, match } = this.props; | ||||||
|
||||||
if (errorHandler.hasError()) { | ||||||
log.warn(`Captured API Error: ${errorHandler.capturedError.messages}`); | ||||||
|
@@ -140,15 +114,40 @@ export class BlockBase extends React.Component<InternalProps> { | |||||
return <ServerErrorPage />; | ||||||
} | ||||||
|
||||||
const title = | ||||||
block && block.name | ||||||
? i18n.sprintf( | ||||||
i18n.gettext(`%(addonName)s has been blocked for your protection.`), | ||||||
{ | ||||||
addonName: block.name, | ||||||
}, | ||||||
) | ||||||
: i18n.gettext(`This add-on has been blocked for your protection.`); | ||||||
const isSoftBlocked = | ||||||
block?.soft_blocked.length && | ||||||
(block?.soft_blocked.includes(match.params.versionId) || | ||||||
!block?.blocked.length); | ||||||
let title; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we expose There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We specifically dropped the "Versions blocked" text partly because it could be confusing, I fear this could have similar issues: if you show the version number alone, it doesn't say anything about the other versions, and that could be misleading ? I've asked in the Add-ons UX slack channel though, and I'll file and implement a follow-up if we decide we want the version in the title/headline. |
||||||
if (isSoftBlocked) { | ||||||
title = | ||||||
block && block.name | ||||||
? i18n.sprintf( | ||||||
i18n.gettext( | ||||||
`%(addonName)s is restricted for violating Mozilla policies.`, | ||||||
), | ||||||
{ | ||||||
addonName: block.name, | ||||||
}, | ||||||
) | ||||||
: i18n.gettext( | ||||||
`This add-on is restricted for violating Mozilla policies.`, | ||||||
); | ||||||
} else { | ||||||
title = | ||||||
block && block.name | ||||||
? i18n.sprintf( | ||||||
i18n.gettext( | ||||||
`%(addonName)s is blocked for violating Mozilla policies.`, | ||||||
), | ||||||
{ | ||||||
addonName: block.name, | ||||||
}, | ||||||
) | ||||||
: i18n.gettext( | ||||||
`This add-on is blocked for violating Mozilla policies.`, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The title doesn't appear to have a period at the end in the spec. |
||||||
); | ||||||
} | ||||||
|
||||||
return ( | ||||||
<Page> | ||||||
|
@@ -159,13 +158,13 @@ export class BlockBase extends React.Component<InternalProps> { | |||||
</Helmet> | ||||||
|
||||||
<Card className="Block-content" header={title}> | ||||||
<h2>{i18n.gettext('Why was it blocked?')}</h2> | ||||||
<h2>{i18n.gettext('Why did this happen?')}</h2> | ||||||
<p | ||||||
// eslint-disable-next-line react/no-danger | ||||||
dangerouslySetInnerHTML={sanitizeHTML( | ||||||
i18n.sprintf( | ||||||
i18n.gettext(`This add-on violates %(startLink)sMozilla's | ||||||
Add-on Policies%(endLink)s.`), | ||||||
i18n.gettext(`This extension, theme, or plugin violates | ||||||
%(startLink)sMozilla's Add-on Policies%(endLink)s.`), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
{ | ||||||
startLink: `<a href="${POLICIES_URL}">`, | ||||||
endLink: '</a>', | ||||||
|
@@ -178,8 +177,16 @@ export class BlockBase extends React.Component<InternalProps> { | |||||
|
||||||
<h2>{i18n.gettext('What does this mean?')}</h2> | ||||||
<p> | ||||||
{i18n.gettext(`The problematic add-on or plugin will be | ||||||
automatically disabled and no longer usable.`)} | ||||||
{isSoftBlocked | ||||||
? i18n.gettext(`Until the violation is resolved, this add-on | ||||||
won't be available for download from addons.mozilla.org. | ||||||
If it’s already installed, it will be disabled and users | ||||||
will be informed about the violation. They may choose to | ||||||
enable the add-on again at their own risk.`) | ||||||
: i18n.gettext(`Until the violation is resolved, this add-on | ||||||
won't be available for download from addons.mozilla.org. | ||||||
It will be automatically disabled and no longer usable in | ||||||
Firefox.`)} | ||||||
</p> | ||||||
<p | ||||||
// eslint-disable-next-line react/no-danger | ||||||
|
@@ -189,9 +196,10 @@ export class BlockBase extends React.Component<InternalProps> { | |||||
or other third-party software that seriously compromises | ||||||
Firefox security, stability, or performance and meets | ||||||
%(criteriaStartLink)scertain criteria%(criteriaEndLink)s, | ||||||
the software may be blocked from general use. For more | ||||||
information, please read %(supportStartLink)sthis support | ||||||
article%(supportEndLink)s.`), | ||||||
the software may be blocked or restricted from general | ||||||
use. For more information, please read | ||||||
%(supportStartLink)sthis support article%(supportEndLink)s. | ||||||
`), | ||||||
{ | ||||||
criteriaStartLink: `<a href="${CRITERIA_URL}">`, | ||||||
criteriaEndLink: '</a>', | ||||||
|
@@ -202,11 +210,7 @@ export class BlockBase extends React.Component<InternalProps> { | |||||
['a'], | ||||||
)} | ||||||
/> | ||||||
<p className="Block-metadata"> | ||||||
{this.renderVersions()} | ||||||
<br /> | ||||||
{this.renderDateAndURL()} | ||||||
</p> | ||||||
<p className="Block-metadata">{this.renderURL()}</p> | ||||||
</Card> | ||||||
</div> | ||||||
</Page> | ||||||
|
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 a selector (e.g.
isSoftBlocked(guid, versionId)
defined in the reducer file) or at least computed inmapStateToProps
IMO.