diff --git a/html/src/app.js b/html/src/app.js index 8fb8db59..0604f325 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -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); diff --git a/html/src/index.pug b/html/src/index.pug index 8220aa19..a83223e8 100644 --- a/html/src/index.pug +++ b/html/src/index.pug @@ -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")