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

Folder preview image will be taken from all child directories not only direct childs #165

Merged
merged 1 commit into from
Jan 24, 2021

Conversation

lexas2509
Copy link

No description provided.

@lexas2509 lexas2509 changed the title Preview will show from all child directoris (not only direct childs) Folder preview image will be taken from all child directories not only direct childs Jun 29, 2020
@lexas2509
Copy link
Author

Inspired by this issue [https://github.com//issues/154] this MR is fixing blank folder thumbnail while there are the non-empty subfolders (but the folder itself doesn't have any images)

@bpatrik
Copy link
Owner

bpatrik commented Jul 30, 2020

I looked at the code.

I have to double check, but I think this approach leads to inconsistent UI.
Let assume you have this dir setup:
+DirA
+-a.jpg
+-DirB
+--DirC
+-c.jpg

The inconsistency can come from showing c.jpg in DirB (not only for preview).

@bpatrik
Copy link
Owner

bpatrik commented Jul 30, 2020

After I gave some thought to it. You might not notice the inconsistency, but I still find this solution a bit misleading (namely you use a variable (.media) to store a image in it that is not part of a given directory.

A more proper solution would be to add a new filed to the directory here:


like
previews: S[];
And store the previews for a given directory there. Should not be too hard to implement, just a lot of refactoring.

@@ -30,7 +30,7 @@ export class ConfigDiagnostics {
if (databaseConfig.type !== ServerConfig.DatabaseType.memory) {
await SQLConnection.tryConnection(databaseConfig);
}
if (databaseConfig.type !== ServerConfig.DatabaseType.sqlite) {
if (databaseConfig.type === ServerConfig.DatabaseType.sqlite) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really nice catch. I would e happy to merge this change even separately from the other changes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can prepare a separate change for this if you want.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested the actual fix several times and it works fine. No inconsistencies found. Sure, it would be better to have something like a dedicated previews attribute, however it seems to be a lot of work.

I would also suggest to move the fix of 'ConfigDiagnostics.ts' into another pull request and merge the actual one. @lexas2509 Can you do it in your pull request, otherwise I can do another one to get the fix soon merged :-)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright. Fingers crossed. I'll merge this.
Worst case the nightly build wont work. There isn't much in it compared to 1.8.2.
I wanted to fix this actually properly. Now I will be forced to.
I might just remove the memory (non DB) approach. That will make things simpler and with docker, having at least an sqlite DB, should not be an issue. Although, I'm not sure how may people are using it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Tested the result of the nightly build and it works quite well on my side.

snoopyCode added a commit to snoopyCode/pigallery2 that referenced this pull request Jan 24, 2021
@bpatrik bpatrik merged commit db1fea3 into bpatrik:master Jan 24, 2021
bpatrik added a commit that referenced this pull request Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants