Bio length on client side mostly doesn't count metadata

This commit is contained in:
Surinna Curtis
2017-06-26 09:33:35 -05:00
parent 4f36aad6e8
commit 7b53d4bbca
3 changed files with 54 additions and 52 deletions

View File

@@ -4,6 +4,7 @@ import { delegate } from 'rails-ujs';
import emojify from '../mastodon/emoji';
import { getLocale } from '../mastodon/locales';
import loadPolyfills from '../mastodon/load_polyfills';
import { processBio } from '../mastodon/features/account/util/bio_metadata';
require.context('../images/', true);
@@ -87,7 +88,8 @@ function main() {
delegate(document, '.account_note', 'input', ({ target }) => {
const noteCounter = document.querySelector('.note-counter');
if (noteCounter) {
noteCounter.textContent = 500 - length(target.value);
const noteWithoutMetadata = processBio(target.value).text;
noteCounter.textContent = 500 - length(noteWithoutMetadata);
}
});
}