Skip to content

Commit

Permalink
Socioboard Update 3.0
Browse files Browse the repository at this point in the history
Github Commit
-----------------
Implemented link shortening restriction by plans
Implemented block followers in twitter api
Implemented whitelist followers in twitter api
Implemented keyword follow in twitter api
Implemented relationship status in twitter api
Implemented twitter mutualfans  feature in api
Implemented twitter recent follower list name feature in api
Implemented on twitter user fans details feature in api
Implemented on twitter user friends data feature in api
Sign page email text box issue fixed
Sign up page text box label issue fixed
Group data loading issue fixed
UI in socioboard layout issue fixed
Twitter reports header text issue fixed
  • Loading branch information
socioboard committed Aug 7, 2017
1 parent 6fec94c commit 4597842
Show file tree
Hide file tree
Showing 142 changed files with 2,371 additions and 672 deletions.
Binary file modified .vs/Socioboard/v14/.suo
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Api.Socioboard/Controllers/FacebookController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public IActionResult ReconnectFbAccount(string accessToken, long groupId, long u
}
else
{
return Ok("Oops! login information is wrong , login the profile which to be reconneted");
return Ok("Oops! login information is wrong , login the profile which has to be reconnected");
}

return Ok();
Expand Down
86 changes: 86 additions & 0 deletions src/Api.Socioboard/Controllers/GoogleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,68 @@ public IActionResult AddGoogleAccount(string code, long groupId, long userId)
return BadRequest("Issues while adding account");
}
}

[HttpPost("RecGoogleAccount")]
public IActionResult RecGoogleAccount(string code, long userId)
{

string ret = string.Empty;
string objRefresh = string.Empty;
string refreshToken = string.Empty;
string access_token = string.Empty;
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);

oAuthTokenGPlus ObjoAuthTokenGPlus = new oAuthTokenGPlus(_appSettings.GoogleConsumerKey, _appSettings.GoogleConsumerSecret, _appSettings.GoogleRedirectUri);
oAuthToken objToken = new oAuthToken(_appSettings.GoogleConsumerKey, _appSettings.GoogleConsumerSecret, _appSettings.GoogleRedirectUri);
JObject userinfo = new JObject();
try
{
objRefresh = ObjoAuthTokenGPlus.GetRefreshToken(code);
JObject objaccesstoken = JObject.Parse(objRefresh);
_logger.LogInformation(objaccesstoken.ToString());
try
{
refreshToken = objaccesstoken["refresh_token"].ToString();
}
catch { }
access_token = objaccesstoken["access_token"].ToString();
string user = objToken.GetUserInfo("self", access_token.ToString());
//_logger.LogInformation(user);
userinfo = JObject.Parse(JArray.Parse(user)[0].ToString());
string people = objToken.GetPeopleInfo("self", access_token.ToString(), Convert.ToString(userinfo["id"]));
userinfo = JObject.Parse(JArray.Parse(people)[0].ToString());
}
catch (Exception ex)
{
//access_token = objaccesstoken["access_token"].ToString();
//ObjoAuthTokenGPlus.RevokeToken(access_token);
_logger.LogInformation(ex.Message);
_logger.LogError(ex.StackTrace);
ret = "Access Token Not Found";
return Ok(ret);
}
Domain.Socioboard.Models.Googleplusaccounts gplusAcc = Api.Socioboard.Repositories.GplusRepository.getGPlusAccount(Convert.ToString(userinfo["id"]), _redisCache, dbr);

if (gplusAcc != null && gplusAcc.IsActive == true)
{
if (gplusAcc.UserId == userId)
{

}
//return BadRequest("GPlus account added by other user.");
}

// Adding GPlus Profile
int x = Api.Socioboard.Repositories.GplusRepository.ReconnectGplusAccount(userinfo, dbr, userId, access_token, refreshToken, _redisCache, _appSettings, _logger);
if (x == 1)
{
return Ok("Gplus Account Reconnect Successfully");
}
else
{
return BadRequest("Issues while adding account");
}
}

