Skip to content

Commit

Permalink
Add unauthorized download state
Browse files Browse the repository at this point in the history
When a user downloads a file to a location that they do not have access to, it currently just says "Downloading... 0%". This is to add a download state to indicate that the user doesn't have access to the director they are trying to download into.

Commit list:
- Add new download state
- Update state if directory is unauthorized
- Update electron download state change
- Add 'Unauthorized' download state to 'clear completed downloads' reducer
- Add isUnauthorized getter
- Add unauthorized state as part of condition for hiding progress display
- Add isUnauthorized to condition for rendering a download item
- Set unauthorized as a stop condition for downloads
- Set getL10nId for unauthorized downloads
- Add 'unauthorized' as a style class for finished download items
- Add downloadUnauthorized locale id for all languages

TODO: Update localization for all languages for this state

Fixes brave#7747

Update test

Return 0% when download totalBytes is 0 or undefined

Fix brave#10264

Updated code to handle falsey inputs + added more unit tests :)

Auditors: @diracdeltas

Test Plan:
`npm run unittest -- --grep="downloadUtil"`

Move properties inside main.less to window.less

Closes brave#10860

Auditors:

Test Plan:
1. npm run watch
2. npm start
3. Make sure the browser starts
4. Open the devtool and make sure the two properties are applied

Converted Country Textbox to Select Dropdown

Creating a dropdown for the country list in the about:autofill panel

Fix brave#9053

Small cleanup for autofill country list  per discussion in PR

Auditors: @dfperry5

Fix two issues
- handle when locale is called with null/undefined/falsey value (before would fail on toLowerCase())
- handle situation where activeTab is not set and developer tools are opened (will be fixed soon by @bbondy)

Auditors: @bbondy, @dfperry5

Issue brave#9053 - Updating so that first option on dropdown for countries is a blank

	modified:   app/renderer/components/autofill/autofillAddressPanel.js

	modified:   app/renderer/components/autofill/autofillAddressPanel.js

	modified:   app/renderer/components/autofill/autofillAddressPanel.js

	modified:   app/renderer/components/autofill/autofillAddressPanel.js

Add 'CommonFormFullWidthDropdown' to commonForm.js

Auditors: @cezaraugusto

Test Plan:
1. Open about:autofill
2. Click 'Add Address'

Update autofill webdriver tests to use Country as a dropdown value instead of a text field

Auditors: @dfperry5, @darkdh, @luixxiul

