Skip to content

Commit

Permalink
socioboard update3.0
Browse files Browse the repository at this point in the history
github Commit
-----------------
1.Settings icon on click homepage dashboard coming issue fixed
2.Dashboard Linked in profile name issue fixed
3.Dashboard Pinterest profile title issue fixed
4.Dashboard add profiles google analytics accounts popup coming again
and again issue fixed
5.After delete all profiles unable to login "Some thing went wrong"
alertify issue fixed
6.Instagram Feeds filter and sorting ui changes
7.Linkedin Profile email issue fixed
8.Agency premium accouts content issue fixed
9.Inbox message notification task creating issue fixed
10.Get in touch refresh issue and image extension issue fixed
11.Groups invite team member modal open issue fixed
12.More number of groups showing issue fixed
13.Twitter account again and again adding issue fixed
14.Smart inbox notification task creating issue fixed
15.added webhook for facebook page feeds
16.added reconnect features for facebook
17.solve issue for added by other user facebook account
18.fixed linkdin profile issue
19.add admin, leave team and delete team functionality in group
20.changes in dashboard
21.adding intallation tool kit file.
22.shareathons ui changes.
23.pinterest feed bugs fixes.
  • Loading branch information
socioboard committed Jul 31, 2017
1 parent c51424f commit 6fec94c
Show file tree
Hide file tree
Showing 151 changed files with 2,757 additions and 539 deletions.
Binary file modified .vs/Socioboard/v14/.suo
Binary file not shown.
146 changes: 146 additions & 0 deletions src/Api.Socioboard/Controllers/FacebookController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public IActionResult AddFacebookAccount(string accessToken, long groupId, long u
}
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
Domain.Socioboard.Models.Facebookaccounts fbacc = Api.Socioboard.Repositories.FacebookRepository.getFacebookAccount(Convert.ToString(profile["id"]), _redisCache, dbr);
List<Domain.Socioboard.Models.Groupprofiles> grpProfiles = Api.Socioboard.Repositories.GroupProfilesRepository.getAllGroupProfiles(groupId, _redisCache, dbr);



//if (grpProfiles.First().profileId == fbacc.FbUserId)
if (fbacc != null && fbacc.IsActive == true)
{
if (fbacc.UserId == userId)
Expand Down Expand Up @@ -89,6 +94,61 @@ public IActionResult AddFacebookAccount(string accessToken, long groupId, long u
}


[HttpPost("ReconnectFbAccount")]
public IActionResult ReconnectFbAccount(string accessToken, long groupId, long userId, string reconnect, string profileId)
{

dynamic profile = FbUser.getFbUser(accessToken);


try
{
string x = Convert.ToString(profile);
_logger.LogError(x);
}
catch { }
if (Convert.ToString(profile) == "Invalid Access Token")
{
return Ok("Invalid Access Token");
}
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
Domain.Socioboard.Models.Facebookaccounts fbacc = Api.Socioboard.Repositories.FacebookRepository.getFacebookAccount(Convert.ToString(profile["id"]), _redisCache, dbr);
Domain.Socioboard.Models.Facebookaccounts fbaccw = Api.Socioboard.Repositories.FacebookRepository.getFacebookAccount(profileId, _redisCache, dbr);
//fbacc = fbacc.Where(t => t.FbUserId.Contains("127471161024815")).ToList();


if (fbacc.FbUserId == profileId)
{
if (fbacc != null && fbacc.IsActive == true)
{
if (fbacc.UserId == userId)
{
Groups ngrp = dbr.Find<Domain.Socioboard.Models.Groups>(t => t.adminId == userId && t.id == groupId).FirstOrDefault();
if (ngrp == null)
{
return Ok("Wrong Group Id");
}
int res = Api.Socioboard.Repositories.FacebookRepository.ReFacebookAccount(profile, FbUser.getFbFriends(accessToken), dbr, userId, ngrp.id, Domain.Socioboard.Enum.FbProfileType.FacebookProfile, accessToken, reconnect, _redisCache, _appSettings, _logger);
if (res == 1)
{
return Ok("Facebook account Reconnect Successfully");
}
else
{
return Ok("Error while Reconnecting Account");
}
}

}
}
else
{
return Ok("Oops! login information is wrong , login the profile which to be reconneted");
}

return Ok();

}

[HttpPost("ComposeMessage")]
public IActionResult ComposeMessage(string message, string profileId, long userId, string imagePath, string link)
Expand Down Expand Up @@ -401,6 +461,92 @@ public IActionResult AddFacebookPages(long userId, long groupId)
return Ok("Page added successfully");
}


