Issue 3994 email visible on assignment page for non-mod user

This commit contains the fix and the tests: only show email link if the user can see assignments.

Tests test that the mod can still see the email link, while the non-mod user can't.
Issue 3994

This is all just spacing and indentation :D
Merge pull request #1743 from CristinaRO/issue-3994-email-visible

Issue 3994 email visible on assignment page to a non-mod user