show avatar info (closes #45)

This commit is contained in:
pypy
2020-04-05 19:14:45 +09:00
parent 8c2a817f59
commit b5f2d1d7d1
+44 -9
View File
@@ -6043,17 +6043,52 @@ CefSharp.BindObjectAsync(
} }
}); });
} else if (command === 'Show Avatar Author') { } else if (command === 'Show Avatar Author') {
var id = extractFileId(D.ref.currentAvatarImageUrl); var { currentAvatarImageUrl } = D.ref;
var id = extractFileId(currentAvatarImageUrl);
if (id) { if (id) {
API.call(`file/${id}`).then((json) => { API.call(`file/${id}`).then(({ ownerId }) => {
if (json.ownerId === D.id) { for (var ref of API.cachedAvatars.values()) {
this.$message({ if (ref.imageUrl === currentAvatarImageUrl) {
message: 'It\'s personal (own) avatar', this.showAvatarDialog(ref.id);
type: 'warning' return;
}); }
} else {
this.showUserDialog(json.ownerId);
} }
D.loading = true;
var params = {
n: 100,
offset: 0,
sort: 'updated',
order: 'descending',
user: 'friends',
userId: ownerId,
releaseStatus: 'public'
};
if (params.userId === API.currentUser.id) {
params.user = 'me';
params.releaseStatus = 'all';
}
API.bulk({
fn: 'getAvatars',
N: -1,
params,
done: () => {
D.loading = false;
for (var ref2 of API.cachedAvatars.values()) {
if (ref2.imageUrl === currentAvatarImageUrl) {
this.showAvatarDialog(ref2.id);
return;
}
}
if (ownerId === D.id) {
this.$message({
message: 'It\'s personal (own) avatar',
type: 'warning'
});
return;
}
this.showUserDialog(ownerId);
}
});
}); });
} else { } else {
this.$message({ this.$message({