[HttpPost("GetFacebookPagesDet")]
public IActionResult GetFacebookPagesDet(string accesstoken, long groupId)
{
try
{
List<Domain.Socioboard.Models.Facebookpage> lstpages = new List<Facebookpage>();
lstpages = Fbpages.Getfacebookpages(accesstoken);
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
List<Domain.Socioboard.Models.Groupprofiles> lstGrpProfiles = Repositories.GroupProfilesRepository.getGroupProfiles(groupId, _redisCache, dbr);
lstGrpProfiles = lstGrpProfiles.Where(t => t.profileType == Domain.Socioboard.Enum.SocialProfileType.FacebookFanPage).ToList();
string[] lstStr = lstGrpProfiles.Select(t => t.profileId).ToArray();
if (lstStr.Length > 0)
{
lstpages.Where(t => lstStr.Contains(t.ProfilePageId)).ToList();
}
return Ok(lstpages);
}
catch (Exception ex)
{
_logger.LogError("GetFacebookPages" + ex.StackTrace);
_logger.LogError("GetFacebookPages" + ex.Message);
return Ok(new List<Domain.Socioboard.Models.Facebookpage>());
}
}

[HttpPost("ReconnFacebookPages")]
public IActionResult ReconnFacebookPages(long userId, long groupId, string accessToken)
{


int invalidaccessToken = 0;
dynamic profile = Fbpages.getFbPageData(accessToken);

try
{
string x = Convert.ToString(profile);
_logger.LogError(x);
}
catch { }
if (Convert.ToString(profile) == "Invalid Access Token")
{
invalidaccessToken++;
}
else
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
Domain.Socioboard.Models.Facebookaccounts fbacc = Api.Socioboard.Repositories.FacebookRepository.getFacebookAccount(Convert.ToString(profile["id"]), _redisCache, dbr);

int isSaved = 0;
if (fbacc != null)
{
fbacc.IsActive = true;
fbacc.UserId = userId;
fbacc.Is90DayDataUpdated = false;
try
{
fbacc.Friends = (Convert.ToInt64(profile["fan_count"]));
}
catch (Exception)
{
fbacc.Friends = 0;
}
try
{
fbacc.coverPic = (Convert.ToString(profile["cover"]["source"]));
}
catch (Exception)
{

}
fbacc.AccessToken = accessToken;
isSaved = dbr.Update<Domain.Socioboard.Models.Facebookaccounts>(fbacc);
if (isSaved>0)
{
return Ok("Page Reconnected Successfully");
}
else
{
return Ok("some thing went wrong");
}
}
}
return Ok("Page reconnect successfully");
}

[HttpGet("GetFacebookPostComment")]
public IActionResult GetFacebookPostComment(string postId)
{
Expand Down
37 changes: 37 additions & 0 deletions src/Api.Socioboard/Controllers/GroupMemberController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,27 @@ public IActionResult GetGroupMembers(long groupId)
return Ok(GroupMembersRepository.getGroupMembers(groupId, _redisCache, dbr));
}

[HttpGet ("GetGroupAdmin")]
public IActionResult GetGroupAdmin(long groupId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
return Ok(GroupMembersRepository.getGroupadmin(groupId, _redisCache, dbr));
}

[HttpGet("DeleteGroup")]
public IActionResult DeleteGroup(long groupId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
return Ok(GroupMembersRepository.adminDelete(groupId, _redisCache, dbr));
}

[HttpGet("LeaveGroup")]
public IActionResult LeaveGroup(long groupId, long userId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
return Ok(GroupMembersRepository.LeaveTeam(groupId, userId, _redisCache, dbr));
}

[HttpPost("ActivateGroupMember")]
public IActionResult ActivateGroupMember(string code, string email)
{
Expand Down Expand Up @@ -148,5 +169,21 @@ public IActionResult ActivateGroupMember(string code, string email)
}
}

