浏览代码

fix: workspace member's last_active should be last_active_time, but not last_login_time (#4906)

DomKing 10 月之前
父节点
当前提交
43c19007e0

+ 1 - 0
api/fields/member_fields.py

@@ -28,6 +28,7 @@ account_with_role_fields = {
     'avatar': fields.String,
     'email': fields.String,
     'last_login_at': TimestampField,
+    'last_active_at': TimestampField,
     'created_at': TimestampField,
     'role': fields.String,
     'status': fields.String,

+ 1 - 1
web/app/components/header/account-setting/members-page/index.tsx

@@ -105,7 +105,7 @@ const MembersPage = () => {
                       <div className='text-xs text-gray-500 leading-[18px]'>{account.email}</div>
                     </div>
                   </div>
-                  <div className='shrink-0 flex items-center w-[104px] py-2 text-[13px] text-gray-700'>{dayjs(Number((account.last_login_at || account.created_at)) * 1000).locale(locale === 'zh-Hans' ? 'zh-cn' : 'en').fromNow()}</div>
+                  <div className='shrink-0 flex items-center w-[104px] py-2 text-[13px] text-gray-700'>{dayjs(Number((account.last_active_at || account.created_at)) * 1000).locale(locale === 'zh-Hans' ? 'zh-cn' : 'en').fromNow()}</div>
                   <div className='shrink-0 w-[96px] flex items-center'>
                     {
                       (owner && account.role !== 'owner')

+ 2 - 1
web/models/common.ts

@@ -27,6 +27,7 @@ export type UserProfileResponse = {
   interface_theme?: string
   timezone?: string
   last_login_at?: string
+  last_active_at?: string
   last_login_ip?: string
   created_at?: string
 }
@@ -61,7 +62,7 @@ export type TenantInfoResponse = {
   trial_end_reason: null | 'trial_exceeded' | 'using_custom'
 }
 
-export type Member = Pick<UserProfileResponse, 'id' | 'name' | 'email' | 'last_login_at' | 'created_at'> & {
+export type Member = Pick<UserProfileResponse, 'id' | 'name' | 'email' | 'last_login_at' | 'last_login_at' | 'created_at'> & {
   avatar: string
   status: 'pending' | 'active' | 'banned' | 'closed'
   role: 'owner' | 'admin' | 'editor' | 'normal'