# frozen_string_literal: true class Posts::HashesController < ApplicationController before_action :load_post before_action :check_auth def destroy @post.media.update(orig_sha512_hash: nil) # HidableLogger.log(@post, 'Hashes cleared', current_user.name) flash[:notice] = t('posts.clear_hash.success') redirect_to short_post_path(@post) end private def load_post @post = Post.find_by!(id: params[:post_id]) end def check_auth authorize! :hide, @post end end