forked from cory/tildefriends
Sped up some follower/following UI. But ultimately followed more people and made everything else slower.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3720 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@@ -13,16 +13,22 @@ Vue.component('tf-user', {
|
||||
computed: {
|
||||
following: {
|
||||
get: function() {
|
||||
return g_data.users[g_data.whoami] &&
|
||||
g_data.users[g_data.whoami].following &&
|
||||
g_data.users[g_data.whoami].following.indexOf(this.id) != -1;
|
||||
return g_data.users &&
|
||||
g_data.users[g_data.whoami] &&
|
||||
g_data.users[g_data.whoami].following[this.id];
|
||||
},
|
||||
set: function(newValue) {
|
||||
if (g_data.users[g_data.whoami] &&
|
||||
g_data.users[g_data.whoami].following) {
|
||||
if (newValue && g_data.users[g_data.whoami].following.indexOf(this.id) == -1) {
|
||||
var already_following =
|
||||
g_data.users &&
|
||||
g_data.users[g_data.whoami] &&
|
||||
g_data.users[g_data.whoami].following &&
|
||||
g_data.users[g_data.whoami].following[this.id];
|
||||
if (newValue && !already_following) {
|
||||
if (confirm("Are you sure you want to follow " + this.id + "?")) {
|
||||
window.parent.postMessage({appendMessage: {type: "contact", following: true, contact: this.id}}, '*');
|
||||
} else if (!newValue) {
|
||||
}
|
||||
} else if (!newValue && already_following) {
|
||||
if (confirm("Are you sure you want to unfollow " + this.id + "?")) {
|
||||
window.parent.postMessage({appendMessage: {type: "contact", following: false, contact: this.id}}, '*');
|
||||
}
|
||||
}
|
||||
@@ -49,8 +55,10 @@ Vue.component('tf-user', {
|
||||
}
|
||||
},
|
||||
},
|
||||
template: `<span @click="show_user()">
|
||||
{{users[id] && users[id].name ? users[id].name : id}}
|
||||
template: `<span>
|
||||
<md-chip md-clickable :class="following ? 'md-accent' : ''" @click="show_user()">
|
||||
{{users[id] && users[id].name ? users[id].name : id}}
|
||||
</md-chip>
|
||||
<md-tooltip v-if="users[id] && users[id].name">{{id}}</md-tooltip>
|
||||
<md-dialog :md-active.sync="show_user_dialog">
|
||||
<md-dialog-title>{{users[id] && users[id].name ? users[id].name : id}}</md-dialog-title>
|
||||
@@ -72,18 +80,18 @@ Vue.component('tf-user', {
|
||||
<div><md-switch v-model="following">Following</md-switch></div>
|
||||
<md-list>
|
||||
<md-subheader>Followers</md-subheader>
|
||||
<md-list-item v-for="follower in (users[id] || []).followers" v-bind:key="'follower-' + follower">
|
||||
<md-list-item v-for="follower in Object.keys((users[id] && users[id].followers) ? users[id].followers : {})" v-bind:key="'follower-' + follower">
|
||||
<tf-user :id="follower"></tf-user>
|
||||
</md-list-item>
|
||||
<md-subheader>Following</md-subheader>
|
||||
<md-list-item v-for="user in (users[id] || []).following" v-bind:key="'following-' + user">
|
||||
<md-list-item v-for="user in Object.keys((users[id] && users[id].following) ? users[id].following : {})" v-bind:key="'following-' + user">
|
||||
<tf-user :id="user"></tf-user>
|
||||
</md-list-item>
|
||||
</md-list>
|
||||
</template>
|
||||
</md-dialog-content>
|
||||
<md-dialog-actions>
|
||||
<md-button @click="save_profile">Save Profile</md-button>
|
||||
<md-button @click="save_profile" v-if="id == whoami">Save Profile</md-button>
|
||||
<md-button @click="show_user_dialog = false">Close</md-button>
|
||||
</md-dialog-actions>
|
||||
</md-dialog>
|
||||
|
Reference in New Issue
Block a user