diff --git a/App/StackExchange.DataExplorer/Controllers/QueryController.cs b/App/StackExchange.DataExplorer/Controllers/QueryController.cs index 06e1ec06..247f1980 100644 --- a/App/StackExchange.DataExplorer/Controllers/QueryController.cs +++ b/App/StackExchange.DataExplorer/Controllers/QueryController.cs @@ -597,8 +597,7 @@ private void SetCommonQueryViewData(Site site, string header) Site = site; SetHeader(header); SelectMenuItem("Compose Query"); - - ViewData["GuessedUserId"] = Site.GuessUserId(CurrentUser); + ViewData["Tables"] = Site.GetTableInfos(); } } diff --git a/App/StackExchange.DataExplorer/Controllers/QuerySetController.cs b/App/StackExchange.DataExplorer/Controllers/QuerySetController.cs index 24ca13a6..a65f8184 100644 --- a/App/StackExchange.DataExplorer/Controllers/QuerySetController.cs +++ b/App/StackExchange.DataExplorer/Controllers/QuerySetController.cs @@ -114,8 +114,6 @@ private ActionResult ShowCommon(Revision revision, string slug, bool latest) SetHeader(title); SelectMenuItem("Queries"); - ViewData["GuessedUserId"] = Site.GuessUserId(CurrentUser); - // Need to revamp voting process int totalVotes = Current.DB.Query(@" SELECT diff --git a/App/StackExchange.DataExplorer/Models/Site.cs b/App/StackExchange.DataExplorer/Models/Site.cs index df4743e8..c8fe81ee 100644 --- a/App/StackExchange.DataExplorer/Models/Site.cs +++ b/App/StackExchange.DataExplorer/Models/Site.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Configuration; using System.Data.SqlClient; -using System.Web; using StackExchange.DataExplorer.Helpers; using Dapper; using System.Linq; @@ -137,52 +136,6 @@ public void UpdateStats() Current.DB.Sites.Update(Id, new {TotalQuestions, TotalAnswers, TotalComments, LastPost, TotalUsers, TotalTags }); } - public int? GuessUserId(User user) - { - if (user.IsAnonymous || !AppSettings.GuessUserId) return null; - - string cacheKey = "UserIdForSite" + Id + "_" + user.Id; - - var currentId = HttpContext.Current.Session[cacheKey] as int?; - if (currentId == null) - { - int? id = FindUserId(user); - if (id != null) - { - HttpContext.Current.Cache[cacheKey] = id; - } - } - - currentId = HttpContext.Current.Cache[cacheKey] as int?; - if (currentId == null) - { - HttpContext.Current.Cache[cacheKey] = -1; - } - - return currentId != -1 ? currentId : null; - } - - private int? FindUserId(User user) - { - if (!user.IsAnonymous && user.Email != null) - { - using (var cnn = GetOpenConnection()) - { - string hash = Util.GravatarHash(user.Email); - try - { - return cnn.Query("select top 1 Id from Users where EmailHash = @hash order by Reputation desc", new {hash}).FirstOrDefault(); - } - catch - { - // allow this to fail, its not critical - } - } - } - return null; - } - - /// /// Get the sites schema /// diff --git a/App/StackExchange.DataExplorer/Models/StackEntities/StackExchangeData.Designer.cs b/App/StackExchange.DataExplorer/Models/StackEntities/StackExchangeData.Designer.cs index b70403ba..efa0e48f 100644 --- a/App/StackExchange.DataExplorer/Models/StackEntities/StackExchangeData.Designer.cs +++ b/App/StackExchange.DataExplorer/Models/StackEntities/StackExchangeData.Designer.cs @@ -1411,30 +1411,6 @@ public static User CreateUser(global::System.Int32 id) partial void OnReputationChanging(Nullable value); partial void OnReputationChanged(); - /// - /// No Metadata Documentation available. - /// - [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] - [DataMemberAttribute()] - public global::System.String EmailHash - { - get - { - return _EmailHash; - } - set - { - OnEmailHashChanging(value); - ReportPropertyChanging("EmailHash"); - _EmailHash = StructuralObject.SetValidValue(value, true, "EmailHash"); - ReportPropertyChanged("EmailHash"); - OnEmailHashChanged(); - } - } - private global::System.String _EmailHash; - partial void OnEmailHashChanging(global::System.String value); - partial void OnEmailHashChanged(); - /// /// No Metadata Documentation available. /// diff --git a/App/StackExchange.DataExplorer/Models/StackEntities/StackExchangeData.edmx b/App/StackExchange.DataExplorer/Models/StackEntities/StackExchangeData.edmx index 8c710e4d..7fc75195 100644 --- a/App/StackExchange.DataExplorer/Models/StackEntities/StackExchangeData.edmx +++ b/App/StackExchange.DataExplorer/Models/StackEntities/StackExchangeData.edmx @@ -71,7 +71,6 @@ - @@ -205,7 +204,6 @@ - @@ -341,7 +339,6 @@ - diff --git a/App/StackExchange.DataExplorer/StackExchange.DataExplorer.csproj b/App/StackExchange.DataExplorer/StackExchange.DataExplorer.csproj index b997d0c4..d26a0c9b 100644 --- a/App/StackExchange.DataExplorer/StackExchange.DataExplorer.csproj +++ b/App/StackExchange.DataExplorer/StackExchange.DataExplorer.csproj @@ -475,7 +475,6 @@ - diff --git a/App/StackExchange.DataExplorer/Views/Shared/GuessedUserId.cshtml b/App/StackExchange.DataExplorer/Views/Shared/GuessedUserId.cshtml deleted file mode 100644 index ffc24efe..00000000 --- a/App/StackExchange.DataExplorer/Views/Shared/GuessedUserId.cshtml +++ /dev/null @@ -1,10 +0,0 @@ -@{ - if (ViewData["GuessedUserId"] != null) - { - var guessedUserId = @ViewData["GuessedUserId"]; - } - else - { - var guessedUserId = ""; - } -} diff --git a/App/StackExchange.DataExplorer/Views/Shared/Master.cshtml b/App/StackExchange.DataExplorer/Views/Shared/Master.cshtml index a9360ff9..6394c4b4 100644 --- a/App/StackExchange.DataExplorer/Views/Shared/Master.cshtml +++ b/App/StackExchange.DataExplorer/Views/Shared/Master.cshtml @@ -20,7 +20,7 @@