Test Plan: `npm run test -- --grep="Autofill"

Style Edits
Auditors:

Test Plan:
  • Loading branch information
syuan100 committed Sep 10, 2017
1 parent c5b854d commit b531e2e
Show file tree
Hide file tree
Showing 52 changed files with 718 additions and 50 deletions.
2 changes: 1 addition & 1 deletion app/browser/electronDownloadItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const progressDownloadItems = () => {
}

module.exports.updateElectronDownloadItem = (win, downloadId, item, state) => {
if (state === downloadStates.INTERRUPTED || state === downloadStates.CANCELLED || state === downloadStates.COMPLETED) {
if (state === downloadStates.INTERRUPTED || state === downloadStates.CANCELLED || state === downloadStates.UNAUTHORIZED || state === downloadStates.COMPLETED) {
if (app.dock && state === downloadStates.COMPLETED) {
app.dock.downloadFinished(item.getSavePath())
}
Expand Down
6 changes: 5 additions & 1 deletion app/browser/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,11 @@ const createViewSubmenu = () => {
click: function () {
const win = BrowserWindow.getActiveWindow()
const activeTab = tabState.getActiveTab(appStore.getState(), win.id)
appActions.toggleDevTools(activeTab.get('tabId'))
if (activeTab) {
appActions.toggleDevTools(activeTab.get('tabId'))
} else {
console.warn('Unable to open developer tools; activeTab is null or undefined')
}
}
},
CommonMenu.separatorMenuItem,
Expand Down
2 changes: 1 addition & 1 deletion app/browser/reducers/downloadsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const downloadsReducer = (state, action) => {
if (state.get('downloads')) {
const downloads = state.get('downloads')
.filter((download) =>
![downloadStates.COMPLETED, downloadStates.INTERRUPTED, downloadStates.CANCELLED].includes(download.get('state')))
![downloadStates.COMPLETED, downloadStates.INTERRUPTED, downloadStates.UNAUTHORIZED, downloadStates.CANCELLED].includes(download.get('state')))
state = state.set('downloads', downloads)
}
break
Expand Down
253 changes: 253 additions & 0 deletions app/common/constants/countryCodes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
const countryCodes = [
'AF',
'AX',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'KH',
'CM',
'CA',
'CV',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CG',
'CD',
'CK',
'CR',
'CI',
'HR',
'CU',
'CW',
'CY',
'CZ',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MK',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'RE',
'RO',
'RU',
'RW',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SZ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'US',
'UM',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW'
]

module.exports = countryCodes
1 change: 1 addition & 0 deletions app/extensions/brave/about-autofill.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<script src="ext/l20n.min.js"></script>
<script src="gen/aboutPages.entry.js" async></script>
<link rel="localization" href="locales/{locale}/autofill.properties">
<link rel="localization" href="locales/{locale}/countries.properties">
</head>
<body>
<div id="appContainer"/>
Expand Down
1 change: 1 addition & 0 deletions app/extensions/brave/index-dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<link rel="localization" href="locales/{locale}/bravery.properties">
<link rel="localization" href="locales/{locale}/menu.properties">
<link rel="localization" href="locales/{locale}/downloads.properties">
<link rel="localization" href="locales/{locale}/countries.properties">
</head>
<body>
<div id="appContainer">
Expand Down
1 change: 1 addition & 0 deletions app/extensions/brave/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<link rel="localization" href="locales/{locale}/bravery.properties">
<link rel="localization" href="locales/{locale}/menu.properties"/>
<link rel="localization" href="locales/{locale}/downloads.properties"/>
<link rel="localization" href="locales/{locale}/countries.properties"/>
</head>
<body>
<div id="appContainer"/>
Expand Down
1 change: 1 addition & 0 deletions app/extensions/brave/locales/bn-BD/downloads.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ downloadCompleted=সম্পূর্ণ হয়েছে
downloadInProgress={{downloadPercent}} ডাউনলোডিং
downloadInProgressUnknownTotal=ডাউনলোড চলছে...
downloadPaused={{downloadPercent}} থেমে আছে
downloadUnauthorized=Failed - Unauthorized access to download location
downloadDeleteConfirmation=Delete?
downloadLocalFile=Local file

Expand Down
1 change: 1 addition & 0 deletions app/extensions/brave/locales/bn-IN/downloads.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ downloadCompleted=সম্পূর্ণ
downloadInProgress=ডাউনলোড হচ্ছে: {{downloadPercent}}
downloadInProgressUnknownTotal=ডাউনলোড করা হচ্ছে ...
downloadPaused=থামানো হয়েছে: {{downloadPercent}}
downloadUnauthorized=Failed - Unauthorized access to download location
downloadDeleteConfirmation=Delete?
downloadLocalFile=Local file

Expand Down
1 change: 1 addition & 0 deletions app/extensions/brave/locales/cs/downloads.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ downloadCancelled=Zrušeno
downloadCompleted=Dokončeno
downloadInProgress=Stahování: {{downloadPercent}}
downloadInProgressUnknownTotal=Stahuje se...
downloadUnauthorized=Failed - Unauthorized access to download location
downloadPaused=Pozastaveno: {{downloadPercent}}
downloadDeleteConfirmation=Smazat?
downloadLocalFile=Místní soubor
Expand Down
1 change: 1 addition & 0 deletions app/extensions/brave/locales/de-DE/downloads.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ downloadCompleted=Abgeschlossen
downloadInProgress=Wird heruntergeladen: {{downloadPercent}}
downloadInProgressUnknownTotal=Wird heruntergeladen…
downloadPaused=Pausiert: {{downloadPercent}}
downloadUnauthorized=Failed - Unauthorized access to download location
downloadDeleteConfirmation=Löschen?
downloadLocalFile=Lokale Datei

Expand Down
1 change: 1 addition & 0 deletions app/extensions/brave/locales/en-GB/downloads.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ downloadCompleted=Completed
downloadInProgress=Downloading: {{downloadPercent}}
downloadInProgressUnknownTotal=Downloading…
downloadPaused=Paused: {{downloadPercent}}
downloadUnauthorized=Failed - Unauthorized access to download location
downloadDeleteConfirmation=Delete?
downloadLocalFile=Local file

Expand Down
Loading

0 comments on commit b531e2e

Please sign in to comment.