add get avatar info by clicking avatar image in feed (closes #79)

This commit is contained in:
pypy
2020-09-26 17:02:54 +09:00
parent 03e89f67b9
commit 68c04f7a09
2 changed files with 55 additions and 2 deletions

View File

@@ -6689,6 +6689,59 @@ CefSharp.BindObjectAsync(
}
};
$app.methods.showAvatarAuthorDialog = function (refUserId, currentAvatarImageUrl) {
var id = extractFileId(currentAvatarImageUrl);
if (id) {
API.call(`file/${id}`).then(({ ownerId }) => {
for (var ref of API.cachedAvatars.values()) {
if (ref.imageUrl === currentAvatarImageUrl) {
this.showAvatarDialog(ref.id);
return;
}
}
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: () => {
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'
});
return;
}
this.showUserDialog(ownerId);
}
});
});
} else {
this.$message({
message: 'Sorry, the author is unknown',
type: 'error'
});
}
};
$app.methods.refreshAvatarDialogTreeData = function () {
var D = this.avatarDialog;
D.treeData = buildTreeData(D.ref);

View File

@@ -80,12 +80,12 @@ html
//- high resolution (v2) 2020.07.12~
el-popover(placement="right" width="500px" trigger="click")
img.x-link(slot="reference" v-lazy="scope.row.avatar[1].currentAvatarThumbnailImageUrl" style="flex:none;width:160px;height:120px;border-radius:4px")
img(v-lazy="scope.row.avatar[1].currentAvatarImageUrl" style="width:500px;height:375px")
img.x-link(v-lazy="scope.row.avatar[1].currentAvatarImageUrl" style="width:500px;height:375px" @click="showAvatarAuthorDialog(scope.row.userId, scope.row.avatar[1].currentAvatarImageUrl)")
span(style="position:relative;top:-50px;margin:0 5px")
i.el-icon-right
el-popover(placement="right" width="500px" trigger="click")
img.x-link(slot="reference" v-lazy="scope.row.avatar[0].currentAvatarThumbnailImageUrl" style="flex:none;width:160px;height:120px;border-radius:4px")
img(v-lazy="scope.row.avatar[0].currentAvatarImageUrl" style="width:500px;height:375px")
img.x-link(v-lazy="scope.row.avatar[0].currentAvatarImageUrl" style="width:500px;height:375px" @click="showAvatarAuthorDialog(scope.row.userId, scope.row.avatar[0].currentAvatarImageUrl)")
template(v-else)
//- legacy
el-popover(placement="right" width="500px" trigger="click")