[HttpGet("GetGplusFeeds")]
public IActionResult GetGplusFeeds(string profileId, long userId, int skip, int count)
Expand Down Expand Up @@ -743,6 +804,31 @@ public IActionResult GetYoutubeAccount(string code, long groupId, long userId)
}


[HttpPost("GetReconnYtAccDetail")]
public IActionResult GetReconnYtAccDetail(string code, long groupId, long userId)
{
try
{
List<Domain.Socioboard.ViewModels.YoutubeProfiles> lstYoutubeProfiles = new List<Domain.Socioboard.ViewModels.YoutubeProfiles>();
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
lstYoutubeProfiles = Helper.GoogleHelper.GetYoutubeAccount(code, _appSettings, dbr);
List<Domain.Socioboard.Models.Groupprofiles> lstGrpProfiles = Repositories.GroupProfilesRepository.getAllGroupProfiles(groupId, _redisCache, dbr);
lstGrpProfiles = lstGrpProfiles.Where(t => t.profileType == Domain.Socioboard.Enum.SocialProfileType.YouTube).ToList();
string[] lstStr = lstGrpProfiles.Select(t => t.profileId).ToArray();
if (lstStr.Length > 0)
{
lstYoutubeProfiles.Where(t => lstStr.Contains(t.YtChannelId)).ToList();
}
return Ok(lstYoutubeProfiles);
}
catch (Exception ex)
{
_logger.LogError("GetGetYoutubeAccount" + ex.StackTrace);
_logger.LogError("GetGetYoutubeAccount" + ex.Message);
return Ok(new List<Domain.Socioboard.ViewModels.YoutubeProfiles>());
}
}

