This commit is contained in:
Alex Yatskov 2017-09-13 18:03:55 -07:00
parent 04f9a0f543
commit 33d9d6ff57
2 changed files with 5 additions and 3 deletions

View File

@ -133,7 +133,7 @@ class Database {
return results; return results;
} }
async findTag(name, title) { async findTagForTitle(name, title) {
if (!this.db) { if (!this.db) {
throw 'database not initialized'; throw 'database not initialized';
} }

View File

@ -137,11 +137,13 @@ class Translator {
async buildTags(names, title) { async buildTags(names, title) {
const results = []; const results = [];
for (const name of names) { for (const name of names) {
const meta = await this.database.findTag(name.split(':')[0], title); const meta = await this.database.findTagForTitle(name.split(':')[0], title);
const result = {name}; const result = {name};
for (const prop in meta || {}) { for (const prop in meta || {}) {
result[prop] = meta[prop]; if (prop !== 'name') {
result[prop] = meta[prop];
}
} }
results.push(dictTagSanitize(result)); results.push(dictTagSanitize(result));