[HttpPost("DeleteGroupMembers")]
public IActionResult DeleteGroupMembers(string grpMmbrIdss)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
List<Int64> grpIdsList = grpMmbrIdss.Split(',').Select(Int64.Parse).ToList();
int tempp = Convert.ToInt32(grpIdsList.First());
List<Domain.Socioboard.Models.Groupmembers> lstgrpMembers = dbr.Find<Domain.Socioboard.Models.Groupmembers>(t => grpIdsList.Contains(t.id)).ToList();
dbr.DeleteAllList<Domain.Socioboard.Models.Groupmembers>(lstgrpMembers);
return Ok("Deleted");
}
[HttpGet("RetainGrpMber")]
public IActionResult RetainGrpMber(long userId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
return Ok(GroupMembersRepository.RetainGrpMber(userId, _redisCache, dbr));
}
}
}
45 changes: 43 additions & 2 deletions src/Api.Socioboard/Controllers/GroupProfilesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Api.Socioboard.Model;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Cors;
using Domain.Socioboard.Models;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

Expand Down Expand Up @@ -91,6 +92,48 @@ public IActionResult AddSelectedProfiles(long groupId, long userId)
return Ok();
}

[HttpPost("AddSelectedProfilesForBasicPlan")]
public IActionResult AddSelectedProfilesForBasicPlan(long groupId, long userId)
{
string selectedProfiles = Request.Form["selectedProfiles"];
string[] Profiles = selectedProfiles.Split(',');
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
//User user = dbr.Single<User>(t => t.Id == userId);
//Domain.Socioboard.Enum.SBAccountType accounttype = user.AccountType;
List<Domain.Socioboard.Models.Groupprofiles> lstGrpProfiles = Repositories.GroupProfilesRepository.getAllGroupProfiles(groupId, _redisCache, dbr);
long FBProfiles = dbr.GetCount<Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && (t.profileType == Domain.Socioboard.Enum.SocialProfileType.Facebook || t.profileType == Domain.Socioboard.Enum.SocialProfileType.FacebookFanPage || t.profileType == Domain.Socioboard.Enum.SocialProfileType.FacebookPublicPage));
long TwtProfiles = dbr.GetCount<Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && (t.profileType == Domain.Socioboard.Enum.SocialProfileType.Twitter));
long GplusProfiles = dbr.GetCount<Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && (t.profileType == Domain.Socioboard.Enum.SocialProfileType.GPlus && t.profileType == Domain.Socioboard.Enum.SocialProfileType.GplusPage));
long LinkedInProfiles = dbr.GetCount<Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && (t.profileType == Domain.Socioboard.Enum.SocialProfileType.LinkedIn && t.profileType == Domain.Socioboard.Enum.SocialProfileType.LinkedInComapanyPage));
long InstaProfiles = dbr.GetCount<Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && (t.profileType == Domain.Socioboard.Enum.SocialProfileType.Instagram));
lstGrpProfiles = lstGrpProfiles.Where(t => !Profiles.Contains(t.profileId)).ToList();
long lstFBProfile= lstGrpProfiles.Where(t => !Profiles.Contains(t.profileId) && (t.profileType== Domain.Socioboard.Enum.SocialProfileType.Facebook || t.profileType == Domain.Socioboard.Enum.SocialProfileType.FacebookFanPage || t.profileType == Domain.Socioboard.Enum.SocialProfileType.FacebookPublicPage)).Count();
long lstTwtProfile = lstGrpProfiles.Where(t => !Profiles.Contains(t.profileId) && t.profileType == Domain.Socioboard.Enum.SocialProfileType.Twitter).Count();
long lstInstaProfile = lstGrpProfiles.Where(t => !Profiles.Contains(t.profileId) && t.profileType == Domain.Socioboard.Enum.SocialProfileType.Instagram).Count();
long lstLinkedInProfile = lstGrpProfiles.Where(t => !Profiles.Contains(t.profileId) && (t.profileType == Domain.Socioboard.Enum.SocialProfileType.LinkedIn|| t.profileType == Domain.Socioboard.Enum.SocialProfileType.LinkedInComapanyPage)).Count();
long lstGplusProfile = lstGrpProfiles.Where(t => !Profiles.Contains(t.profileId) && (t.profileType == Domain.Socioboard.Enum.SocialProfileType.GPlus || t.profileType == Domain.Socioboard.Enum.SocialProfileType.GplusPage)).Count();

long FbCount = FBProfiles - lstFBProfile;
long twtCount = TwtProfiles - lstTwtProfile;
long InstaCount = InstaProfiles - lstInstaProfile;
long LinkedInCount = LinkedInProfiles - lstLinkedInProfile;
long GplusCount = GplusProfiles - lstGplusProfile;

