コミットを比較
2
コミット
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
d822fd342b | ||
|
|
753b679b9a |
@@ -314,9 +314,7 @@ class PostsController < ApplicationController
|
|||||||
def viewed
|
def viewed
|
||||||
return head :unauthorized unless current_user
|
return head :unauthorized unless current_user
|
||||||
|
|
||||||
UserPostView.create_or_find_by!(
|
current_user.viewed_posts << Post.find(params[:id])
|
||||||
user: current_user,
|
|
||||||
post: Post.find(params[:id]))
|
|
||||||
head :no_content
|
head :no_content
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2559,21 +2559,6 @@ RSpec.describe 'Posts API', type: :request do
|
|||||||
|
|
||||||
expect(user.reload.viewed?(post_record)).to be(true)
|
expect(user.reload.viewed?(post_record)).to be(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it '204 and keeps one view on repeated requests' do
|
|
||||||
sign_in_as(user)
|
|
||||||
|
|
||||||
expect {
|
|
||||||
post "/posts/#{ post_record.id }/viewed"
|
|
||||||
}.to change(UserPostView, :count).by(1)
|
|
||||||
expect(response).to have_http_status(:no_content)
|
|
||||||
|
|
||||||
expect {
|
|
||||||
post "/posts/#{ post_record.id }/viewed"
|
|
||||||
}.not_to change(UserPostView, :count)
|
|
||||||
expect(response).to have_http_status(:no_content)
|
|
||||||
expect(user.reload.viewed?(post_record)).to be(true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'DELETE /posts/:id/viewed' do
|
describe 'DELETE /posts/:id/viewed' do
|
||||||
|
|||||||
@@ -177,6 +177,39 @@ const PostEmbed: FC<Props> = (
|
|||||||
onError={onError}/>)
|
onError={onError}/>)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'pixiv.net':
|
||||||
|
{
|
||||||
|
if (url.hostname !== 'pixiv.net' && url.hostname !== 'www.pixiv.net')
|
||||||
|
break
|
||||||
|
|
||||||
|
const artworkId =
|
||||||
|
url.pathname === '/member_illust.php'
|
||||||
|
? url.searchParams.get ('illust_id')
|
||||||
|
: url.pathname.match (
|
||||||
|
/^\/(?:[a-z]{2}(?:-[A-Za-z]{2})?\/)?artworks\/(\d+)\/?$/)?.[1]
|
||||||
|
|
||||||
|
if (!(artworkId) || !(/^\d+$/.test (artworkId)))
|
||||||
|
break
|
||||||
|
|
||||||
|
if (embedAutoLoadMode === 'off')
|
||||||
|
return externalLink
|
||||||
|
if (shouldLoadEmbed === false)
|
||||||
|
return manualLoadControl
|
||||||
|
|
||||||
|
const embedUrl =
|
||||||
|
`https://embed.pixiv.net/oembed_iframe.php?type=illust&id=${ artworkId }`
|
||||||
|
|
||||||
|
return (
|
||||||
|
<iframe
|
||||||
|
src={embedUrl}
|
||||||
|
title={post.title || post.url}
|
||||||
|
width={600}
|
||||||
|
height={315}
|
||||||
|
style={{ border: 0 }}
|
||||||
|
loading="lazy"
|
||||||
|
className="max-w-full"/>)
|
||||||
|
}
|
||||||
|
|
||||||
case 'twitter.com':
|
case 'twitter.com':
|
||||||
case 'x.com':
|
case 'x.com':
|
||||||
{
|
{
|
||||||
|
|||||||
新しいイシューから参照
ユーザーをブロックする