[openstreetmap/openstreetmap-website] Add Messages API (PR #4605)
Milan Cvetkovic
notifications at github.com
Tue May 28 11:34:30 UTC 2024
@milan-cvetkovic commented on this pull request.
> +
+ raise OSM::APIAccessDenied if current_user.id != @message.from_user_id && current_user.id != @message.to_user_id
+
+ # Render the result
+ respond_to do |format|
+ format.xml
+ format.json
+ end
+ end
+
+ # Create a new message from current user
+ def create
+ # Check the arguments are sane
+ raise OSM::APIBadUserInput, "No title was given" if params[:title].blank?
+ raise OSM::APIBadUserInput, "No body was given" if params[:body].blank?
+ raise OSM::APIBadUserInput, "No body format was given" if params[:body_format].blank?
I added the text since it appears that messages generated from emails have `body_format` set to `text` https://github.com/openstreetmap/openstreetmap-website/blob/bd3507291c2d2d86796f99ede11560554d7235c5/app/models/message.rb#L59C1-L59C29.
Will remove the choice and ue markdown without any other choices.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4605#discussion_r1617075111
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4605/review/2082525885 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240528/3a9db25d/attachment.htm>
More information about the rails-dev
mailing list