-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Implement default Photos folder #1189
Conversation
47d8cea
to
86a39b8
Compare
86a39b8
to
34948e3
Compare
use OCP\IUserSession; | ||
|
||
class UserConfigService { | ||
public const DEFAULT_CONFIGS = [ |
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 theoritecally be exposed as a capability and used straight away by the
photos/src/mixins/UserConfig.js
Lines 34 to 39 in 34948e3
return { | |
croppedLayout: croppedLayoutLocalStorage !== null | |
? croppedLayoutLocalStorage === 'true' | |
: loadState('photos', 'croppedLayout') === 'true', | |
photosLocation: loadState('photos', 'photosLocation'), | |
} |
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
34948e3
to
a07c06f
Compare
updatePhotosFolder(path) { | ||
console.debug(`Path '${path}' selected for photos location`) | ||
if (typeof path !== 'string' || path.trim() === '' || !path.startsWith('/')) { | ||
showError(t('photos', 'Invalid location selected')) | ||
return | ||
} | ||
|
||
if (path.includes('//')) { | ||
path = path.replace(/\/\//gi, '/') | ||
} | ||
|
||
this.photosLocation = path | ||
this.updateSetting('photosLocation') | ||
}, |
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.
Or:
updatePhotosFolder(path) { | |
console.debug(`Path '${path}' selected for photos location`) | |
if (typeof path !== 'string' || path.trim() === '' || !path.startsWith('/')) { | |
showError(t('photos', 'Invalid location selected')) | |
return | |
} | |
if (path.includes('//')) { | |
path = path.replace(/\/\//gi, '/') | |
} | |
this.photosLocation = path | |
this.updateSetting('photosLocation') | |
}, | |
updatePhotosFolder: debounce(function (path) { | |
console.debug(`Path '${path}' selected for photos location`) | |
if (typeof path !== 'string' || path.trim() === '' || !path.startsWith('/')) { | |
showError(t('photos', 'Invalid location selected')) | |
return | |
} | |
if (path.includes('//')) { | |
path = path.replace(/\/\//gi, '/') | |
} | |
this.photosLocation = path | |
this.updateSetting('photosLocation') | |
}), |
But works as you coded it so feel free to ignore.
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.
debounce requires a function reference, here the function will be created on each call, so it will be different and not debounced properly, no?
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.
Also, sometimes you don't need to debounce, like right after picking with the Folder picker for example
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.
debounce requires a function reference, here the function will be created on each call, so it will be different and not debounced properly, no?
Here, debounce will be called only once at component creation and return a debounced function from the passed one. So the function will stay the same
debounceUpdatePhotosFolder: debounce(function(...args) { | ||
this.updatePhotosFolder(...args) | ||
}, 300), |
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.
Is this not working?
debounceUpdatePhotosFolder: debounce(function(...args) { | |
this.updatePhotosFolder(...args) | |
}, 300), | |
debounceUpdatePhotosFolder: debounce(this.updatePhotosFolder, 300), |
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 me 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.
No, because this
is not set there otherwise
Default set to
/Photos
photos/lib/Service/UserConfigService.php
Line 37 in a07c06f