Fix opening nameless faces

old-stable24
Varun Patil 2022-10-10 17:17:42 -07:00
parent a72eeaef9f
commit 41ecf2cc17
3 changed files with 10 additions and 7 deletions

View File

@ -19,10 +19,14 @@ trait TimelineQueryFaces {
// Get cluster ID
$sq = $query->getConnection()->getQueryBuilder();
$id = $sq->select('id')->from('recognize_face_clusters')
->where($query->expr()->eq('user_id', $sq->createNamedParameter($faceUid)))
->andWhere($query->expr()->eq('title', $sq->createNamedParameter($faceName)))
->executeQuery()->fetchOne();
$idQuery = $sq->select('id')->from('recognize_face_clusters')
->where($query->expr()->eq('user_id', $sq->createNamedParameter($faceUid)));
// If name is a number then it is an ID
$nameField = is_numeric($faceName) ? 'id' : 'title';
$idQuery->andWhere($query->expr()->eq($nameField, $sq->createNamedParameter($faceName)));
$id = $idQuery->executeQuery()->fetchOne();
if (!$id) throw new \Exception("Unknown person: $faceStr");
// Join with cluster

View File

@ -39,7 +39,6 @@ import { getPreviewUrl } from "../services/FileUtils";
import { NcCounterBubble } from '@nextcloud/vue'
import axios from '@nextcloud/axios'
import GlobalMixin from '../mixins/GlobalMixin';
import { constants } from '../services/Utils';
@ -114,7 +113,7 @@ export default class Tag extends Mixins(GlobalMixin) {
/** Open tag */
openTag() {
if (this.isFace) {
const name = this.data.name;
const name = this.data.name || this.data.fileid.toString();
const user = this.data.user_id;
this.$router.push({ name: 'people', params: { name, user }});
} else {

View File

@ -488,7 +488,7 @@ export async function getTagsData(): Promise<IDay[]> {
count: data.length,
detail: data.map((face) => ({
...face,
fileid: hashCode(face.name),
fileid: face.id,
istag: true,
isface: true,
} as any)),