diff options
author | Steffen van Bergerem <svbergerem@online.de> | 2016-07-04 02:59:52 +0300 |
---|---|---|
committer | Steffen van Bergerem <svbergerem@online.de> | 2016-07-04 11:26:45 +0300 |
commit | 46cbc6e52a9d4a03dff8228ce11ac4876d247a15 (patch) | |
tree | 75b142440fa784b965ee428267e8fdf7603ebb6e /app/services | |
parent | 9aaf58de120e98d1a6ada24718fc3ffc411a5f0b (diff) |
Filter mentions on status message creation
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/status_message_creation_service.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/services/status_message_creation_service.rb b/app/services/status_message_creation_service.rb index f9fcdea1a..b541d194d 100644 --- a/app/services/status_message_creation_service.rb +++ b/app/services/status_message_creation_service.rb @@ -19,9 +19,20 @@ class StatusMessageCreationService def build_status_message(params) public = params[:public] || false + filter_mentions params user.build_post(:status_message, params[:status_message].merge(public: public)) end + def filter_mentions(params) + unless params[:public] + params[:status_message][:text] = Diaspora::Mentionable.filter_for_aspects( + params[:status_message][:text], + user, + *params[:aspect_ids] + ) + end + end + def add_attachments(status_message, params) add_location(status_message, params[:location_address], params[:location_coords]) add_poll(status_message, params) |