Changing the label for the Inbound Email activity type lets you edit/delete them even if the permission disallows
This is related to #1116 but I'd like to start with this one first since it's more contained and allows removing a confusing variable that is only ever used once and used incorrectly.
- To reproduce, set the permission so that editing inbound emails is disallowed. Will probably already be like this by default.
- Change the activity type label for Inbound Email.
- Go to a contact's activities tab and click the view link for an inbound email. On the popup there's now edit and delete buttons whereas before there weren't.
- Click the edit button, make your edit, and save.
The problem is this line in https://github.com/civicrm/civicrm-core/blob/5.15.1/templates/CRM/Activity/Form/Activity.tpl#L252
{if $action eq 4 && ($activityTName neq 'Inbound Email' || $allow_edit_inbound_emails == 1)}
$activityTName (which is different than $activityTypeName, although it has the same value) is actually the label, and so if you've changed the label the comparison doesn't work.
This is the only place this variable is used.