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>{{ model.getDateString() }}</td>
|
||||
</tr>
|
||||
<tr v-if="model.Albums && model.Albums.length">
|
||||
<tr v-if="albums.length > 0">
|
||||
<td>
|
||||
<translate>Albums</translate>
|
||||
</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>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -311,6 +311,17 @@ export default {
|
|||
|
||||
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: {
|
||||
formatTime(s) {
|
||||
|
|
|
@ -500,7 +500,7 @@ func (m *Photo) PreloadKeywords() {
|
|||
q := Db().NewScope(nil).DB().
|
||||
Table("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")
|
||||
|
||||
Log("photo", "preload files", q.Scan(&m.Keywords).Error)
|
||||
|
@ -511,7 +511,7 @@ func (m *Photo) PreloadAlbums() {
|
|||
q := Db().NewScope(nil).DB().
|
||||
Table("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").
|
||||
Order("albums.album_title ASC")
|
||||
|
||||
|
|
Loading…
Reference in a new issue