Fix clicking avatars in feed

This commit is contained in:
Natsumi
2021-04-14 00:58:32 +12:00
parent c8c85c50f2
commit bde43053d7
+43 -47
View File
@@ -8160,18 +8160,27 @@ speechSynthesis.getVoices();
if (fileId) { if (fileId) {
if (API.cachedAvatarNames.has(fileId)) { if (API.cachedAvatarNames.has(fileId)) {
var { ownerId } = API.cachedAvatarNames.get(fileId); var { ownerId } = API.cachedAvatarNames.get(fileId);
if (ownerId === D.id) {
this.$message({
message: 'It\'s personal (own) avatar',
type: 'warning'
});
return;
}
this.showUserDialog(ownerId);
} else { } else {
var args = API.getAvatarImages({fileId: fileId}); API.getAvatarImages({fileId}).then((args) => {
var ownerId = args.json.ownerId; var ownerId = args.json.ownerId;
} if (ownerId === D.id) {
if (ownerId === D.id) { this.$message({
this.$message({ message: 'It\'s personal (own) avatar',
message: 'It\'s personal (own) avatar',
type: 'warning' type: 'warning'
}); });
return; return;
}
this.showUserDialog(ownerId);
});
} }
this.showUserDialog(ownerId);
} else { } else {
this.$message({ this.$message({
message: 'Sorry, the author is unknown', message: 'Sorry, the author is unknown',
@@ -8741,50 +8750,37 @@ speechSynthesis.getVoices();
}; };
$app.methods.showAvatarAuthorDialog = function (refUserId, currentAvatarImageUrl) { $app.methods.showAvatarAuthorDialog = function (refUserId, currentAvatarImageUrl) {
var id = extractFileId(currentAvatarImageUrl); for (var ref of API.cachedAvatars.values()) {
if (id) { if (ref.imageUrl === currentAvatarImageUrl) {
API.call(`file/${id}`).then(({ ownerId }) => { this.showAvatarDialog(ref.id);
for (var ref of API.cachedAvatars.values()) { return;
if (ref.imageUrl === currentAvatarImageUrl) { }
this.showAvatarDialog(ref.id); }
return; var fileId = extractFileId(currentAvatarImageUrl);
} if (fileId) {
if (API.cachedAvatarNames.has(fileId)) {
var { ownerId } = API.cachedAvatarNames.get(fileId);
if (ownerId === refUserId) {
this.$message({
message: 'It\'s personal (own) avatar',
type: 'warning'
});
return;
} }
var params = { this.showUserDialog(ownerId);
n: 50, } else {
offset: 0, API.getAvatarImages({fileId}).then((args) => {
sort: 'updated', var ownerId = args.json.ownerId;
order: 'descending', if (ownerId === refUserId) {
// user: 'friends', this.$message({
userId: ownerId, message: 'It\'s personal (own) avatar',
releaseStatus: 'public'
};
if (params.userId === API.currentUser.id) {
params.user = 'me';
params.releaseStatus = 'all';
}
API.bulk({
fn: 'getAvatars',
N: -1,
params,
done: () => {
for (var ref2 of API.cachedAvatars.values()) {
if (ref2.imageUrl === currentAvatarImageUrl) {
this.showAvatarDialog(ref2.id);
return;
}
}
if (ownerId === refUserId) {
this.$message({
message: 'It\'s personal (own) avatar',
type: 'warning' type: 'warning'
}); });
return; return;
}
this.showUserDialog(ownerId);
} }
this.showUserDialog(ownerId);
}); });
}); }
} else { } else {
this.$message({ this.$message({
message: 'Sorry, the author is unknown', message: 'Sorry, the author is unknown',