Add custom-emoji license support
This commit is contained in:
parent
ff2bcf7595
commit
34f0ad7ad5
5 changed files with 21 additions and 2 deletions
|
@ -263,7 +263,13 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
|||
return unless emoji.nil? || custom_emoji_parser.image_remote_url != emoji.image_remote_url || (custom_emoji_parser.updated_at && custom_emoji_parser.updated_at >= emoji.updated_at)
|
||||
|
||||
begin
|
||||
emoji ||= CustomEmoji.new(domain: @account.domain, shortcode: custom_emoji_parser.shortcode, uri: custom_emoji_parser.uri, is_sensitive: custom_emoji_parser.is_sensitive)
|
||||
emoji ||= CustomEmoji.new(
|
||||
domain: @account.domain,
|
||||
shortcode: custom_emoji_parser.shortcode,
|
||||
uri: custom_emoji_parser.uri,
|
||||
is_sensitive: custom_emoji_parser.is_sensitive,
|
||||
license: custom_emoji_parser.license
|
||||
)
|
||||
emoji.image_remote_url = custom_emoji_parser.image_remote_url
|
||||
emoji.save
|
||||
rescue Seahorse::Client::NetworkingError => e
|
||||
|
|
|
@ -28,4 +28,8 @@ class ActivityPub::Parser::CustomEmojiParser
|
|||
def is_sensitive # rubocop:disable Naming/PredicateName
|
||||
(@json['isSensitive'].presence || false)
|
||||
end
|
||||
|
||||
def license
|
||||
@json['license']
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
# image_height :integer
|
||||
# aliases :jsonb
|
||||
# is_sensitive :boolean default(FALSE), not null
|
||||
# license :string
|
||||
#
|
||||
|
||||
class CustomEmoji < ApplicationRecord
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddLicenseToCustomEmojis < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :custom_emojis, :license, :string, null: true
|
||||
end
|
||||
end
|
|
@ -12,7 +12,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2023_05_22_082252) do
|
||||
ActiveRecord::Schema.define(version: 2023_05_22_093135) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -440,6 +440,7 @@ ActiveRecord::Schema.define(version: 2023_05_22_082252) do
|
|||
t.integer "image_height"
|
||||
t.jsonb "aliases"
|
||||
t.boolean "is_sensitive", default: false, null: false
|
||||
t.string "license"
|
||||
t.index ["shortcode", "domain"], name: "index_custom_emojis_on_shortcode_and_domain", unique: true
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue