mirror of
https://github.com/ItsVipra/ProToots
synced 2024-11-10 14:14:19 +00:00
Merge pull request #38 from ItsVipra/3-edge-cases
Add a list of fieldnames to compare against
This commit is contained in:
commit
4a5f5b2588
3 changed files with 4 additions and 5 deletions
|
@ -32,7 +32,7 @@ checkSite();
|
|||
* If so creates an 'readystatechange' EventListener, with callback to main()
|
||||
*/
|
||||
async function checkSite() {
|
||||
await getSettings();
|
||||
getSettings();
|
||||
const requestDest = location.protocol + "//" + hostName + "/api/v1/instance";
|
||||
const response = await fetch(requestDest);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import { normaliseAccountName } from "./protootshelpers";
|
|||
|
||||
const cacheMaxAge = 24 * 60 * 60 * 1000; // time after which cached pronouns should be checked again: 24h
|
||||
let conversationsCache;
|
||||
const fieldNames = ["pronouns", "pronoun", "professional nouns", "pronomen"];
|
||||
|
||||
/**
|
||||
* Fetches pronouns associated with account name.
|
||||
|
@ -172,10 +173,8 @@ function getPronounField(status, accountName) {
|
|||
const fields = account.fields;
|
||||
|
||||
for (const field of fields) {
|
||||
//match fields against "pronouns"
|
||||
//TODO: multiple languages -> match against list
|
||||
if (field.name.toLowerCase().includes("pronouns")) {
|
||||
//TODO: see https://github.com/ItsVipra/ProToots/issues/28
|
||||
//match fields against fieldNames
|
||||
if (fieldNames.includes(field.name.toLowerCase())) {
|
||||
debug(`${account.acct}: ${field.value}`);
|
||||
|
||||
cachePronouns(accountName, field.value);
|
||||
|
|
0
src/libs/platforms/mastodon.js
Normal file
0
src/libs/platforms/mastodon.js
Normal file
Loading…
Reference in a new issue