Library: Display RAW previews and num of actual files in Originals #2273
This commit is contained in:
parent
ce709957d6
commit
b595d5df7a
8 changed files with 26 additions and 10 deletions
|
@ -120,8 +120,6 @@ export class File extends RestModel {
|
|||
thumbnailUrl(size) {
|
||||
if (this.Error || this.Missing) {
|
||||
return `${config.contentUri}/svg/broken`;
|
||||
} else if (this.FileType === "raw") {
|
||||
return `${config.contentUri}/svg/raw`;
|
||||
} else if (this.Sidecar) {
|
||||
return `${config.contentUri}/svg/file`;
|
||||
}
|
||||
|
|
|
@ -439,7 +439,8 @@ func (c *Config) UserConfig() ClientConfig {
|
|||
|
||||
c.Db().
|
||||
Table("files").
|
||||
Select("COUNT(media_id) AS files").
|
||||
Select("COUNT(*) AS files").
|
||||
Where("file_missing = 0 AND file_root = ?", entity.RootOriginals).
|
||||
Take(&result.Count)
|
||||
|
||||
c.Db().
|
||||
|
|
|
@ -573,7 +573,11 @@ func (m *Album) DeletePermanently() error {
|
|||
|
||||
// Deleted tests if the entity is deleted.
|
||||
func (m *Album) Deleted() bool {
|
||||
return m.DeletedAt != nil
|
||||
if m.DeletedAt == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return !m.DeletedAt.IsZero()
|
||||
}
|
||||
|
||||
// Restore restores the entity in the database.
|
||||
|
|
|
@ -101,7 +101,11 @@ func (m *Label) Delete() error {
|
|||
|
||||
// Deleted returns true if the label is deleted.
|
||||
func (m *Label) Deleted() bool {
|
||||
return m.DeletedAt != nil
|
||||
if m.DeletedAt == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return !m.DeletedAt.IsZero()
|
||||
}
|
||||
|
||||
// Restore restores the label in the database.
|
||||
|
|
|
@ -147,7 +147,11 @@ func (m *Subject) AfterDelete(tx *gorm.DB) (err error) {
|
|||
|
||||
// Deleted returns true if the entity is deleted.
|
||||
func (m *Subject) Deleted() bool {
|
||||
return m.DeletedAt != nil
|
||||
if m.DeletedAt == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return !m.DeletedAt.IsZero()
|
||||
}
|
||||
|
||||
// Restore restores the entity in the database.
|
||||
|
|
|
@ -212,7 +212,11 @@ func (m *User) Delete() error {
|
|||
|
||||
// Deleted tests if the entity is marked as deleted.
|
||||
func (m *User) Deleted() bool {
|
||||
return m.DeletedAt != nil
|
||||
if m.DeletedAt == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return !m.DeletedAt.IsZero()
|
||||
}
|
||||
|
||||
// String returns an identifier that can be used in logs.
|
||||
|
|
|
@ -52,7 +52,8 @@ func (c *Counts) Refresh() {
|
|||
Take(c)
|
||||
|
||||
Db().Table("files").
|
||||
Select("COUNT(media_id) AS files").
|
||||
Select("COUNT(*) AS files").
|
||||
Where("file_missing = 0 AND file_root = ?", entity.RootOriginals).
|
||||
Take(c)
|
||||
|
||||
Db().Table("countries").
|
||||
|
|
|
@ -19,8 +19,8 @@ func FilesByPath(limit, offset int, rootName, pathName string) (files entity.Fil
|
|||
err = Db().
|
||||
Table("files").Select("files.*").
|
||||
Joins("JOIN photos ON photos.id = files.photo_id AND photos.deleted_at IS NULL").
|
||||
Where("files.file_missing = 0").
|
||||
Where("files.file_root = ? AND photos.photo_path = ?", rootName, pathName).
|
||||
Where("files.file_missing = 0 AND files.file_root = ?", rootName).
|
||||
Where("photos.photo_path = ?", pathName).
|
||||
Order("files.file_name").
|
||||
Limit(limit).Offset(offset).
|
||||
Find(&files).Error
|
||||
|
|
Loading…
Reference in a new issue