message: Extract logic to check message edit permissions in a function.
message: Extract logic to check message edit permissions in a function.

This commit extracts the logic of checking the message edit permissions,
like whether the sender is same as user, whether it is a (no topic)
message or whether community topic editing is allowed, into a separate
function.

This is a prep commit for fixing a bug where permission to move messages
between streams is affected by permission of editing topics.

hackerkid/zulip,andersk/zulip,hackerkid/zulip,eeshangarg/zulip,hackerkid/zulip,zulip/zulip,rht/zulip,eeshangarg/zulip,eeshangarg/zulip,andersk/zulip,hackerkid/zulip,punchagan/zulip,hackerkid/zulip,zulip/zulip,zulip/zulip,punchagan/zulip,kou/zulip,punchagan/zulip,andersk/zulip,zulip/zulip,zulip/zulip,punchagan/zulip,kou/zulip,kou/zulip,punchagan/zulip,rht/zulip,rht/zulip,rht/zulip,kou/zulip,kou/zulip,rht/zulip,rht/zulip,zulip/zulip,eeshangarg/zulip,eeshangarg/zulip,eeshangarg/zulip,andersk/zulip,andersk/zulip,hackerkid/zulip,andersk/zulip,andersk/zulip,punchagan/zulip,zulip/zulip,rht/zulip,punchagan/zulip,eeshangarg/zulip,hackerkid/zulip,kou/zulip,kou/zulip