bigbuffet-rw/app/gabsocial/utils/accounts.js

17 lines
460 B
JavaScript
Raw Normal View History

2020-03-28 11:07:36 -07:00
const getDomain = account => {
let re = /https?:\/\/(.*?)\//i;
return re.exec(account.get('url'))[1];
}
// user@domain even for local users
export const acctFull = account => {
let [user, domain] = account.get('acct').split('@');
try {
if (!domain) domain = getDomain(account);
} catch(e) {
2020-03-28 13:10:35 -07:00
console.warning('Could not get domain for acctFull. Falling back to acct.');
2020-03-28 11:07:36 -07:00
return account.get('acct');
}
return [user, domain].join('@');
}