Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Change param name for API consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrazee committed Nov 16, 2020
1 parent 47cf8ff commit aa1b6aa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/bg/web-apis/bg/contacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default {
* @returns {Promise<Array<BeakerContactPublicAPIContactRecord>>}
*/
async requestContacts () {
var urls = await shellAPI.selectDriveDialog.call(this, {tag: 'contact', multiple: true, writable: false})
var urls = await shellAPI.selectDriveDialog.call(this, {tag: 'contact', allowMultiple: true, writable: false})
let infos = await Promise.all(urls.map(url => (
drives.getDriveInfo(url, {ignoreCache: false, onlyCache: true}).catch(e => ({}))
)))
Expand Down
4 changes: 2 additions & 2 deletions app/bg/web-apis/bg/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default {
* @param {string} [opts.buttonLabel]
* @param {boolean} [opts.writable]
* @param {string} [opts.tag]
* @param {boolean} [opts.multiple]
* @param {boolean} [opts.allowMultiple]
* @returns {Promise<string|string[]>}
*/
async selectDriveDialog (opts = {}) {
Expand All @@ -144,7 +144,7 @@ export default {
assert(!opts.buttonLabel || typeof opts.buttonLabel === 'string', '.buttonLabel must be a string')
assert(!opts.tag || typeof opts.tag === 'string', '.tag must be a string')
assert(!opts.writable || typeof opts.writable === 'boolean', '.writable must be a boolean')
assert(!opts.multiple || typeof opts.multiple === 'boolean', '.multiple must be a boolean')
assert(!opts.allowMultiple || typeof opts.allowMultiple === 'boolean', '.allowMultiple must be a boolean')

// initiate the modal
var res
Expand Down
12 changes: 6 additions & 6 deletions app/fg/modals/select-drive.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class SelectDriveModal extends LitElement {
this.buttonLabel = 'Select'
this.tag = null
this.writable = undefined
this.multiple = undefined
this.allowMultiple = undefined
this.cbs = null
}

Expand All @@ -174,7 +174,7 @@ class SelectDriveModal extends LitElement {
this.buttonLabel = params.buttonLabel || 'Select'
this.tag = params.tag
this.writable = params.writable
this.multiple = params.multiple
this.allowMultiple = params.allowMultiple
await this.requestUpdate()
this.adjustHeight()

Expand Down Expand Up @@ -219,7 +219,7 @@ class SelectDriveModal extends LitElement {
<div class="form-actions">
<div class="left">
${this.writable !== false && !this.multiple ? html`
${this.writable !== false && !this.allowMultiple ? html`
<button type="button" @click=${this.onClickCreate} data-content="newdrive" class="btn">
Create new drive
</button>
Expand Down Expand Up @@ -301,7 +301,7 @@ class SelectDriveModal extends LitElement {

onChangeSelecteddrive (e) {
var url = e.currentTarget.dataset.url
if (this.multiple) {
if (this.allowMultiple) {
if (this.selection.includes(url)) {
this.selection = this.selection.filter(u => u !== url)
} else {
Expand Down Expand Up @@ -330,14 +330,14 @@ class SelectDriveModal extends LitElement {
onSubmit (e) {
if (e) e.preventDefault()
if (this.selection.length) {
if (this.multiple) {
if (this.allowMultiple) {
this.cbs.resolve({urls: this.selection})
} else {
this.cbs.resolve({url: this.selection[0]})
}
} else {
let url = (new URL(this.currentTitleFilter)).origin
if (this.multiple) {
if (this.allowMultiple) {
this.cbs.resolve({urls: [url]})
} else {
this.cbs.resolve({url})
Expand Down

0 comments on commit aa1b6aa

Please sign in to comment.