add api endpoint for updating a tag's related tags

This commit is contained in:
r888888888 2016-01-03 00:02:37 -08:00
parent 2285e65b25
commit 04926ae0c6
2 changed files with 12 additions and 1 deletions

View File

@ -9,4 +9,15 @@ class RelatedTagsController < ApplicationController
end
end
end
def update
render(text: "forbidden", status: 403) && return false unless params[:key] == Danbooru.config.shared_remote_key
@tag = Tag.find_by_name(params[:name])
@tag.related_tags = params[:related_tags].scan(/\S+/).in_groups_of(2)
@tag.related_tags_updated_at = Time.now
@tag.save
render nothing: true
end
end

View File

@ -218,7 +218,7 @@ Rails.application.routes.draw do
end
end
resources :artist_commentary_versions, :only => [:index]
resource :related_tag, :only => [:show]
resource :related_tag, :only => [:show, :update]
get "reports/user_promotions" => "reports#user_promotions"
get "reports/janitor_trials" => "reports#janitor_trials"
get "reports/contributors" => "reports#contributors"