Newer
Older
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class PostsController < ApplicationController
Maxwell Salzberg
a validé
include PostsHelper
before_action :authenticate_user!, only: :destroy
before_action :set_format_if_malformed_from_status_net, only: :show
rescue_from Diaspora::NonPublic do |_exception|
respond_to do |format|
format.all { render template: "errors/not_public", status: 404, layout: "application" }
end
end
post_service = PostService.new(id: params[:id], user: current_user)
post_service.assign_post_and_mark_notifications
@post = post_service.post
format.html { gon.post = post_service.present_json }
format.xml { render xml: @post.to_diaspora_xml }
format.json { render json: post_service.present_json }
Raphael Sofaer
a validé
end
end
Maxwell Salzberg
a validé
def iframe
render text: post_iframe_url(params[:id]), layout: false
Maxwell Salzberg
a validé
end
def oembed
post_id = OEmbedPresenter.id_from_url(params.delete(:url))
post_service = PostService.new(id: post_id, user: current_user,
oembed: params.slice(:format, :maxheight, :minheight))
post_service.assign_post
render json: post_service.present_oembed
post_service = PostService.new(id: params[:id], user: current_user)
post_service.assign_post
respond_with(post_service.present_interactions_json)
post_service = PostService.new(id: params[:id], user: current_user)
post_service.retract_post
@post = post_service.post
format.js { render "destroy", layout: false, format: :js }
format.json { render nothing: true, status: 204 }
def set_format_if_malformed_from_status_net
request.format = :html if request.format == "application/html+xml"
Maxwell Salzberg
a validé
end