Add management of webmentions
This commit is contained in:
12
slices/admin/actions/webmentions/index.rb
Normal file
12
slices/admin/actions/webmentions/index.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
module Actions
|
||||
module Webmentions
|
||||
class Index < Admin::Action
|
||||
def handle(request, response)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
25
slices/admin/actions/webmentions/update.rb
Normal file
25
slices/admin/actions/webmentions/update.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
module Actions
|
||||
module Webmentions
|
||||
class Update < Admin::Action
|
||||
include Deps["repos.webmention_repo"]
|
||||
|
||||
def handle(req, resp)
|
||||
update_type = req.params[:update_type]
|
||||
if update_type == "archive"
|
||||
webmention_repo.update(req.params[:id], published_at: nil)
|
||||
end
|
||||
|
||||
if update_type == "publish"
|
||||
webmention_repo.update(req.params[:id], published_at: Time.now)
|
||||
end
|
||||
|
||||
resp.headers["HX-Refresh"] = true
|
||||
resp.status = 200
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user