Vue.component('tf-user', { data: function() { return { users: g_data.users, show_user_dialog: false, show_follow_dialog: false, edit_profile_name: null, edit_profile_description: null, } }, 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}}, '*'); } } }, }, whoami: { get: function() { return g_data.whoami; } }, }, methods: { save_profile: function() { var message = {appendMessage: { type: 'about', about: this.id, name: this.edit_profile_name, description: this.edit_profile_description, }}; window.parent.postMessage(message, '*'); }, }, template: ` {{users[id] && users[id].name ? users[id].name : id}} {{id}} {{users[id] && users[id].name ? users[id].name : id}}
Save Profile Close
`, });