From 8799df8ccdb09114b14742e0493a8ba401688fdf Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Thu, 08 Aug 2013 08:15:30 -0400
Subject: [PATCH] Fix redundant SQL query on contact photo request after photo upload. The query was also invalid in case of uploading photo in contact create form. Move contact photo handling from show.inc into a separate file.

---
 program/js/app.js |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 45a17d6..6f5bfbc 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4995,7 +4995,7 @@
   this.replace_contact_photo = function(id)
   {
     var img_src = id == '-del-' ? this.env.photo_placeholder :
-      this.env.comm_path + '&_action=photo&_source=' + this.env.source + '&_cid=' + this.env.cid + '&_photo=' + id;
+      this.env.comm_path + '&_action=photo&_source=' + this.env.source + '&_cid=' + (this.env.cid || 0) + '&_photo=' + id;
 
     this.set_photo_actions(id);
     $(this.gui_objects.contactphoto).children('img').attr('src', img_src);

--
Gitblit v1.9.1