Fixes double rendering of attachments and repository annotates

Implements https://www.openproject.org/work_packages/5321