diff --git a/framework/core/js/src/common/components/IPAddress.tsx b/framework/core/js/src/common/components/IPAddress.tsx index 1576ae4d3..e4e5bfe6c 100644 --- a/framework/core/js/src/common/components/IPAddress.tsx +++ b/framework/core/js/src/common/components/IPAddress.tsx @@ -13,7 +13,7 @@ export interface IIPAddressAttrs extends ComponentAttrs { * @example * * @example - * + * */ export default class IPAddress extends Component { ip!: string; @@ -31,7 +31,7 @@ export default class IPAddress { const items = new ItemList(); - items.add('ip', <>{this.ip}, 100); + items.add('ip', {this.ip}, 100); return items; } diff --git a/framework/core/js/src/common/models/Post.ts b/framework/core/js/src/common/models/Post.ts index 48aaa0ca6..66312e9cd 100644 --- a/framework/core/js/src/common/models/Post.ts +++ b/framework/core/js/src/common/models/Post.ts @@ -41,6 +41,10 @@ export default class Post extends Model { }).call(this); } + ipAddress() { + return Model.attribute('ipAddress').call(this); + } + editedAt() { return Model.attribute('editedAt', Model.transformDate).call(this); } diff --git a/framework/core/js/src/forum/components/PostMeta.tsx b/framework/core/js/src/forum/components/PostMeta.tsx index 8d022326a..acc063830 100644 --- a/framework/core/js/src/forum/components/PostMeta.tsx +++ b/framework/core/js/src/forum/components/PostMeta.tsx @@ -8,7 +8,9 @@ import type Model from '../../common/Model'; import type User from '../../common/models/User'; import classList from '../../common/utils/classList'; -type ModelType = Post | (Model & { user: () => User | null | false; createdAt: () => Date }); +type ModelType = + | Post + | (Model & { user: () => User | null | false; createdAt: () => Date; ipAddress: undefined | (() => string | null | undefined) }); export interface IPostMetaAttrs extends ComponentAttrs { /** Can be a post or similar model like private message */ @@ -53,7 +55,7 @@ export default class PostMeta {this.postIdentifier(post)} {fullTime(time)}{' '} - + {touch ? (