UIType bug in Vtiger_Record_Model function getCommentEnabledRelatedEntityIds()
See the above function and this line: https://code.vtiger.com/vtiger/vtigercrm/blob/master/modules/Vtiger/models/Record.php#L690
This hardcodes three fields which basically reference a User record. If, which I have done, I create a second user type field (uitype 52) in, say the Organisation module (we have a "Previously Assigned To" field) then this function fails because my fieldname is not in the $restrictedFieldnames
array and so when it sees a value in my custom field, it tries to load the entity from the crmentity table using the user_id value - which is obviously wrong.
It would be better and more flexible, in my opinion, to test on UIType rather than individual field names. Instead of hard-coding fieldnames, you could simply check the fieldModels for not being either uitype 52 or 53.