Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Neff <benjamin@coding4coffee.ch>2016-05-22 23:40:45 +0300
committerBenjamin Neff <benjamin@coding4coffee.ch>2016-06-26 07:21:00 +0300
commit7184d4334ecd7bded57d3658d18494d0d59a8c74 (patch)
tree4551bd5512cecee37efc9c572e02597e19699466 /app/services
parent20dabbd15ffdf7f27e962c5cf90e334663a01835 (diff)
remove after_dispatch hook
handle photos in StatusMessageCreationService
Diffstat (limited to 'app/services')
-rw-r--r--app/services/status_message_creation_service.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/services/status_message_creation_service.rb b/app/services/status_message_creation_service.rb
index 9c06d2687..12bd8fbae 100644
--- a/app/services/status_message_creation_service.rb
+++ b/app/services/status_message_creation_service.rb
@@ -42,8 +42,13 @@ class StatusMessageCreationService
end
def add_photos(status_message, photos)
- status_message.attach_photos_by_ids(photos)
- status_message.photos.each {|photo| photo.public = status_message.public }
+ if photos.present?
+ status_message.photos << Photo.where(id: photos, author_id: status_message.author_id)
+ status_message.photos.each do |photo|
+ photo.public = status_message.public
+ photo.pending = false
+ end
+ end
end
def process(status_message, aspect_ids, services)
@@ -55,6 +60,7 @@ class StatusMessageCreationService
def add_to_streams(status_message, aspect_ids)
aspects = user.aspects_from_ids(aspect_ids)
user.add_to_streams(status_message, aspects)
+ status_message.photos.each {|photo| user.add_to_streams(photo, aspects) }
end
def dispatch(status_message, services)