Skip to content

Commit

Permalink
fix: tag types
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaucau committed Oct 20, 2023
1 parent 826e678 commit 3e7829d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 7 additions & 3 deletions js/src/forum/components/MyTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import Component from 'flarum/common/Component';
import app from 'flarum/forum/app';
import Separator from 'flarum/common/components/Separator';
import Link from 'flarum/common/components/Link';
// @ts-ignore
import tagLabel from '@flarum/tags/helpers/tagLabel';
import tagLabel from 'flarum/tags/common/helpers/tagLabel';
import type Tag from 'flarum/tags/common/models/Tag';

interface FollowableTag extends Tag {
subscription: () => 'not_follow' | 'follow' | 'lurk' | 'ignore' | 'hide';
}

export default class extends Component {
view(vnode: Vnode<ComponentAttrs, this>): Children {
const tags: Array<any> = app.store.all('tags').filter((tag) => tag.subscription() === 'follow' || tag.subscription() === 'lurk');
const tags = (app.store.all('tags') as FollowableTag[]).filter((tag) => tag.subscription() === 'follow' || tag.subscription() === 'lurk');
const showPlaceholder: boolean = app.forum.attribute('my-tags.enable-placeholder');

if (!tags.length && !showPlaceholder) return;
Expand Down
3 changes: 2 additions & 1 deletion js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"declarationDir": "./dist-typings",
"baseUrl": ".",
"paths": {
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"]
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"],
"flarum/tags/*": ["../vendor/flarum/tags/js/dist-typings/*"]
},
"importsNotUsedAsValues": "error"
}
Expand Down
4 changes: 3 additions & 1 deletion js/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports = require('flarum-webpack-config')();
module.exports = require('flarum-webpack-config')({
useExtensions: ['flarum/tags'],
});

0 comments on commit 3e7829d

Please sign in to comment.