mirror of
https://github.com/mastodon/mastodon.git
synced 2025-07-14 08:18:15 +00:00
Compare commits
20 Commits
f6b1a81592
...
07a801a2e0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
07a801a2e0 | ||
![]() |
aa51b2ba37 | ||
![]() |
418e5617cc | ||
![]() |
f9f7018639 | ||
![]() |
1e672ae66e | ||
![]() |
fc18ec8bc1 | ||
![]() |
cce87b7f35 | ||
![]() |
35662387d2 | ||
![]() |
ff7e62f3c7 | ||
![]() |
59abde12ee | ||
![]() |
f70f096cae | ||
![]() |
70e595cb79 | ||
![]() |
1b0122631e | ||
![]() |
c6bef7522b | ||
![]() |
f69352fe56 | ||
![]() |
34739f2cce | ||
![]() |
3f8b83ee59 | ||
![]() |
5b98c1ba42 | ||
![]() |
6af65171f8 | ||
![]() |
81512ab4ca |
|
@ -12,7 +12,7 @@ class FiltersController < ApplicationController
|
|||
|
||||
def new
|
||||
@filter = current_account.custom_filters.build(action: :warn)
|
||||
@filter.keywords.build
|
||||
@filter.keywords.build(resource_params.dig(:keywords_attributes, '0'))
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
|
|
@ -41,12 +41,14 @@ const isHashtagLink = (
|
|||
interface TargetParams {
|
||||
hashtag?: string;
|
||||
accountId?: string;
|
||||
hashtagUrl?: URL;
|
||||
}
|
||||
|
||||
export const HashtagMenuController: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [{ accountId, hashtag }, setTargetParams] = useState<TargetParams>({});
|
||||
const [{ accountId, hashtag, hashtagUrl }, setTargetParams] =
|
||||
useState<TargetParams>({});
|
||||
const targetRef = useRef<HTMLAnchorElement | null>(null);
|
||||
const location = useLocation();
|
||||
const account = useAppSelector((state) =>
|
||||
|
@ -77,11 +79,21 @@ export const HashtagMenuController: React.FC = () => {
|
|||
return;
|
||||
}
|
||||
|
||||
const hashtagUrl: URL = new URL('/filters', document.location.href);
|
||||
hashtagUrl.searchParams.set(
|
||||
'custom_filter[keywords_attributes][0][keyword]',
|
||||
target.text,
|
||||
);
|
||||
hashtagUrl.searchParams.set(
|
||||
'custom_filter[keywords_attributes][0][whole_word]',
|
||||
'1',
|
||||
);
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
targetRef.current = target;
|
||||
setOpen(true);
|
||||
setTargetParams({ hashtag, accountId });
|
||||
setTargetParams({ hashtag, accountId, hashtagUrl });
|
||||
};
|
||||
|
||||
document.addEventListener('click', handleClick, { capture: true });
|
||||
|
@ -116,11 +128,11 @@ export const HashtagMenuController: React.FC = () => {
|
|||
text: intl.formatMessage(messages.muteHashtag, {
|
||||
hashtag,
|
||||
}),
|
||||
href: '/filters',
|
||||
href: hashtagUrl?.toString(),
|
||||
dangerous: true,
|
||||
},
|
||||
],
|
||||
[intl, hashtag, account],
|
||||
[intl, hashtag, account, hashtagUrl],
|
||||
);
|
||||
|
||||
if (!open) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user