Skip to content

Commit ae50ba5

Browse files
committed
fix: deprecate hack logic, use new api to concat comment's explorer url
1 parent ca40c00 commit ae50ba5

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

static/root/frontend/js/bebop-app.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var BebopApp = new Vue({
2323
<div id="main">
2424
<router-view :config="config" :auth="auth" :rawConfig="rawConfig"></router-view>
2525
</div>
26-
26+
2727
<footer class="nav-footer" id="footer">
2828
<a
2929
href="https://github.com/CovenantSQL/CovenantSQL"
@@ -90,11 +90,18 @@ var BebopApp = new Vue({
9090
getBlockHead: function () {
9191
if (window.DBID) {
9292
let url = HEAD_API()
93-
console.log('// get current lead block for ', DBID)
93+
console.log(" ___ _ __ ____ __ ")
94+
console.log(" / __\\_____ _____ _ __ __ _ _ __ | |_/ _\\ /___ \\/ /")
95+
console.log(" / / / _ \\ \\ / / _ | '_ \\ / _\` | '_ \\| __\\ \\ // / / /")
96+
console.log("/ /__| (_) \\ V | __| | | | (_| | | | | |__\\ / \\_/ / /___")
97+
console.log("\\____/\\___/ \\_/ \\___|_| |_|\\__,_|_| |_|\\__\\__\\___,_\\____/")
98+
console.log('--- connected')
99+
console.log('')
100+
console.log('--- current lead block for ', DBID)
94101

95102
fetch(url).then(res => res.json()).then((d) => {
96103
let head = _.get(d, 'data.block', {})
97-
console.log('// current head block', head)
104+
console.log('--- current head block', head)
98105
db.set('head', head).write()
99106
}).catch(e => {
100107
console.error(e)

static/root/frontend/js/bebop-comments.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ var BebopComments = Vue.component("bebop-comments", {
4747
4848
<div class="avatar-block">
4949
<div class="cqldb comment">
50-
<a target="_blank" :href="comment.createdAt | getCommentSQLRequestHref" v-bind:class="{ disabled: isCommentSQLRequestHrefEmpty(comment.createdAt) }">
51-
<img src="https://developers.covenantsql.io/img/logo.svg" alt="logo" style="width: 19px;">CovenantSQL
50+
<a target="_blank" :href="comment.requestHash | getCommentSQLRequestHref" v-bind:class="{ disabled: isCommentHashEmpty(comment) }">
51+
<img src="https://raw.githubusercontent.com/CovenantSQL/logos/master/logo_icon_white.svg" alt="logo" style="width: 19px;">CovenantSQL
5252
</a>
5353
</div>
5454
<div class="avatar-block-l">
55-
<img v-if="users[comment.authorId].avatar" class="img-circle" :src="users[comment.authorId].avatar" width="35" height="35">
56-
<img v-else class="img-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" width="35" height="35">
55+
<img v-if="users[comment.authorId].avatar" class="img-circle" :src="users[comment.authorId].avatar" width="35" height="35">
56+
<img v-else class="img-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" width="35" height="35">
5757
</div>
5858
<div class="avatar-block-r">
5959
<div class="comments-comment-author">{{users[comment.authorId].name}}</div>
@@ -71,7 +71,6 @@ var BebopComments = Vue.component("bebop-comments", {
7171
<span v-if="topic.commentCount > 1" class="info-separator"> | </span>
7272
<router-link :to="'/u/' + users[comment.authorId].id" class="a-tool"><i class="fa fa-user" aria-hidden="true"></i> user profile</router-link>
7373
</div>
74-
7574
</div>
7675
7776
<div v-if="auth.authenticated && page === lastPage" class="comments-comment-new">
@@ -176,9 +175,8 @@ var BebopComments = Vue.component("bebop-comments", {
176175
},
177176

178177
filters: {
179-
getCommentSQLRequestHref: function (createdAt) {
180-
let hash = findCommentHashByCreatedAt(createdAt)
181-
console.log('// found hash:', hash)
178+
getCommentSQLRequestHref: function (hash) {
179+
// let hash = findCommentHashByCreatedAt(createdAt)
182180
return !!hash ? `${window.API_HOST}/dbs/${window.DBID}/requests/${hash}` : ''
183181
},
184182
},
@@ -200,16 +198,18 @@ var BebopComments = Vue.component("bebop-comments", {
200198
this.getComments().then(this.getCommentSQLQueries);
201199
},
202200

203-
isCommentSQLRequestHrefEmpty: function (createdAt) {
204-
return findCommentHashByCreatedAt(createdAt) === ''
201+
// if comment.requestHash is empty, disable the button
202+
isCommentHashEmpty: function (comment) {
203+
return comment.requestHash === ''
205204
},
206205
getCommentSQLQueries: function () {
207206
this.comments.forEach(comment => {
208207
const timestamp = (new Date(comment.createdAt)).getTime()
209208
const possibleHeight = this.computeTimeHeight(timestamp)
210209
console.log('// -- current comment possible height:', possibleHeight)
211210

212-
this.getTimeRelatedBlocks(possibleHeight)
211+
// DEPRECATED find possible height by Chenxi 2019-04-24
212+
// this.getTimeRelatedBlocks(possibleHeight)
213213
})
214214
},
215215
writeSQL: function (block) {

0 commit comments

Comments
 (0)