From d7443edf5828740e2c3bd1ef9fe875fd08e7bf3e Mon Sep 17 00:00:00 2001 From: Scott Comer Date: Fri, 7 Mar 2014 17:23:04 -0600 Subject: [PATCH 1/3] fix case where connection_client_type.sql is boggled by existing connections, and added schema for cities, regions, and countries. --- db/up/add_countries_regions_and_cities.sql | 8 ++++++++ db/up/connection_client_type.sql | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/up/add_countries_regions_and_cities.sql diff --git a/db/up/add_countries_regions_and_cities.sql b/db/up/add_countries_regions_and_cities.sql new file mode 100644 index 000000000..c1c51c34e --- /dev/null +++ b/db/up/add_countries_regions_and_cities.sql @@ -0,0 +1,8 @@ +create table cities (city varchar(255) not null, region varchar(2) not null, regionname varchar(64), countrycode varchar(2) not null, countryname varchar(64)); +insert into cities (city, region, countrycode) select distinct city, region, countrycode from geoiplocations where length(city) > 0 and length(countrycode) > 0; + +create table regions (region varchar(2) not null, regionname varchar(64), countrycode varchar(2) not null); +insert into regions (region, countrycode) select distinct region, countrycode from cities; + +create table countries (countrycode varchar(2) not null, countryname varchar(64)); +insert into countries (countrycode) select distinct countrycode from regions; diff --git a/db/up/connection_client_type.sql b/db/up/connection_client_type.sql index 17aabd21f..b38df8e9d 100644 --- a/db/up/connection_client_type.sql +++ b/db/up/connection_client_type.sql @@ -1 +1,3 @@ -ALTER TABLE connections ADD COLUMN client_type VARCHAR(256) NOT NULL; \ No newline at end of file +ALTER TABLE connections ADD COLUMN client_type VARCHAR(256); +UPDATE connections SET client_type = 'old' WHERE client_type IS NULL; +ALTER TABLE connections ALTER COLUMN client_type SET NOT NULL; From 798ccc452996e7993e500838eef8a7bdc3944759 Mon Sep 17 00:00:00 2001 From: Scott Comer Date: Fri, 7 Mar 2014 17:23:25 -0600 Subject: [PATCH 2/3] fix case where connection_client_type.sql is boggled by existing connections, and added schema for cities, regions, and countries. --- db/manifest | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/manifest b/db/manifest index cc67eec73..2bf2b136d 100755 --- a/db/manifest +++ b/db/manifest @@ -127,4 +127,6 @@ scores_mod_users2.sql user_bio.sql track_changes_counter.sql scores_better_test_data.sql -connection_client_type.sql \ No newline at end of file +connection_client_type.sql +add_countries_regions_and_cities.sql + From 9c2b10dd5f10135083952c67717e8f679d854808 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Fri, 7 Mar 2014 19:56:27 -0500 Subject: [PATCH 3/3] VRFS-1243 VRFS-1310 fix regression in session notifications in sidebar --- web/app/assets/javascripts/sidebar.js | 2 +- .../views/api_users/notification_index.rabl | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/web/app/assets/javascripts/sidebar.js b/web/app/assets/javascripts/sidebar.js index 645683bc2..1c2acdc16 100644 --- a/web/app/assets/javascripts/sidebar.js +++ b/web/app/assets/javascripts/sidebar.js @@ -143,7 +143,7 @@ var template = $('#template-notification-panel').html(); var notificationHtml = context.JK.fillTemplate(template, { notificationId: val.notification_id, - sessionId: val.sessionId, + sessionId: val.session_id, avatar_url: context.JK.resolveAvatarUrl(val.photo_url), text: val.formatted_msg, date: $.timeago(val.created_at) diff --git a/web/app/views/api_users/notification_index.rabl b/web/app/views/api_users/notification_index.rabl index 515a186ec..d0ecbe3ec 100644 --- a/web/app/views/api_users/notification_index.rabl +++ b/web/app/views/api_users/notification_index.rabl @@ -4,4 +4,23 @@ attributes :description, :source_user_id, :target_user_id, :session_id, :recordi node :notification_id do |n| n.id -end \ No newline at end of file +end + +# this has to be flat like this so this payload is the same as the protocol buffer (see initializeActions in sidebar.js) +node :fan_access do |n| + unless n.session_id.blank? + n.session.fan_access + end +end + +node :musician_access do |n| + unless n.session_id.blank? + n.session.musician_access + end +end + +node :approval_required do |n| + unless n.session_id.blank? + n.session.approval_required + end +end