Skip to content

Commit

Permalink
Merge pull request #4808 from thematters/develop
Browse files Browse the repository at this point in the history
Release: v5.6.1
  • Loading branch information
wlliaml authored Aug 30, 2024
2 parents ed2a682 + b46efc7 commit 7f86788
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 6 deletions.
12 changes: 12 additions & 0 deletions lang/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@
"defaultMessage": "This tag is already taken",
"description": "DUPLICATE_TAG"
},
"5RPoaZ": {
"defaultMessage": "liked your deleted moment",
"description": "src/components/Notice/MomentNotice/MomentLiked.tsx"
},
"5UglrB": {
"defaultMessage": "Successfully delivered"
},
Expand Down Expand Up @@ -971,6 +975,10 @@
"E048/V": {
"defaultMessage": "Save as Draft"
},
"E0xjVb": {
"defaultMessage": "commented on a deleted moment",
"description": "src/components/Notice/CommentNotice/MomentNewCommentNotice.tsx"
},
"E3uFyt": {
"defaultMessage": "Moment",
"description": "src/components/Forms/MomentForm/index.tsx"
Expand Down Expand Up @@ -3059,6 +3067,10 @@
"quRPwZ": {
"defaultMessage": "Payment request has been sent"
},
"qw7tLA": {
"defaultMessage": "liked your comment on a deleted moment",
"description": "src/components/Notice/CommentNotice/CommentLikedNotice.tsx"
},
"r5pj/5": {
"defaultMessage": "Drag"
},
Expand Down
12 changes: 12 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@
"defaultMessage": "This tag is already taken",
"description": "DUPLICATE_TAG"
},
"5RPoaZ": {
"defaultMessage": "liked your deleted moment",
"description": "src/components/Notice/MomentNotice/MomentLiked.tsx"
},
"5UglrB": {
"defaultMessage": "Successfully delivered"
},
Expand Down Expand Up @@ -971,6 +975,10 @@
"E048/V": {
"defaultMessage": "Save as Draft"
},
"E0xjVb": {
"defaultMessage": "commented on a deleted moment",
"description": "src/components/Notice/CommentNotice/MomentNewCommentNotice.tsx"
},
"E3uFyt": {
"defaultMessage": "Moment",
"description": "src/components/Forms/MomentForm/index.tsx"
Expand Down Expand Up @@ -3059,6 +3067,10 @@
"quRPwZ": {
"defaultMessage": "Payment request has been sent"
},
"qw7tLA": {
"defaultMessage": "liked your comment on a deleted moment",
"description": "src/components/Notice/CommentNotice/CommentLikedNotice.tsx"
},
"r5pj/5": {
"defaultMessage": "Drag"
},
Expand Down
12 changes: 12 additions & 0 deletions lang/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@
"defaultMessage": "标签名称已被使用",
"description": "DUPLICATE_TAG"
},
"5RPoaZ": {
"defaultMessage": "喜欢你已删除的动态",
"description": "src/components/Notice/MomentNotice/MomentLiked.tsx"
},
"5UglrB": {
"defaultMessage": "送出成功"
},
Expand Down Expand Up @@ -971,6 +975,10 @@
"E048/V": {
"defaultMessage": "存至草稿"
},
"E0xjVb": {
"defaultMessage": "在已删除动态中留言",
"description": "src/components/Notice/CommentNotice/MomentNewCommentNotice.tsx"
},
"E3uFyt": {
"defaultMessage": "动态",
"description": "src/components/Forms/MomentForm/index.tsx"
Expand Down Expand Up @@ -3059,6 +3067,10 @@
"quRPwZ": {
"defaultMessage": "支付请求已送出"
},
"qw7tLA": {
"defaultMessage": "喜欢你在已删除动态中的留言",
"description": "src/components/Notice/CommentNotice/CommentLikedNotice.tsx"
},
"r5pj/5": {
"defaultMessage": "拖拽"
},
Expand Down
12 changes: 12 additions & 0 deletions lang/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@
"defaultMessage": "標籤名稱已被使用",
"description": "DUPLICATE_TAG"
},
"5RPoaZ": {
"defaultMessage": "喜歡你已刪除的動態",
"description": "src/components/Notice/MomentNotice/MomentLiked.tsx"
},
"5UglrB": {
"defaultMessage": "送出成功"
},
Expand Down Expand Up @@ -971,6 +975,10 @@
"E048/V": {
"defaultMessage": "存至草稿"
},
"E0xjVb": {
"defaultMessage": "在已刪除動態中留言",
"description": "src/components/Notice/CommentNotice/MomentNewCommentNotice.tsx"
},
"E3uFyt": {
"defaultMessage": "動態",
"description": "src/components/Forms/MomentForm/index.tsx"
Expand Down Expand Up @@ -3059,6 +3067,10 @@
"quRPwZ": {
"defaultMessage": "支付請求已送出"
},
"qw7tLA": {
"defaultMessage": "喜歡你在已刪除動態中的留言",
"description": "src/components/Notice/CommentNotice/CommentLikedNotice.tsx"
},
"r5pj/5": {
"defaultMessage": "拖拽"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matters-web",
"version": "5.6.0",
"version": "5.6.1",
"description": "codebase of Matters' website",
"author": "Matters <[email protected]>",
"engines": {
Expand Down
22 changes: 21 additions & 1 deletion src/components/Dialogs/MomentDetailDialog/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useQuery } from '@apollo/react-hooks'
import { Editor } from '@matters/matters-editor'
import classNames from 'classnames'
import { useEffect, useState } from 'react'
import { FormattedMessage } from 'react-intl'

import {
ADD_MOMENT_COMMENT_MENTION,
Expand All @@ -16,6 +17,8 @@ import {
toPath,
} from '~/common/utils'
import {
BackToHomeButton,
Error,
MomentDigestDetail,
QueryError,
useEventListener,
Expand All @@ -24,7 +27,7 @@ import {
import MomentCommentForm from '~/components/Forms/MomentCommentForm'
import Assets from '~/components/MomentDigest/Assets'
import LikeButton from '~/components/MomentDigest/FooterActions/LikeButton'
import { MomentDetailQuery } from '~/gql/graphql'
import { MomentDetailQuery, MomentState } from '~/gql/graphql'

import Comments from './Comments'
import { MOMENT_DETAIL } from './gql'
Expand Down Expand Up @@ -99,6 +102,23 @@ const MomentDetailDialogContent = ({
return null
}

if (data.moment.state === MomentState.Archived) {
return (
<section className={styles.error}>
<Error
message={
<FormattedMessage
defaultMessage="Hmm... It seems the author has hidden this work. Go see something else"
id="qhVSGI"
/>
}
>
<BackToHomeButton />
</Error>
</section>
)
}

const moment = data.moment

const { content, assets } = moment
Expand Down
6 changes: 6 additions & 0 deletions src/components/Dialogs/MomentDetailDialog/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,9 @@
}
}
}

.error {
@media (--sm-up) {
padding: var(--sp24);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const makeSmartLinkOptions = ({
}) => {
return {
findRule: new RegExp(
`https://${process.env.NEXT_PUBLIC_SITE_DOMAIN}/a/(?<key>[a-zA-Z0-9]+)`,
`https://${process.env.NEXT_PUBLIC_SITE_DOMAIN}/a/(?<key>[a-zA-Z0-9]+)(?:\\?.*|#.*)?`,
'g'
),
search: async ({
Expand Down
19 changes: 18 additions & 1 deletion src/components/Notice/CommentNotice/CommentLikedNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import gql from 'graphql-tag'
import { FormattedMessage } from 'react-intl'

import { TEST_ID } from '~/common/enums'
import { CommentNoticeFragment } from '~/gql/graphql'
import { CommentNoticeFragment, MomentState } from '~/gql/graphql'

import NoticeActorAvatar from '../NoticeActorAvatar'
import NoticeArticleTitle from '../NoticeArticleTitle'
Expand All @@ -23,6 +23,23 @@ const CommentLikedNotice = ({ notice }: { notice: CommentNoticeFragment }) => {
? notice.comment.node
: undefined

if (isMoment && commentMoment?.state === MomentState.Archived) {
return (
<NoticeDigest
notice={notice}
action={
<FormattedMessage
defaultMessage="liked your comment on a deleted moment"
id="qw7tLA"
description="src/components/Notice/CommentNotice/CommentLikedNotice.tsx"
/>
}
content={<NoticeComment comment={notice.comment} />}
testId={TEST_ID.NOTICE_COMMENT_LIKED}
/>
)
}

return (
<NoticeDigest
notice={notice}
Expand Down
19 changes: 18 additions & 1 deletion src/components/Notice/CommentNotice/MomentNewCommentNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import gql from 'graphql-tag'
import { FormattedMessage } from 'react-intl'

import { TEST_ID } from '~/common/enums'
import { MomentNewCommentNoticeFragment } from '~/gql/graphql'
import { MomentNewCommentNoticeFragment, MomentState } from '~/gql/graphql'

import NoticeActorAvatar from '../NoticeActorAvatar'
import NoticeComment from '../NoticeComment'
Expand All @@ -25,6 +25,23 @@ const MomentNewCommentNotice = ({
? notice.comment.node
: undefined

if (commentMoment?.state === MomentState.Archived) {
return (
<NoticeDigest
notice={notice}
action={
<FormattedMessage
defaultMessage="commented on a deleted moment"
description="src/components/Notice/CommentNotice/MomentNewCommentNotice.tsx"
id="E0xjVb"
/>
}
content={<NoticeComment comment={notice.comment} />}
testId={TEST_ID.NOTICE_MOMENT_NEW_COMMENT}
/>
)
}

return (
<NoticeDigest
notice={notice}
Expand Down
18 changes: 17 additions & 1 deletion src/components/Notice/MomentNotice/MomentLiked.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import gql from 'graphql-tag'
import { FormattedMessage } from 'react-intl'

import { TEST_ID } from '~/common/enums'
import { MomentLikedNoticeFragment } from '~/gql/graphql'
import { MomentLikedNoticeFragment, MomentState } from '~/gql/graphql'

import NoticeActorAvatar from '../NoticeActorAvatar'
import NoticeDate from '../NoticeDate'
Expand All @@ -15,6 +15,22 @@ const MomentLikedNotice = ({
}: {
notice: MomentLikedNoticeFragment
}) => {
if (notice.moment.state === MomentState.Archived) {
return (
<NoticeDigest
notice={notice}
action={
<FormattedMessage
defaultMessage="liked your deleted moment"
description="src/components/Notice/MomentNotice/MomentLiked.tsx"
id="5RPoaZ"
/>
}
testId={TEST_ID.NOTICE_MOMENT_LIKED}
/>
)
}

return (
<NoticeDigest
notice={notice}
Expand Down
1 change: 1 addition & 0 deletions src/components/Notice/NoticeMomentTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ NoticeMomentTitle.fragments = {
moment: gql`
fragment NoticeMomentTitle on Moment {
id
state
content
shortHash
assets {
Expand Down

0 comments on commit 7f86788

Please sign in to comment.