[HttpPost("AddYoutubeChannels")]
public IActionResult AddYoutubeChannels(long groupId, long userId)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Api.Socioboard/Controllers/GroupsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public IActionResult CreateGroup(Domain.Socioboard.Models.Groups group)
long GroupId = dbr.FindSingle<Domain.Socioboard.Models.Groups>(t => t.adminId == group.adminId && t.groupName.Equals(group.groupName)).id;
GroupMembersRepository.createGroupMember(GroupId, user, _redisCache, dbr);
_redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheUserGroups + group.adminId);
return Ok("Group Added");
return Ok("Team Added Successfully ");
}
else
{
Expand Down
1 change: 0 additions & 1 deletion src/Api.Socioboard/Controllers/SocialMessagesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,6 @@ public IActionResult PluginComposemessage(string profile, string twitterText, st
{
string ret = Helper.TwitterHelper.PostTwitterMessage(_appSettings, _redisCache, twitterText, ids[0], userId, imgUrl, true, dbr, _logger);
}

}
else
{
Expand Down
68 changes: 68 additions & 0 deletions src/Api.Socioboard/Controllers/TwitterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ public IActionResult AddTwitterAccount(long userId, long groupId, string request
return Ok(output);
}

[HttpPost("ReconnectTwtAcc")]
public IActionResult ReconnectTwtAcc(long userId, string requestToken, string requestSecret, string requestVerifier, bool follow)
{
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
oAuthTwitter OAuth = new oAuthTwitter(_appSettings.twitterConsumerKey, _appSettings.twitterConsumerScreatKey, _appSettings.twitterRedirectionUrl);
OAuth.AccessToken = requestToken;
OAuth.AccessTokenSecret = requestVerifier;
OAuth.AccessTokenGet(requestToken, requestVerifier);
string output = Repositories.TwitterRepository.ReconnecTwitter(userId, follow, dbr, OAuth, _logger, _redisCache, _appSettings);

return Ok(output);
}


[HttpGet("GetFeeds")]
public IActionResult GetFeeds(string profileId, long userId, int skip, int count)
Expand Down Expand Up @@ -306,10 +320,64 @@ public IActionResult PostTwitterDirectmessage(string profileId, string SenderId,
}


[HttpGet("TwitterMutual")]
public IActionResult TwitterMutual(long groupId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
List<Domain.Socioboard.Models.TwitterMutualFans> lstTwittermutualfans = Helper.TwitterHelper.twittermutual(groupId, dbr, _appSettings);
return Ok(lstTwittermutualfans);
}


[HttpGet("Twitterfans")]
public IActionResult Twitterfans(long groupId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
List<Domain.Socioboard.Models.TwitterMutualFans> lstTwitterUserfans = Helper.TwitterHelper.twitterfans(groupId, dbr, _appSettings);
return Ok(lstTwitterUserfans);
}


[HttpGet("TwitterUserFollowers")]
public IActionResult TwitterUserFollowers(long groupId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
List<Domain.Socioboard.Models.TwitterMutualFans> lstTwitterUserfans = Helper.TwitterHelper.twitterfollowerslist(groupId, dbr, _appSettings);
return Ok(lstTwitterUserfans);
}

[HttpPost("BlocksUser")]
public IActionResult BlocksUser(string profileId, string ToTwitterUserId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
string TwitterRetweet_post = Helper.TwitterHelper.TwitterBlockUsers(profileId, ToTwitterUserId, dbr, _logger, _redisCache, _appSettings);
return Ok(TwitterRetweet_post);
}

[HttpPost("UnBlocksUser")]
public IActionResult UnBlocksUser(string profileId, string ToTwitterUserId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
string TwitterRetweet_post = Helper.TwitterHelper.TwitterUnBlockUsers(profileId, ToTwitterUserId, dbr, _logger, _redisCache, _appSettings);
return Ok(TwitterRetweet_post);
}

[HttpPost("FollowUser")]
public IActionResult FollowUser(string profileId, string ToTwitterUserId)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
string TwitterRetweet_post = Helper.TwitterHelper.TwitterUserFollow(profileId, ToTwitterUserId, dbr, _logger, _redisCache, _appSettings);
return Ok(TwitterRetweet_post);
}

[HttpPost("FriendRelationship")]
public IActionResult FriendRelationship(string profileId, string ToTwitterUserId)
{
Domain.Socioboard.Models.TwitterFriendRelation lstRelationFriends = new Domain.Socioboard.Models.TwitterFriendRelation();
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
lstRelationFriends = Helper.TwitterHelper.TwitterFrindsRelation(profileId, ToTwitterUserId, dbr, _logger, _redisCache, _appSettings);
return Ok(lstRelationFriends);
}

}
}
4 changes: 2 additions & 2 deletions src/Api.Socioboard/Helper/LinkedInHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static string PostLinkedInMessage(string ImageUrl, long userid, string co
try
{

if (!ImageUrl.Contains("https://") && !ImageUrl.Contains("http://"))
if (!ImageUrl.Contains("https://") && !ImageUrl.Contains("http://") && !string.IsNullOrEmpty(ImageUrl))
{
var client = new ImgurClient("5f1ad42ec5988b7", "f3294c8632ef8de6bfcbc46b37a23d18479159c5");
var endpoint = new ImageEndpoint(client);
Expand Down Expand Up @@ -133,7 +133,7 @@ public static string PostLinkedInCompanyPagePost(string upload,string ImageUrl,
{
try
{
if (!ImageUrl.Contains("https://") && !ImageUrl.Contains("http://"))
if (!ImageUrl.Contains("https://") && !ImageUrl.Contains("http://") && !string.IsNullOrEmpty(ImageUrl))
{
var client = new ImgurClient("5f1ad42ec5988b7", "f3294c8632ef8de6bfcbc46b37a23d18479159c5");
var endpoint = new ImageEndpoint(client);
Expand Down
Loading

0 comments on commit 4597842

Please sign in to comment.