From 5ff57a9fc00bdb9c0135f7cc9b0a61d571545416 Mon Sep 17 00:00:00 2001 From: Sathishkumar Date: Mon, 10 Jun 2019 17:24:43 +0530 Subject: [PATCH] Socioboard 3.0.58 --- .vs/Socioboard/v14/.suo | Bin 51200 -> 56832 bytes .../Controllers/GroupMemberController.cs | 52 ++++++- .../Controllers/NotificationsController.cs | 106 ++++++++++--- .../Models/InvitationDetails.cs | 23 +++ .../controllers/notificationallcontroller.js | 97 ++++++++++-- .../views/settings/notification_all.html | 143 +++++++++++------- .../socioboard/views/shared/header.html | 8 +- 7 files changed, 326 insertions(+), 103 deletions(-) create mode 100644 src/Domain.Socioboard/Models/InvitationDetails.cs diff --git a/.vs/Socioboard/v14/.suo b/.vs/Socioboard/v14/.suo index 6412b07bfaf0e03755a3f5e3a2c54a9bb2f88d27..6a059d8dcdca8484b6c3e7ed1766160a86a03478 100644 GIT binary patch literal 56832 zcmeHQ3zS<`xjxg<7p>At%Uc+rlu{-!GkLdA$RwGz^f9H=mo&9xlFUrnOj43eAM^p% zf`H=HUJy{UfFM^yEONbq7o_wmpduhDcoh(ktJlXBm9^9*OS#{7&e_SynUmy9a;DQq zcGj2k+GqcJ?|(o3{qMd1^ZavDUc2+bQ(l*JZmu+1`sce7q_LX&O*kJVt|v><1oir# z@4ovkZ;u9W+Hi+a4lI*0_~oT$DJ-RN%t~9yO4IHHX-t9VXHc)I9hh&fhm)xiJZce~6b2j;!0ldEnO%@S5xs_lNuFP-!vBq%~1JI&o}M&l%5d z^_+fYxD2=)pkKX<;(iQR3G`_E^y0h^NCH|O=-;pR`e4@oPcC}n z8P@;fktT^uffM!bVAlVKKzF3;|BMl=|9PbUWwri`^20WS?EuRf^M>u&djLLX+d4)) z=k;+op9;|L`*1uKU~*W$rU54aCjut{Cj+MdrvhxJ-w&J)u&-zaSijB!&IYCf=KwQ+ zbAg$_EPymy)T3QJw&KY8&u5~3^yAtM_|*HX|4Y?#`Wp_nW(eU&;CC(XAz&R42lR1b zTGkuf-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G=e_ z9y+feMg^#hoJa3hGgMuT%IWv7j~C$}7CjfPTvYS_wcVWAD89N*-IrNARThb@FiZs8 zve-(|f9@G?5alc}ZqZw{bWS>H)<^jEsr*u}uY8HOx1-k^=xUe5FWgYIWQn)|V6g_5 zi9T6{ri>M1QIaD~nTVv=5_)CaUi>ER#m}U;$|=15AXZllfg8r?PZ#nTgm2}*=!f}` zeR^&gec{EMHYP2UFkQk@ka~HLodV~jdKh!%f#YHUT)kn3z%@4+0|#m{z~eH4=|07Ji1_)G`yQaucqjDk5uypbuQ&I`3d(S;M2Yf{89u+3{m8))0d(D37BVL@CYknL^w9NL3_7lEMLXl2e*oUh+;;!~ diff --git a/src/Api.Socioboard/Controllers/GroupMemberController.cs b/src/Api.Socioboard/Controllers/GroupMemberController.cs index 41cd1a249..ef5bed76b 100644 --- a/src/Api.Socioboard/Controllers/GroupMemberController.cs +++ b/src/Api.Socioboard/Controllers/GroupMemberController.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; @@ -43,7 +44,7 @@ public GroupMemberController(ILogger logger, IEmailSender emailS /// /// [HttpPost("InviteGroupMembers")] - public IActionResult InviteGroupMembers(long groupId, string members) + public IActionResult InviteGroupMembers(long groupId, string members) { List lstGrpMembers = new List(); if (string.IsNullOrEmpty(members)) @@ -53,7 +54,7 @@ public IActionResult InviteGroupMembers(long groupId, string members) else { string[] lstmem = members.Split(';'); - foreach(var item in lstmem) + foreach (var item in lstmem) { if (!string.IsNullOrEmpty(item)) { @@ -100,6 +101,26 @@ public IActionResult InviteGroupMembers(long groupId, string members) if (temp == null) { dbr.Add(member); + + var savedMembers = dbr.Find(t => t.groupid == groupId && t.email == member.email).FirstOrDefault(); + + var lstnotifications = dbr.Single(t => t.MsgId == savedMembers.id); + + if (lstnotifications == null && savedMembers != null) + { + var notify = new Notifications + { + MsgId = savedMembers.id, + MsgStatus = "Invited", + notificationtime = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), + NotificationType = grp.groupName, + ReadOrUnread = "Unread", + UserId = member.userId + }; + dbr.Add(notify); + } + + _redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheGroupMembers + groupId); string path = _appEnv.WebRootPath + "\\views\\mailtemplates\\groupinvitation.html"; string html = System.IO.File.ReadAllText(path); @@ -121,7 +142,7 @@ public IActionResult GetGroupMembers(long groupId) return Ok(GroupMembersRepository.getGroupMembers(groupId, _redisCache, dbr)); } - [HttpGet ("GetGroupAdmin")] + [HttpGet("GetGroupAdmin")] public IActionResult GetGroupAdmin(long groupId) { DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv); @@ -146,10 +167,10 @@ public IActionResult LeaveGroup(long groupId, long userId) public IActionResult ActivateGroupMember(string code, string email) { DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv); - Domain.Socioboard.Models.Groupmembers grpMember = dbr.Find(t => t.email.Equals(email)&&t.memberCode.Equals(code)).FirstOrDefault(); - if(grpMember != null) + Domain.Socioboard.Models.Groupmembers grpMember = dbr.Find(t => t.email.Equals(email) && t.memberCode.Equals(code)).FirstOrDefault(); + if (grpMember != null) { - if(grpMember.userId == 0) + if (grpMember.userId == 0) { User inMemUser = _redisCache.Get(email.Trim()); if (inMemUser == null) @@ -169,6 +190,25 @@ public IActionResult ActivateGroupMember(string code, string email) } } + + /// + /// + /// + /// + /// + /// + [HttpPost("DeclineGroupMember")] + public IActionResult DeclineGroupMember(string code, string email) + { + var dbr = new DatabaseRepository(_logger, _appEnv); + var grpMember = dbr.Find(t => t.email.Equals(email) && t.memberCode.Equals(code)).FirstOrDefault(); + if (grpMember == null) + return Ok("Error!"); + + dbr.Delete(grpMember); + return Ok("deleted"); + } + [HttpPost("DeleteGroupMembers")] public IActionResult DeleteGroupMembers(string grpMmbrIdss) { diff --git a/src/Api.Socioboard/Controllers/NotificationsController.cs b/src/Api.Socioboard/Controllers/NotificationsController.cs index 5c0049eb6..ce97378de 100644 --- a/src/Api.Socioboard/Controllers/NotificationsController.cs +++ b/src/Api.Socioboard/Controllers/NotificationsController.cs @@ -47,7 +47,7 @@ public IActionResult FindNotifications(long userId) { foreach (Notifications notify in lstnotifications) { - ScheduledMessage schedulemsg = dbr.Single(t => t.id == notify.MsgId && t.userId==userId); + ScheduledMessage schedulemsg = dbr.Single(t => t.id == notify.MsgId && t.userId == userId); if (schedulemsg != null) { lstschedulemsg.Add(schedulemsg); @@ -72,7 +72,7 @@ public IActionResult FindNotifications(long userId) { return NotFound(); } - + } @@ -83,15 +83,15 @@ public IActionResult FindAllNotifications(long userId, int skip, int count) { DatabaseRepository dbr = new DatabaseRepository(_logger, _env); List lstschedulemsg = new List(); - List lstnotifications = dbr.FindWithRangeDesct(t => t.UserId == userId, skip, count, t=>t.Id).ToList(); + List lstnotifications = dbr.FindWithRangeDesct(t => t.UserId == userId && t.MsgStatus != "Invited", skip, count, t => t.Id).ToList(); foreach (Notifications notify in lstnotifications) { - ScheduledMessage schedulemsg = dbr.Single(t => t.id == notify.MsgId && t.userId==userId); - if(schedulemsg !=null) + ScheduledMessage schedulemsg = dbr.Single(t => t.id == notify.MsgId && t.userId == userId); + if (schedulemsg != null) { lstschedulemsg.Add(schedulemsg); } - + } if (lstschedulemsg != null) { @@ -102,14 +102,60 @@ public IActionResult FindAllNotifications(long userId, int skip, int count) return NotFound(); } } - catch(Exception ex) + catch (Exception ex) + { + return NotFound(); + } + + + } + + + + /// + /// + /// + /// + /// + /// + /// + [HttpGet("FindAllInvitationNotifications")] + public IActionResult FindAllInvitationNotifications(long userId, int skip, int count) + { + try + { + var dbr = new DatabaseRepository(_logger, _env); + var lstInvitations = new List(); + var notifications = dbr.FindWithRangeDesct(t => t.UserId == userId && t.MsgStatus == "Invited", skip, count, t => t.Id).ToList(); + foreach (var notify in notifications) + { + var groupMember = dbr.Single(t => t.id == notify.MsgId && t.userId == userId); + if (groupMember == null) + continue; + var invitation = new InvitationDetails + { + GroupId = groupMember.groupid, + Message = notify.NotificationType, + EmailId = groupMember.email, + MemberCode = groupMember.memberCode, + UserId = groupMember.userId, + NotifyId = notify.Id + }; + lstInvitations.Add(invitation); + + } + return Ok(lstInvitations); + } + catch (Exception ex) { return NotFound(); } - + } + + [HttpGet("UpdateNotifications")] public IActionResult UpdateNotifications(long userId) { @@ -132,12 +178,30 @@ public IActionResult UpdateNotifications(long userId) return NotFound(); } } - catch(Exception ex) + catch (Exception ex) { return NotFound(); } - + + } + + + + [HttpGet("DeleteNotifications")] + public IActionResult DeleteNotifications(long notifyId) + { + try + { + var dbr = new DatabaseRepository(_logger, _env); + var notifyObject = dbr.FindFirstMatch(t => t.Id == notifyId); + dbr.Delete(notifyObject); + return Ok("deleted"); + } + catch (Exception ex) + { + return NotFound(); + } } @@ -145,12 +209,12 @@ public IActionResult UpdateNotifications(long userId) public IActionResult ChangePasswordDetail(long userId) { try - { + { MongoRepository mongorepo = new MongoRepository("FacebookPasswordChangeUserDetail", _appSettings); DatabaseRepository dbr = new DatabaseRepository(_logger, _env); List datalst = dbr.Find(t => t.UserId == userId).ToList(); - // Domain.Socioboard.Models.User userDet = dbr.FindSingle(t => t.Id == userId); - var result = mongorepo.Find(t => t.userId == userId && t.status==false); + // Domain.Socioboard.Models.User userDet = dbr.FindSingle(t => t.Id == userId); + var result = mongorepo.Find(t => t.userId == userId && t.status == false); var task = Task.Run(async () => { return await result; @@ -158,7 +222,7 @@ public IActionResult ChangePasswordDetail(long userId) int count = task.Result.Count; IList lstfbpasschange = task.Result; List lstfab = new List(); - foreach(var lstfb in lstfbpasschange) + foreach (var lstfb in lstfbpasschange) { if (lstfb.message.Contains("password")) { @@ -171,11 +235,11 @@ public IActionResult ChangePasswordDetail(long userId) { } - + } - + } - if (count>0) + if (count > 0) { return Ok(lstfab); } @@ -199,7 +263,7 @@ public IActionResult ChangeStatus(string profileId) // DatabaseRepository dbr = new DatabaseRepository(_logger, _env); // List datalst = dbr.Find(t => t.UserId == userId).ToList(); // Domain.Socioboard.Models.User userDet = dbr.FindSingle(t => t.Id == userId); - // Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail lstchanges = new Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail(); + // Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail lstchanges = new Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail(); var result = mongorepo.Find(t => t.profileId == profileId && t.status == false); var task = Task.Run(async () => { @@ -208,7 +272,7 @@ public IActionResult ChangeStatus(string profileId) int count = task.Result.Count; if (count > 0) { - + var builders = Builders.Filter; FilterDefinition filter = builders.Eq("profileId", profileId); var update = Builders.Update.Set("status", true); @@ -229,14 +293,14 @@ public IActionResult getfbchangeprofile(long userId) DatabaseRepository dbr = new DatabaseRepository(_logger, _env); List datalst = dbr.Find(t => t.UserId == userId).ToList(); Domain.Socioboard.Models.User userDet = dbr.FindSingle(t => t.Id == userId); - var result = mongorepo.Find(t => t.userId == userId && t.status==false); + var result = mongorepo.Find(t => t.userId == userId && t.status == false); var task = Task.Run(async () => { return await result; }); int count = task.Result.Count; IList lstfbpasschange = task.Result; - if (count>0) + if (count > 0) { return Ok(lstfbpasschange); } diff --git a/src/Domain.Socioboard/Models/InvitationDetails.cs b/src/Domain.Socioboard/Models/InvitationDetails.cs new file mode 100644 index 000000000..fba972a92 --- /dev/null +++ b/src/Domain.Socioboard/Models/InvitationDetails.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Domain.Socioboard.Models +{ + public class InvitationDetails + { + + public virtual long GroupId { get; set; } + + public virtual string Message { get; set; } + + public virtual string EmailId { get; set; } + + public virtual string MemberCode { get; set; } + + public virtual long UserId { get; set; } + + public virtual Int64 NotifyId { get; set; } + } +} diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/notificationallcontroller.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/notificationallcontroller.js index 6b0b9c212..4ffc1e40b 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/notificationallcontroller.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/notificationallcontroller.js @@ -9,32 +9,101 @@ SocioboardApp.controller('NotificationAllController', function ($rootScope, $sco var startNotify = 0; $scope.notifycount = startNotify; $scope.LoadAllNotifications = function () { - + $http.get(apiDomain + '/api/Notifications/FindAllNotifications?userId=' + $rootScope.user.Id + '&skip=' + startNotify + '&count=' + 10) .then(function (response) { + debugger; $scope.lstnotifications = response.data; $scope.notifycount = $scope.notifycount + 10; $http.get(apiDomain + '/api/Notifications/UpdateNotifications?userId=' + $rootScope.user.Id) - .then(function (response) { - $scope.updated = response.data; - }) + .then(function (response) { + $scope.updated = response.data; + }) + .catch((error) => { + debugger; + }); }, function (reason) { $scope.error = reason.data; }); // end codes to load recent Feeds + + $http.get(apiDomain + '/api/Notifications/FindAllInvitationNotifications?userId=' + $rootScope.user.Id + '&skip=' + startNotify + '&count=' + 10) + .then(function (response) { + $scope.lstinvitationnotifications = response.data; + debugger; + }, function (reason) { + $scope.error = reason.data; + }); + } + + + $scope.acceptInviations = function (email, memberCode, notifyId) { + $http.post(apiDomain + '/api/GroupMember/ActivateGroupMember?code=' + memberCode + '&email=' + email) + .then(function (response) { + debugger; + if (response.data === "updated") { + $scope.lstinvitationnotifications = $scope.lstinvitationnotifications.filter(element => { + return element.memberCode !== memberCode && element.email !== email; + }); + } + }, function (reason) { + $scope.error = reason.data; + }) + .then(() => { + return $http.get(apiDomain + '/api/Notifications/DeleteNotifications?notifyId=' + notifyId); + }) + .then(function (response) { + debugger; + if (response.data === "deleted") { + } + }, function (reason) { + $scope.error = reason.data; + }) + .catch((error) => { + debugger; + }); + debugger; } + + $scope.declineInviations = function (email, memberCode, notifyId) { + $http.post(apiDomain + '/api/GroupMember/DeclineGroupMember?code=' + memberCode + '&email=' + email) + .then(function (response) { + debugger; + if (response.data === "deleted") { + $scope.lstinvitationnotifications = $scope.lstinvitationnotifications.filter(element => { + return element.memberCode !== memberCode && element.email !== email; + }); + } + }, function (reason) { + $scope.error = reason.data; + }) + .then(() => { + return $http.get(apiDomain + '/api/Notifications/DeleteNotifications?notifyId=' + notifyId); + }) + .then(function (response) { + debugger; + if (response.data === "deleted") { + } + }, function (reason) { + $scope.error = reason.data; + }) + .catch((error) => { + debugger; + }); + } + $scope.LoadAllNotifications(); $scope.changepass = function () { - + $http.get(apiDomain + '/api/Notifications/ChangePasswordDetail?userId=' + $rootScope.user.Id) .then(function (response) { - $scope.lstChangePass = response.data; + $scope.lstChangePass = response.data; var abc = $scope.lstChangePass; $scope.lstsinglepass = []; - angular.forEach($scope.lstChangePass, function (value, key) { - $scope.lstsinglepass.push(value.profileName); + angular.forEach($scope.lstChangePass, function (value, key) { + $scope.lstsinglepass.push(value.profileName); }); console.log($scope.lstsinglepass); if (response.data != "No Data") { @@ -43,9 +112,9 @@ SocioboardApp.controller('NotificationAllController', function ($rootScope, $sco else { $scope.notifycount = 0; } - + console.log("data", $scope.notifycount); - + }, function (reason) { $scope.error = reason.data; }); @@ -65,7 +134,7 @@ SocioboardApp.controller('NotificationAllController', function ($rootScope, $sco $http.get(apiDomain + '/api/Notifications/getfbchangeprofile?userId=' + $rootScope.user.Id) .then(function (response) { $scope.lstfbprofile = response.data; - // console.log($scope.lstfbprofile); + // console.log($scope.lstfbprofile); //var abc = $scope.lstfbprofile; //$scope.notifycount = $scope.notifycount + 10; @@ -80,7 +149,7 @@ SocioboardApp.controller('NotificationAllController', function ($rootScope, $sco $scope.reconnect = function () { var facebookid = $scope.lstfbprofile; console.log($scope.lstfbprofile); - // console.log("abcd", $scope.lstfbprofile.userPrimaryEmail); + // console.log("abcd", $scope.lstfbprofile.userPrimaryEmail); $http.get(domain + '/socioboard/recfbcont?id=' + facebookid + '&fbprofileType=' + 0) .then(function (response) { window.location.href = response.data; @@ -93,7 +162,7 @@ SocioboardApp.controller('NotificationAllController', function ($rootScope, $sco // start codes to load recent Feeds - $scope.loadmore = function () { + $scope.loadmore = function () { $("#load_more_toggle").addClass("hide"); $http.get(apiDomain + '/api/Notifications/FindAllNotifications?userId=' + $rootScope.user.Id + '&skip=' + $scope.notifycount + '&count=' + 10) .then(function (response) { @@ -106,7 +175,7 @@ SocioboardApp.controller('NotificationAllController', function ($rootScope, $sco }) }, function (reason) { $scope.error = reason.data; - }); + }); } // end codes to load recent Feeds }); diff --git a/src/Socioboard/wwwroot/contents/socioboard/views/settings/notification_all.html b/src/Socioboard/wwwroot/contents/socioboard/views/settings/notification_all.html index 75e9cc73a..c1c956191 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/views/settings/notification_all.html +++ b/src/Socioboard/wwwroot/contents/socioboard/views/settings/notification_all.html @@ -1,17 +1,19 @@
@@ -22,54 +24,79 @@
Your notifications
- - +
+
+ +
+
+ + + + + +
+
+
    +
  • + Team Name: {{notify.message}} +

    Team invites you to join!!

    + + Accept + Decline + +
  • +
+ + +
+
+ - - -
diff --git a/src/Socioboard/wwwroot/contents/socioboard/views/shared/header.html b/src/Socioboard/wwwroot/contents/socioboard/views/shared/header.html index 73f58aa63..e392d2e9e 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/views/shared/header.html +++ b/src/Socioboard/wwwroot/contents/socioboard/views/shared/header.html @@ -141,12 +141,12 @@

--> - + + + {{notifycount}} +