docbrown/app/controllers/internal/buffer_updates_controller.rb
Ben Halpern 1552df98d2
Add ability for trusted users to suggest social copy for posts (#2306)
* Add ability for trusted users to suggest social copy for posts

* Fix schema

* Fix tests

* Fix test
2019-04-04 17:01:58 -04:00

22 lines
723 B
Ruby

class Internal::BufferUpdatesController < Internal::ApplicationController
def create
article = Article.find(params[:article_id])
fb_post = params[:fb_post]
tweet = params[:tweet]
if params[:social_channel] == "main_twitter"
Bufferizer.new(article, tweet).main_teet!
render body: nil
elsif params[:social_channel] == "satellite_twitter"
Bufferizer.new(article, tweet).satellite_tweet!
render body: nil
elsif params[:social_channel] == "facebook"
Bufferizer.new(article, fb_post).facebook_post!
render body: nil
end
end
def update
BufferUpdate.upbuff!(params[:id], current_user.id, params[:body_text], params[:status])
render body: nil
end
end