[Notes] Remove note previews, replace with dtext previews

This commit is contained in:
Donovan Daniels 2024-04-18 05:31:25 -05:00
parent 0a35264ad8
commit 0f8ec1de53
No known key found for this signature in database
GPG Key ID: 907D29CBFD6157BA
4 changed files with 6 additions and 33 deletions

View File

@ -1,14 +0,0 @@
# frozen_string_literal: true
class NotePreviewsController < ApplicationController
respond_to :json
def show
@body = helpers.format_text(params[:body].to_s)
respond_with(@body) do |format|
format.json do
render :json => {:body => @body}.to_json
end
end
end
end

View File

@ -434,10 +434,11 @@ let Note = {
var text = $textarea.val();
$note_body.data("original-body", text);
Note.Body.set_text($note_body, $note_box, "Loading...");
$.get("/note_previews.json", {body: text}).then(function(data) {
Note.Body.set_text($note_body, $note_box, data.body);
$.post("/dtext_preview.json", {body: text}).then(function(data) {
Note.Body.set_text($note_body, $note_box, data.html);
Note.Box.resize_inner_border($note_box);
$note_body.show();
$(window).trigger("e621:add_deferred_posts", data.posts);
});
$this.dialog("close");
@ -467,9 +468,10 @@ let Note = {
var $note_box = Note.Box.find(id);
$note_box.find(".note-box-inner-border").addClass("unsaved");
Note.Body.set_text($note_body, $note_box, "Loading...");
$.get("/note_previews.json", {body: text}).then(function(data) {
Note.Body.set_text($note_body, $note_box, data.body);
$.post("/dtext_preview.json", {body: text}).then(function(data) {
Note.Body.set_text($note_body, $note_box, data.html);
$note_body.show();
$(window).trigger("e621:add_deferred_posts", data.posts);
});
},

View File

@ -189,7 +189,6 @@ Rails.application.routes.draw do
end
end
resources :note_versions, :only => [:index]
resource :note_previews, :only => [:show]
resources :pools do
member do
put :revert

View File

@ -1,14 +0,0 @@
# frozen_string_literal: true
require "test_helper"
class NotePreviewsControllerTest < ActionDispatch::IntegrationTest
context "The note previews controller" do
context "show action" do
should "work" do
get note_previews_path, params: { body: "<b>test</b>", format: "json" }
assert_response :success
end
end
end
end