Fix hooks for web based events with external issue references
The creation of cross references for external issues (which would fail) is now prevented. This fixes a 500 error and the execution of hooks when creating a merge request or commenting on one.
Fixes #1650 (closed), GH-9333.
This regression might have been introduced by 8f8a8ab3. There is actually a TODO by @rspeicher mentioning external issues which is lost (unhandled) in a later commit.
This fix is related to !766 (closed) and !804 (merged) which fix a similar issue for hooks for Git based events.