if(FbCount>1 || twtCount > 1|| InstaCount > 1|| LinkedInCount > 1|| GplusCount > 1)
{
return BadRequest("As per your plan you can use only one profile per network.Please choose profiles as per your plan");
}
else
{
foreach (var item in lstGrpProfiles)
{
GroupProfilesRepository.DeleteProfile(groupId, userId, item.profileId, _redisCache, dbr, _appSettings);
}
return Ok();
}
//return Ok();

}

[HttpGet("getProfilesAvailableToConnect")]
public IActionResult getProfilesAvailableToConnect(long groupId, long userId)
Expand Down Expand Up @@ -330,7 +373,5 @@ public IActionResult GetPluginProfile(long groupId)
}
return Ok(lstPluginProfile);
}


}
}
29 changes: 23 additions & 6 deletions src/Api.Socioboard/Controllers/GroupsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Domain.Socioboard.Models;
using System.Collections.Generic;
using System.Linq;
using System;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

Expand Down Expand Up @@ -83,14 +84,25 @@ public IActionResult GetUserGroups(long userId)


[HttpGet("GetUserGroupData")]
public IActionResult GetUserGroupData(long userId)
public IActionResult GetUserGroupData(long userId,string groupId)
{
DatabaseRepository dbr = new Model.DatabaseRepository(_logger, _appEnv);
Domain.Socioboard.Models.GetUserGroupData _GetUserGroupData = new Domain.Socioboard.Models.GetUserGroupData();
List<Domain.Socioboard.Models.Groups> lstgroup = dbr.Find<Domain.Socioboard.Models.Groups>(t => t.adminId == userId).ToList();
long[] lstStr = lstgroup.Select(t => t.id).ToArray();
List<Domain.Socioboard.Models.Groupprofiles> lstgrpProfiles = dbr.Find<Domain.Socioboard.Models.Groupprofiles>(t => lstStr.Contains(t.groupId)).ToList();

List<Domain.Socioboard.Models.Groups> lstgroup = new List<Groups>();
List<Domain.Socioboard.Models.Groupmembers> lstgrpmember = new List<Groupmembers>();
lstgrpmember = dbr.Find<Groupmembers>(t => t.userId == userId && t.memberStatus==Domain.Socioboard.Enum.GroupMemberStatus.Accepted).ToList();
long[] lstgrpId = lstgrpmember.Select(t => t.groupid).ToArray();
lstgroup = dbr.Find<Domain.Socioboard.Models.Groups>(t => lstgrpId.Contains(t.id)).ToList();
List<Domain.Socioboard.Models.Groupprofiles> lstgrpProfiles = new List<Groupprofiles>();
if (string.IsNullOrEmpty(groupId))
{
long[] lstStr = lstgroup.Select(t => t.id).ToArray();
lstgrpProfiles = dbr.Find<Domain.Socioboard.Models.Groupprofiles>(t => lstStr.Contains(t.groupId)).ToList();
}
else
{
lstgrpProfiles = dbr.Find<Domain.Socioboard.Models.Groupprofiles>(t =>t.groupId==Convert.ToInt32(groupId)).ToList();
}
Dictionary<long, List<Groupprofiles>> myProfiles = lstgrpProfiles.GroupBy(o => o.groupId).ToDictionary(g => g.Key, g => g.ToList());
_GetUserGroupData.lstgroup = lstgroup;
_GetUserGroupData.myProfiles = myProfiles;
Expand All @@ -103,7 +115,12 @@ public IActionResult GetUserGroupsCount(long userId)
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
return Ok(GroupsRepository.getAllGroupsofUserCount(userId, _redisCache, dbr));
}

[HttpGet("GetUserGroupsMembersCount")]
public IActionResult GetUserGroupsMembersCount(long userId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
return Ok(GroupsRepository.getMemberCount(userId, _redisCache, dbr));
}
[HttpPost("AddSelectedGroups")]
public IActionResult AddSelectedGroups(long userId)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Api.Socioboard/Controllers/SocialMessagesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
using Api.Socioboard.Repositories;
using Domain.Socioboard.Models.Mongo;
using MongoDB.Bson;
using Imgur.API.Authentication.Impl;
using Imgur.API.Endpoints.Impl;
using Imgur.API.Models;
using System.Net;
using Newtonsoft.Json.Linq;
using System.Drawing;
using Api.Socioboard.Helper;
using Imgur.API.Authentication.Impl;
using Imgur.API.Endpoints.Impl;
using Imgur.API.Models;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

Expand Down
Loading

0 comments on commit 6fec94c

Please sign in to comment.