"use strict"; Vue.component('tf-user', { data: function() { return { 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; } }, users: { get: function() { return g_data.users; } }, }, 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, '*'); }, show_user: function() { this.show_user_dialog = true; if (this.id == this.whoami) { this.edit_profile_name = this.users[this.id].name; this.edit_profile_description = this.users[this.id].description; } }, }, template: ` {{users[id] && users[id].name ? users[id].name : id}} {{id}} {{users[id] && users[id].name ? users[id].name : id}}
Save Profile Close
`, });