Pass $query object to 'bp_docs_activity_args' filter for better
customization for plugin devs.
Improve the method used to determine associated group when rewriting activity action

This is a more generalized version of r-a-y/buddypress-docs@8ec8f03d1b816af601c2f0949c45d224880a4c02

See #353
Modify activity args when posting a group-associated doc

This is necessary to ensure that the edits show up in the group activity
stream.

Note that this method will not work correctly when associating with
multiple docs. More research is needed.

Note also that this change means that we can't depend on the doc id
being the doc. This is bound to cause problems when using the activity
stream in advanced ways, but there is no good alternative at this point.

Based on an original implementation by @r-a-y in r-a-y/buddypress-docs@88841ea1f12399ea79184bf5398d59ca29329584

See #353
Readme
Updated to upstream 1.4.x
Clear up referer when adding upload_files cap

The trick used to dynamically add the upload_files cap for non-admin
users involves checking to make sure that we're on an Docs create/edit
page by checking $_SERVER['HTTP_REFERER']. (It's necessary to check the
referer because the actual check happens on an async call to
async-upload.php.) However, when creating a Doc from the context of a
group, an additional URL param is added to HTTP_REFERER, with the result
that the $referer == create_url check fails.

I've fixed the issue by doing some cleanup on the referer before doing
the necessary comparisons. In particular, all URL params are now being
stripped. A note that this will break things if at some future point the
plugin becomes compatibile with non-pretty-permalink setups.

Fixes #355
Attachment fix from group context