aboutsummaryrefslogtreecommitdiff
path: root/src/main/assets
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-12-24 03:28:02 +0300
committerGravatar Vitaly Takmazov2022-12-24 04:12:58 +0300
commit36ebeb217326c6bc23dedfde1e028ae2286afe02 (patch)
treedcd0156bcabd3b1e92dd7da48a386975a34b676f /src/main/assets
parent354988a7078a54bccf8afc8b49d3a178ae42789f (diff)
Cacheable ActivityPub profiles
Diffstat (limited to 'src/main/assets')
-rw-r--r--src/main/assets/scripts.js37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/main/assets/scripts.js b/src/main/assets/scripts.js
index bf74cfb5..b204766d 100644
--- a/src/main/assets/scripts.js
+++ b/src/main/assets/scripts.js
@@ -512,29 +512,22 @@ function addTag(tag) {
return false;
}
-var users = {};
-
function fetchUserUri(dataUri, callback) {
- if (users[dataUri]) {
- callback(users[dataUri]);
- } else {
- let data = new FormData();
- data.append('uri', dataUri);
- fetch('/u/', {
- method: 'POST',
- body: data
- }).then(handleErrors)
- .then(response => {
- return response.json();
- })
- .then(json => {
- users[dataUri] = json;
- callback(json);
- })
- .catch(e => {
- callback({ preferredUsername: dataUri });
- });
- }
+ let data = new FormData();
+ data.append('uri', dataUri);
+ fetch('/api/u/', {
+ method: 'POST',
+ body: data
+ }).then(handleErrors)
+ .then(response => {
+ return response.json();
+ })
+ .then(json => {
+ callback(json);
+ })
+ .catch(e => {
+ callback({ uname: dataUri, uri: dataUri });
+ });
}
function notificationsCheckPermissions(button) {