SendMail mail = new SendMail(new PropertiesManager().getAdminEmailAddress(), toAddresses, subject, body);
if (mail.send("text/html"))
{
rp.setResponse(new ResponseObject("Join Community",true,"Joined community successfully, awaiting owner approval"));
rp.setData(new CommunityApprovalPojo(false));
}
else
{
rp.setResponse(new ResponseObject("Join Community",false,"The system was uable to send an email to the owner"));
}
}
else
{
cp.addMember(pp);
pp.addCommunity(cp);
//write both objects back to db now
/////////////////////////////////////////////////////////////////////////////////////////////////
// TODO (INF-1214): Make this code more robust to handle changes to the community that need to
// Caleb: this means change update to $set
/////////////////////////////////////////////////////////////////////////////////////////////////
DbManager.getSocial().getCommunity().update(query, cp.toDb());
DbManager.getSocial().getPerson().update(queryPerson, pp.toDb());
rp.setResponse(new ResponseObject("Join Community",true,"Joined community successfully"));
rp.setData(new CommunityApprovalPojo(true));
}
}
else
{
rp.setResponse(new ResponseObject("Join Community",false,"You must be invited to this community"));