-
-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Folder Selection for Group Inbound email Folders not working in user Profile #277
Comments
Other related issues I'm working on together with this one... Update Delete.php to mark group folders as deleted Update Folders to Mark Group Folders =1 Update SugarFolders.php Not returning User Accessible inbound accounts (group) |
Ok, so I've done a bunch of changes to get group folders working properly and allow them to be managed by security groups. NOTE: This only works completely on 7.13+ because in prior versions security groups are not related to Inbound email accounts. To get Group Email Working:In SugarFolders.php – save($addSubscriptions)Modifications to mark group folders with is_group=1 on creation or edit of the inbound email account. In SugarFolders.php – retrieveFoldersForProcessingChanges:
/includes/SugarFolders/ Sugarfolders.php – getFoldersForSettingsFilter out duplicates and also child folders. Add private function getChildFolders to ID child folders from the array so that they are removed. /includes/SugarFolders/ Sugarfolders.php – getChildFolders /moldules/Emails/javascript/ EmailUI.js – updateSubscriptions()Change updateSubscriptions function() this is necessary so that the select function works properly and no need to add the groupfolders twice. /modules/Emails/javascript/ajax.js settingsFolderRefresh: functionThis is necessary because the click selection isn’t working properly. This re-written function allows user to select folders and also to deal with groupFolders from the JSON array, also skip the –none—in group folders array so it doesn’t appear twice. Also ensure that the initial state of –None—is always deselected. /modules/InboundEmail/Delete.php –add additional codeAdd code to call the delete() fuction in Sugarfolders.php so that folders of deleted inbound accounts are marked as deleted=1 Other notes:
|
Here's a video walkthrough of the changes working: |
Ok so still have some work to do. These mods work perfectly on 7.13 but not on 8. I've got some more troubleshooting to do. |
So I've troubleshooted why it doesn't work in Version 8. The php is all fine, the JSON array it outputs is all fine the problem is with the JS. In 7 \public\legacy\modules\Emails\javascript\ajax.js function: settingsFolderRefresh populates the selection window for folders. However, in 8 this doesn't seem to be used. I've done some logging to output to console and it doesn't seem to be getting executed. Not sure if it's a cache issue or there is other JS that is populating this select table in version 8 Anyone have any ideas? |
Ok good news. The changes work in SuiteCRM 8. I was a cache issue. Had to put in developer mode and rebuild all the JS stuff for it to work. Anyone got a better way of flushing all the JS caches? |
Hi @pstevens71 Unfortunately its still not working for me, when the user goes to their profile and in email setting Folder Management it only shows --None-- and when clicked I get this:
|
I have tested this fix 7.12, 7.13 and 8. something (can't remember). It does work in every case so far. To flush the cache you need to shift F5 numerous times after doing all the JS rebuild items in R&R. Shift F5 when user loads, shift F5 when popup comes up. Also, its key you assign the account to a security group and that the user is in the same security group. If it still doesn't work, double check you have implemented all the changes (they are numerous). Also, from looking at your FATAL looks like your inbound email account is not setup correctly and not connecting. Check your credentials. |
Thanks for that. It now works after I did the full js rebuilds and cleared the browser cache. I'm unable to delete emails from IMAP but its probably an unrelated issue. I'll search and report is seperately. |
Just a new update, one of my employees has nothing appearing in the inbox, but another does and my admin account also does. When I watch the logs the only difference in the output is that the one that does not work shows this: |
Sounds like the user isn't subscribed to the folder or isn't in the security group. |
Agreed however user is definitely in the security group and is unable to subscribe to any folders because nothing appears in the list. On each refresh attempt that's where the error get restated. |
User needs to have at least one email account before being able to subscribe to group folders. That's one quirk I haven't been able to delve into yet. |
@pstevens71 Would it be possible to display that error message on the page. So they'll instantly understand the user must add at least one email account. |
Hey @chris001 the challenge is to figure out where in all the code the problem is. Once I do that, I may as well just fix it rather than changing the error message. Another quirk I found is if you "bulk delete" an inbound email account rather than delete one from inside the account, it doesn't call the delete function to clean up the subscribed folders (which I just recently fixed). It seems like every fix leads to 2 more! LOL. |
Would it be doable to make this into a single PR, with all commits squashed into a single commit? If so, it might be more palatable for SA to merge it into 7.x if they haven't already. From there the 7.x changes should get automatically get used in 8.x thru |
Just some feedback, I upgraded to 7.14.2 and I can't get groups emails to work, I even promoted one effected user to system administrator and it she still couldn't see group emails. So maybe this no longer works for the latest 7.x release. |
It's key that you add group users to a security group that also contains the email. I just upgraded my dev to 7.14.2. I'll give the patch another try and see if it still works. Another tip us do all the JS rebuild stuff after you apply ghe changes. |
Thanks for the reply, I logged in as that user and edited their profile, then I was able to select the email from there and now it does work! |
I posted a video on the SuiteCRM community forum of how it all works. Worth a watch. |
Today I'm combining your Group Inbound PRs into one, and will submit them to your 7.14.2 (hotfix) repo @pstevens71 |
Thanks @chris001 I've done a lot of testing with version 7 and installed it in about half a dozen installation and so has a bunch of people in the forums who have tried it with success. However, I've haven't really thoroughly tested it on 8 yet. |
I have a problem where if I reply to an email all previous email thread is deleted and only my signature is shown, similarly if I select an email template when switching signatures/accounts I loose all or sometimes part of the template content. |
@brendan-pike Can you list the PR's you applied to your server? To know which PR's are involved in your issue. |
I followed the instructions in comment #issuecomment-1581126038 so: |
hey @brendan-pike did your problems come only after you applied the patches? |
@brendan-pike just did some testing in 8.5 (I'll have to upgrade my 7 version to current for testing later). Everything works as expected. When I reply in a group account, I absolutely lose my personal signature because I am replying from the group account. The behavior as a user, or admin is exactly the same. There are no other options to reply from but the group account. This is the way it is, the changes do not affect this behaviour. It would be good though to be able to reply from any of your email addresses. I did not lose any of the email content when replying to a group account email either as Admin or as a user. I'll test version 7 later tonight when I get a chance to upgrade my dev. But I'd be surprised if the changes above affected what appears in the body of the reply window. What happens if you add the email account as a "personal" account and then reply to? |
Ok just tested in 7.14.2 WITHOUT the group email patch. And I'm experiencing what you describe. When I reply and the switch to a different reply account, all the content in the body of the email disappears. When I apply a template, then switch to a different email address, all content in the body of the email disappears. I can't remember if it always worked this way. In normally pick my address first and template second, so I never really noticed this before. I remember recently there was a patch that had to do with automatically adding the signature. I think what was happening from memory was that when you switched it added a second signature and the patch was supposed to wipe out the signature in the body content and so when the new one was added, you didn't get two. I would bet this is the cause of the issue. I bet it wipes out the whole body content and didn't consider a reply to. (just a guess, if I get some time on the weekend I'll try and chase that one down). |
Yes. It's possible to flush the JS caches with code. |
You're missing one to complete this fix: 276. Not that it would make a difference with your issue of the disappearing email content, that's something else. |
@pstevens71 Thanks for following that through, perhaps it was this PR: 9518 - Fix 4075 - No way to add Email Signature after adding Email Template which is from 7.12.4 https://docs.suitecrm.com/admin/releases/7.12.x/ Also thank you for pointing out I missed fix 276, its very easy to miss things when done this way :) |
@brendan-pike yes! That's the one I was thinking of. I even started the thread about it. That must be why it sticks in my mind. Thought it was more recent than that! Time flies! |
I can confirm on 7.12.8, this does not happen, just tested. It does happen in my version 8 and my latest 7.14.2 Probably best to open another issue on this rather than continue in this thread. I believe it's an unrelated problem. |
Okay thank you, I'll open a new thread now. |
Hi there, |
Issue
There are a bunch of issues surrounding group email accounts. I've proposed some fixes already. First, group email accounts do not get marked as "is_group" = 1 currently. I proposed a fix in 7.12 branch for this that should still be applicable in Core.
Also, when a group email is deleted, the folders do no get marked as "deleted=1". I have proposed a fix for this as well.
However, when group folders are correctly marked in "folders" in the database as is_group =1 they no longer appear on the list of folders in users and admin folder selection in user profile.
When they are NOT marked as "is_group" they go into the JSON array that makes the pick list as "userFolders" like this...
"userFolders": [{ "id": "", "name": "--None--", "has_child": 0, "is_group": 0, "selected": false }, { "id": "5d269064-84eb-a6cd-bf75-6478c44c1bea", "name": "INBOX (replypersonal)", "has_child": "1", "is_group": "0", "is_dynamic": "1", "folder_type": "inbound", "created_by": "1", "deleted": "0",................................
When properly marked they go into the JSON like this:
"groupFolders": [{ "id": "", "name": "--None--", "has_child": 0, "is_group": 1, "selected": false, "origName": "" }, { "id": "e0e86af8-fac6-8f28-4c90-6478d52d1153", "name": "INBOX (reply2)", "has_child": "1", "is_group": "1", "is_dynamic": "1", "folder_type": "inbound", "created_by": "1",.......................
Currently trying to track down exactly which JS is responsible for the list in:
\modules\Emails\javascript\ajax.js
AND
\modules\Emails\javascript\EmailUI.js
Finally, the security group filter is not being properly applied to the list of available folders.
Expected Behavior
A list of both personal and accessible group accounts should appear in the list.
Once they appear in the list, when the list saves it will update the folders_subscriptions table in the database with the user ID and the folder ID to manage subscriptions.
Actual Behavior
Only a list of userFolders appear in the list.
Possible Fix
Modify the JS in settingsFolderRefresh: function (o) and probably another one I haven't found yet, to populate the list initially (which I haven't found yet).
Steps to Reproduce
3.Make sure related folders are marked as "is_group"=1 in the folders table in the database
Context
Your Environment
The text was updated successfully, but these errors were encountered: