コミットを比較
2
コミット
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
8f7e6dbcb7 | ||
|
|
5528453a54 |
@@ -69,8 +69,11 @@ class TagVersionsController < ApplicationController
|
|||||||
|
|
||||||
parent_tags =
|
parent_tags =
|
||||||
build_version_values(cur_parent_tag_ids, prev_parent_tag_ids, key: :tag_id)
|
build_version_values(cur_parent_tag_ids, prev_parent_tag_ids, key: :tag_id)
|
||||||
.map do |h|
|
.filter_map do |h|
|
||||||
{ tag: parent_json.fetch(h[:tag_id]),
|
parent = parent_json[h[:tag_id]]
|
||||||
|
next unless parent
|
||||||
|
|
||||||
|
{ tag: parent,
|
||||||
type: h[:type] }
|
type: h[:type] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -215,6 +215,36 @@ RSpec.describe 'TagVersions API', type: :request do
|
|||||||
expect(first.fetch('created_at')).to eq(t_v1.iso8601)
|
expect(first.fetch('created_at')).to eq(t_v1.iso8601)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
[:parent_shared, :parent_new, :parent_old].each do |parent_key|
|
||||||
|
it "omits deleted #{ parent_key } from parent diffs" do
|
||||||
|
deleted_parent = public_send(parent_key)
|
||||||
|
deleted_parent.tag_names.destroy_all
|
||||||
|
deleted_parent.destroy!
|
||||||
|
|
||||||
|
get '/tags/versions', params: { id: tag.id }
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:ok)
|
||||||
|
expect(json.fetch('count')).to eq(2)
|
||||||
|
|
||||||
|
versions = json.fetch('versions')
|
||||||
|
expect(versions.map { _1.fetch('version_no') }).to eq([2, 1])
|
||||||
|
|
||||||
|
expected_parents = [
|
||||||
|
[parent_shared.id, 'context'],
|
||||||
|
[parent_new.id, 'added'],
|
||||||
|
[parent_old.id, 'removed']].reject { _1.first == deleted_parent.id }
|
||||||
|
expect(versions.first.fetch('parent_tags').map { |entry|
|
||||||
|
[entry.fetch('tag').fetch('id'), entry.fetch('type')]
|
||||||
|
}).to eq(expected_parents)
|
||||||
|
|
||||||
|
expected_first_parents = [parent_shared.id, parent_old.id]
|
||||||
|
.reject { _1 == deleted_parent.id }.map { [_1, 'added'] }
|
||||||
|
expect(versions.second.fetch('parent_tags').map { |entry|
|
||||||
|
[entry.fetch('tag').fetch('id'), entry.fetch('type')]
|
||||||
|
}).to eq(expected_first_parents)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'returns empty when the specified tag has no versions' do
|
it 'returns empty when the specified tag has no versions' do
|
||||||
fresh_tag = create(:tag, primary_name: 'no_versions_tag', category: :general)
|
fresh_tag = create(:tag, primary_name: 'no_versions_tag', category: :general)
|
||||||
|
|
||||||
|
|||||||
@@ -196,39 +196,6 @@ const PostEmbed: FC<Props> = (
|
|||||||
return <TwitterEmbed userId={userId} statusId={statusId}/>
|
return <TwitterEmbed userId={userId} statusId={statusId}/>
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'bilibili.com':
|
|
||||||
{
|
|
||||||
const videoId = url.pathname.match (
|
|
||||||
/^\/video\/(BV[a-zA-Z0-9]{10}|av[1-9]\d*)\/?$/)?.[1]
|
|
||||||
if (!(videoId))
|
|
||||||
break
|
|
||||||
|
|
||||||
if (embedAutoLoadMode === 'off')
|
|
||||||
return externalLink
|
|
||||||
if (shouldLoadEmbed === false)
|
|
||||||
return manualLoadControl
|
|
||||||
|
|
||||||
const playerUrl = new URL ('https://player.bilibili.com/player.html')
|
|
||||||
const parameter = videoId.startsWith ('BV') ? 'bvid' : 'aid'
|
|
||||||
const identifier = parameter === 'bvid' ? videoId : videoId.slice (2)
|
|
||||||
playerUrl.searchParams.set (parameter, identifier)
|
|
||||||
playerUrl.searchParams.set ('autoplay', '1')
|
|
||||||
|
|
||||||
const page = url.searchParams.get ('p')
|
|
||||||
if (page != null && /^[1-9]\d*$/.test (page))
|
|
||||||
playerUrl.searchParams.set ('p', page)
|
|
||||||
|
|
||||||
return (
|
|
||||||
<iframe
|
|
||||||
src={playerUrl.toString ()}
|
|
||||||
title={post.title || post.url}
|
|
||||||
width={640}
|
|
||||||
height={360}
|
|
||||||
className="aspect-video h-auto max-w-full"
|
|
||||||
allow="autoplay; fullscreen"
|
|
||||||
allowFullScreen/>)
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'youtube.com':
|
case 'youtube.com':
|
||||||
{
|
{
|
||||||
const videoId = url.searchParams.get ('v')
|
const videoId = url.searchParams.get ('v')
|
||||||
|
|||||||
新しいイシューから参照
ユーザーをブロックする