# frozen_string_literal: true require 'fileutils' class Posts::SourceHistoriesController < ApplicationController before_action :load_post before_action :check_auth def destroy @post.source_changes.delete_all @post.source_url = '' @post.save # HidableLogger.log(@post, 'Sources wiped', current_user.name) respond_to do |format| format.html { redirect_to post_path(@post.id), notice: t('posts.delete_source_changes.success') } format.json { head :ok } end end private def load_post @post = Post.find(params[:post_id]) end def check_auth authorize! :delete, SourceChange end end