Photos: Skip related albums from which a photo was removed #3095
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
1776728570
commit
90a18f6e7d
2 changed files with 15 additions and 4 deletions
|
@ -71,12 +71,12 @@
|
||||||
</td>
|
</td>
|
||||||
<td>{{ model.getDateString() }}</td>
|
<td>{{ model.getDateString() }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="model.Albums && model.Albums.length">
|
<tr v-if="albums.length > 0">
|
||||||
<td>
|
<td>
|
||||||
<translate>Albums</translate>
|
<translate>Albums</translate>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a v-for="(m, i) in model.Albums" :key="i" :href="albumUrl(m)" class="primary--text text-link" target="_blank"><span v-if="i > 0">, </span>{{ m.Title }}</a>
|
<a v-for="(a, i) in albums" :key="i" :href="a.url" class="primary--text text-link" target="_blank"><span v-if="i > 0">, </span>{{ a.title }}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -311,6 +311,17 @@ export default {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
albums() {
|
||||||
|
if (!this.model || !this.model.Albums || this.model.Albums.length < 1) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const results = [];
|
||||||
|
|
||||||
|
this.model.Albums.forEach(a => results.push({"title": a.Title, "url": this.albumUrl(a)}));
|
||||||
|
|
||||||
|
return results;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatTime(s) {
|
formatTime(s) {
|
||||||
|
|
|
@ -500,7 +500,7 @@ func (m *Photo) PreloadKeywords() {
|
||||||
q := Db().NewScope(nil).DB().
|
q := Db().NewScope(nil).DB().
|
||||||
Table("keywords").
|
Table("keywords").
|
||||||
Select(`keywords.*`).
|
Select(`keywords.*`).
|
||||||
Joins("JOIN photos_keywords ON photos_keywords.keyword_id = keywords.id AND photos_keywords.photo_id = ?", m.ID).
|
Joins("JOIN photos_keywords pk ON pk.keyword_id = keywords.id AND pk.photo_id = ?", m.ID).
|
||||||
Order("keywords.keyword ASC")
|
Order("keywords.keyword ASC")
|
||||||
|
|
||||||
Log("photo", "preload files", q.Scan(&m.Keywords).Error)
|
Log("photo", "preload files", q.Scan(&m.Keywords).Error)
|
||||||
|
@ -511,7 +511,7 @@ func (m *Photo) PreloadAlbums() {
|
||||||
q := Db().NewScope(nil).DB().
|
q := Db().NewScope(nil).DB().
|
||||||
Table("albums").
|
Table("albums").
|
||||||
Select(`albums.*`).
|
Select(`albums.*`).
|
||||||
Joins("JOIN photos_albums ON photos_albums.album_uid = albums.album_uid AND photos_albums.photo_uid = ?", m.PhotoUID).
|
Joins("JOIN photos_albums pa ON pa.album_uid = albums.album_uid AND pa.photo_uid = ? AND pa.hidden = 0", m.PhotoUID).
|
||||||
Where("albums.deleted_at IS NULL").
|
Where("albums.deleted_at IS NULL").
|
||||||
Order("albums.album_title ASC")
|
Order("albums.album_title ASC")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue