Vue.component('tf-user', { data: function() { return {users: g_data.users, show_user_dialog: false, show_follow_dialog: false} }, props: ['id'], mounted: function() { window.parent.postMessage({user: this.id}, '*'); }, 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; }, 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) { window.parent.postMessage({appendMessage: {type: "contact", following: true, contact: this.id}}, '*'); } else if (!newValue) { window.parent.postMessage({appendMessage: {type: "contact", following: false, contact: this.id}}, '*'); } } }, }, }, template: ` {{users[id] && users[id].name ? users[id].name : id}} {{id}} {{users[id] && users[id].name ? users[id].name : id}}
{{id}}
{{users[id].description}}
Following
Followers Following
Close
`, });