Skip to content
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

Read-write actions on public view #2017

Merged
merged 30 commits into from May 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8f6eced
refactor: Moved Toolbar file
y-lohse Apr 21, 2020
8c56a17
refactor: Separate MoreMenu from Toolbar
y-lohse Apr 21, 2020
94be56a
refactor: Switch MoreMenu to ActionMenu
y-lohse Apr 27, 2020
c7dd42f
refactor: Migrate Trash MoreMenu
y-lohse Apr 27, 2020
1944efd
refactor: Removed old menu code
y-lohse Apr 28, 2020
4aadd0e
refactor: Shortcut menu item doesn't display the modal itself
y-lohse Apr 30, 2020
c172464
refactor: Make SelectableItem a real action menu item
y-lohse Apr 30, 2020
1d7da32
fix: ActionMenus close automatically
y-lohse May 7, 2020
4a222a3
fix: Enable rendering modals on public view
y-lohse May 7, 2020
a5cb33d
feat: Render file history on public view
y-lohse May 7, 2020
0e0a42d
refactor: Pass write permission to toolbar
y-lohse May 7, 2020
b40da3e
feat: New actions for files on public view
y-lohse May 7, 2020
896e7d1
feat: New toolbar for public view
y-lohse May 7, 2020
71ef983
fix: Avoid duplicate menu item in trash
y-lohse May 11, 2020
7a0ab75
fix: Fallback link to notes if no permissions
y-lohse May 11, 2020
5858716
refactor: Removed unused style
y-lohse May 11, 2020
347b53c
fix: Check write conditions on public actions
y-lohse May 12, 2020
82bf301
fix: Case sensitive file name
y-lohse May 12, 2020
9a98cd3
chore: Set test env variable
y-lohse May 12, 2020
49fb54c
chore: Use recent versions of node and yarn on android
y-lohse May 12, 2020
03b821a
feat: Upgrade cozy-sharings
y-lohse May 12, 2020
705bfd2
refactor: Make SharingProvider available to all public views
y-lohse May 12, 2020
8d12fec
fix: Add reloadView proptype
y-lohse May 15, 2020
fffb585
refactor: Removed useless translate HOC
y-lohse May 15, 2020
a605f32
docs: Added comment about realtime
y-lohse May 15, 2020
dfeb56e
refactor: Renamed props
y-lohse May 15, 2020
d6ed0df
feat: Reload public view after upload
y-lohse May 12, 2020
291d6f8
refactor: Only query notes app url if we have permissions
y-lohse May 12, 2020
6169bb6
refactor: Use permissions model fetchOwn
y-lohse May 12, 2020
06392ba
docs: Added missing doc string
y-lohse May 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -115,7 +115,7 @@
"cozy-scripts": "1.13.2",
"cozy-sharing": "1.9.1",
"cozy-stack-client": "13.5.2",
"cozy-ui": "35.9.0",
"cozy-ui": "35.17.0",
"date-fns": "1.30.1",
"diacritics": "1.3.0",
"fastclick": "1.0.6",
Expand Down
115 changes: 59 additions & 56 deletions src/drive/web/modules/drive/Toolbar/components/ScanWrapper.jsx
Expand Up @@ -60,66 +60,69 @@ const ScanMenuItem = translate()(({ status, onClick, t, online }) => {
class ScanWrapper extends Component {
render() {
const { displayedFolder, stopMediaBackup, startMediaBackup } = this.props
// The ActionMenu needs to stay open during the scan, so we prevent the click event from bubbling
return (
<MuiCozyTheme>
<Scanner
dirId={displayedFolder.id} //Pour savoir où uploader
pluginConfig={{
sourceType: 1 // Camera
}}
generateName={() => {
const date = new Date()
//We had to replace : by - since the Cordova File plugin doesn't support : in the filename
//https://github.com/apache/cordova-plugin-file/issues/289#issuecomment-477954331
return `Scan_${date.toISOString().replace(/:/g, '-')}.jpg`
}}
onConflict={'rename'}
//We need to cancel the MediaBackup before doing the upload since the scanned file will be
//inserted we don't know where in the queue resulting in a non uploaded file if the queue is
//big enough
onBeforeUpload={() => stopMediaBackup()}
onFinish={() => {
const tracker = getTracker()
if (tracker) {
tracker.push(['trackEvent', 'Drive', 'Scanner', 'Finished'])
}
startMediaBackup()
}}
>
{({ status, error, startScanner, filename, onClear, online }) => {
if (error || !filename) {
<div onClick={e => e.stopPropagation()}>
y-lohse marked this conversation as resolved.
Show resolved Hide resolved
<Scanner
dirId={displayedFolder.id} //Pour savoir où uploader
pluginConfig={{
sourceType: 1 // Camera
}}
generateName={() => {
const date = new Date()
//We had to replace : by - since the Cordova File plugin doesn't support : in the filename
//https://github.com/apache/cordova-plugin-file/issues/289#issuecomment-477954331
return `Scan_${date.toISOString().replace(/:/g, '-')}.jpg`
}}
onConflict={'rename'}
//We need to cancel the MediaBackup before doing the upload since the scanned file will be
//inserted we don't know where in the queue resulting in a non uploaded file if the queue is
//big enough
onBeforeUpload={() => stopMediaBackup()}
onFinish={() => {
const tracker = getTracker()
if (tracker) {
tracker.push(['trackEvent', 'Drive', 'Scanner', 'Finished'])
}
startMediaBackup()
}}
>
{({ status, error, startScanner, filename, onClear, online }) => {
if (error || !filename) {
return (
<ScanMenuItem
status={status}
onClick={startScanner}
online={online}
/>
)
}
return (
<ScanMenuItem
status={status}
onClick={startScanner}
online={online}
/>
<>
<ScanMenuItem
status={status}
onClick={startScanner}
online={online}
/>
<PortaledQueue
file={{
file: {
name: filename,
isDirectory: false,
status
}
}}
successCount={status === SCANNER_DONE ? 1 : 0}
doneCount={1}
key={filename}
onClear={onClear}
/>
</>
)
}
return (
<>
<ScanMenuItem
status={status}
onClick={startScanner}
online={online}
/>
<PortaledQueue
file={{
file: {
name: filename,
isDirectory: false,
status
}
}}
successCount={status === SCANNER_DONE ? 1 : 0}
doneCount={1}
key={filename}
onClear={onClear}
/>
</>
)
}}
</Scanner>
}}
</Scanner>
</div>
</MuiCozyTheme>
)
}
Expand Down
Expand Up @@ -18,8 +18,13 @@ const UploadItem = ({ t, isDisabled, onUpload }) => (
onChange={onUpload}
data-test-id="upload-btn"
value={[]}
// FileInput needs to stay rendered until the onChange event, so we prevent the event from bubbling
onClick={e => e.stopPropagation()}
>
<ActionMenuItem left={<Icon icon="upload" />}>
<ActionMenuItem
left={<Icon icon="upload" />}
onClick={e => e.stopPropagation()}
>
{t('toolbar.menu_upload')}
</ActionMenuItem>
</FileInput>
Expand Down
1 change: 1 addition & 0 deletions src/drive/web/modules/trash/Toolbar.jsx
Expand Up @@ -45,6 +45,7 @@ const Toolbar = ({
placement="bottom-end"
anchorElRef={anchorRef}
onClose={closeMenu}
autoclose
>
<ActionMenuItem
onClick={() => emptyTrash()}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -5393,10 +5393,10 @@ cozy-ui@22.3.1:
react-pdf "^4.0.5"
react-select "2.2.0"

cozy-ui@35.9.0:
version "35.9.0"
resolved "https://registry.yarnpkg.com/cozy-ui/-/cozy-ui-35.9.0.tgz#03db32bf49d812cfadca097e3e8157d2632b34c8"
integrity sha512-/XSyzDV4tTkKgovrdVtw5YoeO9yniv7xHBUImtYHi0+XszKEuVz3V0sHhG1d9WdTdRguUScYF8W+j3/mBbPiWw==
cozy-ui@35.17.0:
version "35.17.0"
resolved "https://registry.yarnpkg.com/cozy-ui/-/cozy-ui-35.17.0.tgz#b91caf07f7c2ba9fd8588fa38b7a360d81fb69c8"
integrity sha512-qtlDgd3zGpjldpwcvqJBRcxtvUMWd1WjT9NrvPyw2jCy5LjpPwHY1SSBtzsi0ZlqH6QSU73Wh1VG7p16akrzOg==
dependencies:
"@babel/runtime" "^7.3.4"
body-scroll-lock "^2.5.8"
Expand Down