mirror of
https://github.com/wassname/talk.git
synced 2026-09-12 13:01:11 +08:00
fix: use asset url (#2005)
This commit is contained in:
@@ -190,7 +190,10 @@ export class CommentContainer extends Component<InnerProps, State> {
|
||||
active={showReplyDialog}
|
||||
/>
|
||||
)}
|
||||
<PermalinkButtonContainer commentID={comment.id} />
|
||||
<PermalinkButtonContainer
|
||||
asset={asset}
|
||||
commentID={comment.id}
|
||||
/>
|
||||
<ReactionButtonContainer
|
||||
comment={comment}
|
||||
settings={settings}
|
||||
@@ -238,6 +241,7 @@ const enhanced = withSetCommentIDMutation(
|
||||
fragment CommentContainer_asset on Asset {
|
||||
url
|
||||
...ReplyCommentFormContainer_asset
|
||||
...PermalinkButtonContainer_asset
|
||||
}
|
||||
`,
|
||||
comment: graphql`
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
import React, { StatelessComponent } from "react";
|
||||
import { graphql } from "react-relay";
|
||||
import { getURLWithCommentID } from "talk-framework/helpers";
|
||||
import { withLocalStateContainer } from "talk-framework/lib/relay";
|
||||
import { PermalinkButtonContainerLocal as Local } from "talk-stream/__generated__/PermalinkButtonContainerLocal.graphql";
|
||||
import { withFragmentContainer } from "talk-framework/lib/relay";
|
||||
import { PermalinkButtonContainer_asset as AssetData } from "talk-stream/__generated__/PermalinkButtonContainer_asset.graphql";
|
||||
|
||||
import PermalinkButton from "../components/PermalinkButton";
|
||||
|
||||
interface InnerProps {
|
||||
local: Local;
|
||||
asset: AssetData;
|
||||
commentID: string;
|
||||
}
|
||||
|
||||
export const PermalinkContainer: StatelessComponent<InnerProps> = ({
|
||||
local,
|
||||
export const PermalinkButtonContainerProps: StatelessComponent<InnerProps> = ({
|
||||
asset,
|
||||
commentID,
|
||||
}) => {
|
||||
return local.assetURL ? (
|
||||
return (
|
||||
<PermalinkButton
|
||||
commentID={commentID}
|
||||
url={getURLWithCommentID(local.assetURL, commentID)}
|
||||
url={getURLWithCommentID(asset.url, commentID)}
|
||||
/>
|
||||
) : null;
|
||||
);
|
||||
};
|
||||
|
||||
const enhanced = withLocalStateContainer(
|
||||
graphql`
|
||||
fragment PermalinkButtonContainerLocal on Local {
|
||||
assetURL
|
||||
const enhanced = withFragmentContainer<InnerProps>({
|
||||
asset: graphql`
|
||||
fragment PermalinkButtonContainer_asset on Asset {
|
||||
url
|
||||
}
|
||||
`
|
||||
)(PermalinkContainer);
|
||||
`,
|
||||
})(PermalinkButtonContainerProps);
|
||||
|
||||
export default enhanced;
|
||||
|
||||
+24
-4
@@ -9,7 +9,12 @@ exports[`hide reply button 1`] = `
|
||||
footer={
|
||||
<React.Fragment>
|
||||
<ButtonsBar>
|
||||
<withContext(withLocalStateContainer(PermalinkContainer))
|
||||
<Relay(PermalinkButtonContainerProps)
|
||||
asset={
|
||||
Object {
|
||||
"url": "http://localhost/asset",
|
||||
}
|
||||
}
|
||||
commentID="comment-id"
|
||||
/>
|
||||
<withContext(createMutationContainer(withContext(createMutationContainer(withContext(createMutationContainer(Relay(ReactionButtonContainer)))))))
|
||||
@@ -64,7 +69,12 @@ exports[`renders body only 1`] = `
|
||||
id="comments-commentContainer-replyButton-comment-id"
|
||||
onClick={[Function]}
|
||||
/>
|
||||
<withContext(withLocalStateContainer(PermalinkContainer))
|
||||
<Relay(PermalinkButtonContainerProps)
|
||||
asset={
|
||||
Object {
|
||||
"url": "http://localhost/asset",
|
||||
}
|
||||
}
|
||||
commentID="comment-id"
|
||||
/>
|
||||
<withContext(createMutationContainer(withContext(createMutationContainer(withContext(createMutationContainer(Relay(ReactionButtonContainer)))))))
|
||||
@@ -119,7 +129,12 @@ exports[`renders username and body 1`] = `
|
||||
id="comments-commentContainer-replyButton-comment-id"
|
||||
onClick={[Function]}
|
||||
/>
|
||||
<withContext(withLocalStateContainer(PermalinkContainer))
|
||||
<Relay(PermalinkButtonContainerProps)
|
||||
asset={
|
||||
Object {
|
||||
"url": "http://localhost/asset",
|
||||
}
|
||||
}
|
||||
commentID="comment-id"
|
||||
/>
|
||||
<withContext(createMutationContainer(withContext(createMutationContainer(withContext(createMutationContainer(Relay(ReactionButtonContainer)))))))
|
||||
@@ -174,7 +189,12 @@ exports[`shows conversation link 1`] = `
|
||||
id="comments-commentContainer-replyButton-comment-id"
|
||||
onClick={[Function]}
|
||||
/>
|
||||
<withContext(withLocalStateContainer(PermalinkContainer))
|
||||
<Relay(PermalinkButtonContainerProps)
|
||||
asset={
|
||||
Object {
|
||||
"url": "http://localhost/asset",
|
||||
}
|
||||
}
|
||||
commentID="comment-id"
|
||||
/>
|
||||
<withContext(createMutationContainer(withContext(createMutationContainer(withContext(createMutationContainer(Relay(ReactionButtonContainer)))))))
|
||||
|
||||
Reference in New Issue
Block a user