Fix opening nameless faces

cache
Varun Patil 2022-10-10 17:17:42 -07:00
parent d779a9ea22
commit e81b7c6d59
3 changed files with 10 additions and 7 deletions

View File

@ -19,10 +19,14 @@ trait TimelineQueryFaces {
// Get cluster ID // Get cluster ID
$sq = $query->getConnection()->getQueryBuilder(); $sq = $query->getConnection()->getQueryBuilder();
$id = $sq->select('id')->from('recognize_face_clusters') $idQuery = $sq->select('id')->from('recognize_face_clusters')
->where($query->expr()->eq('user_id', $sq->createNamedParameter($faceUid))) ->where($query->expr()->eq('user_id', $sq->createNamedParameter($faceUid)));
->andWhere($query->expr()->eq('title', $sq->createNamedParameter($faceName)))
->executeQuery()->fetchOne(); // 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"); if (!$id) throw new \Exception("Unknown person: $faceStr");
// Join with cluster // Join with cluster

View File

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

View File

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