fix(admin): correct ticket message bubble alignment in admin panel

This commit is contained in:
xboard
2025-05-11 17:44:18 +08:00
parent 8377962836
commit f3cdc2e765
6 changed files with 245 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ class MessageResource extends JsonResource
return [ return [
"id" => $this['id'], "id" => $this['id'],
"ticket_id" => $this['ticket_id'], "ticket_id" => $this['ticket_id'],
"is_me" => $this['is_me'], "is_me" => $this['is_from_user'],
"message" => $this["message"], "message" => $this["message"],
"created_at" => $this['created_at'], "created_at" => $this['created_at'],
"updated_at" => $this['updated_at'] "updated_at" => $this['updated_at']

View File

@@ -15,7 +15,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property \Illuminate\Support\Carbon $created_at * @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at * @property \Illuminate\Support\Carbon $updated_at
* @property-read \App\Models\Ticket $ticket 关联的工单 * @property-read \App\Models\Ticket $ticket 关联的工单
* @property-read bool $is_me 当前消息是否由工单发起人发送 * @property-read bool $is_from_user 消息是否由工单发起人发送
* @property-read bool $is_from_admin 消息是否由管理员发送
*/ */
class TicketMessage extends Model class TicketMessage extends Model
{ {
@@ -27,7 +28,7 @@ class TicketMessage extends Model
'updated_at' => 'timestamp' 'updated_at' => 'timestamp'
]; ];
protected $appends = ['is_me']; protected $appends = ['is_from_user', 'is_from_admin'];
/** /**
* 关联的工单 * 关联的工单
@@ -40,8 +41,16 @@ class TicketMessage extends Model
/** /**
* 判断消息是否由工单发起人发送 * 判断消息是否由工单发起人发送
*/ */
public function getIsMeAttribute(): bool public function getIsFromUserAttribute(): bool
{ {
return $this->ticket->user_id === $this->user_id; return $this->ticket->user_id === $this->user_id;
} }
/**
* 判断消息是否由管理员发送
*/
public function getIsFromAdminAttribute(): bool
{
return $this->ticket->user_id !== $this->user_id;
}
} }

File diff suppressed because one or more lines are too long

View File

@@ -1772,6 +1772,83 @@ window.XBOARD_TRANSLATIONS['en-US'] = {
"empty": "No ALPN Protocols Available" "empty": "No ALPN Protocols Available"
} }
} }
},
"socks": {
"version": {
"label": "Protocol Version",
"placeholder": "Select SOCKS Version"
},
"tls": {
"label": "TLS",
"placeholder": "Please select security",
"disabled": "Disabled",
"enabled": "Enabled"
},
"tls_settings": {
"server_name": {
"label": "Server Name Indication (SNI)",
"placeholder": "Leave empty if not used"
},
"allow_insecure": "Allow Insecure?"
},
"network": {
"label": "Transport Protocol",
"placeholder": "Select transport protocol"
}
},
"naive": {
"tls_settings": {
"server_name": {
"label": "Server Name Indication (SNI)",
"placeholder": "Used for certificate verification when domain differs from node address"
},
"allow_insecure": "Allow Insecure"
},
"tls": {
"label": "TLS",
"placeholder": "Please select security",
"disabled": "Disabled",
"enabled": "Enabled",
"server_name": {
"label": "Server Name Indication (SNI)",
"placeholder": "Used for certificate verification when domain differs from node address"
},
"allow_insecure": "Allow Insecure"
}
},
"http": {
"tls_settings": {
"server_name": {
"label": "Server Name Indication (SNI)",
"placeholder": "Used for certificate verification when domain differs from node address"
},
"allow_insecure": "Allow Insecure"
},
"tls": {
"label": "TLS",
"placeholder": "Please select security",
"disabled": "Disabled",
"enabled": "Enabled",
"server_name": {
"label": "Server Name Indication (SNI)",
"placeholder": "Used for certificate verification when domain differs from node address"
},
"allow_insecure": "Allow Insecure"
}
},
"mieru": {
"transport": {
"label": "Transport Protocol",
"placeholder": "Select transport protocol"
},
"multiplexing": {
"label": "Multiplexing",
"placeholder": "Select multiplexing level",
"MULTIPLEXING_OFF": "Disabled",
"MULTIPLEXING_LOW": "Low",
"MULTIPLEXING_MIDDLE": "Medium",
"MULTIPLEXING_HIGH": "High"
}
} }
}, },
"network_settings": { "network_settings": {

View File

@@ -1740,6 +1740,83 @@ window.XBOARD_TRANSLATIONS['ko-KR'] = {
"empty": "사용 가능한 ALPN 프로토콜이 없습니다" "empty": "사용 가능한 ALPN 프로토콜이 없습니다"
} }
} }
},
"socks": {
"version": {
"label": "프로토콜 버전",
"placeholder": "SOCKS 버전 선택"
},
"tls": {
"label": "TLS",
"placeholder": "보안을 선택해주세요",
"disabled": "비활성화",
"enabled": "활성화"
},
"tls_settings": {
"server_name": {
"label": "서버 이름 표시(SNI)",
"placeholder": "사용하지 않는 경우 비워두세요"
},
"allow_insecure": "안전하지 않은 연결 허용?"
},
"network": {
"label": "전송 프로토콜",
"placeholder": "전송 프로토콜 선택"
}
},
"naive": {
"tls_settings": {
"server_name": {
"label": "서버 이름 표시(SNI)",
"placeholder": "사용하지 않는 경우 비워두세요"
},
"allow_insecure": "안전하지 않은 연결 허용?"
},
"tls": {
"label": "TLS",
"placeholder": "보안을 선택해주세요",
"disabled": "비활성화",
"enabled": "활성화",
"server_name": {
"label": "서버 이름 표시(SNI)",
"placeholder": "노드 주소와 인증서가 다를 때 인증서 확인에 사용"
},
"allow_insecure": "안전하지 않은 연결 허용"
}
},
"http": {
"tls_settings": {
"server_name": {
"label": "서버 이름 표시(SNI)",
"placeholder": "사용하지 않는 경우 비워두세요"
},
"allow_insecure": "안전하지 않은 연결 허용?"
},
"tls": {
"label": "TLS",
"placeholder": "보안을 선택해주세요",
"disabled": "비활성화",
"enabled": "활성화",
"server_name": {
"label": "서버 이름 표시(SNI)",
"placeholder": "노드 주소와 인증서가 다를 때 인증서 확인에 사용"
},
"allow_insecure": "안전하지 않은 연결 허용"
}
},
"mieru": {
"transport": {
"label": "전송 프로토콜",
"placeholder": "전송 프로토콜 선택"
},
"multiplexing": {
"label": "다중화",
"placeholder": "다중화 수준 선택",
"MULTIPLEXING_OFF": "비활성화",
"MULTIPLEXING_LOW": "낮음",
"MULTIPLEXING_MIDDLE": "중간",
"MULTIPLEXING_HIGH": "높음"
}
} }
} }
}, },

View File

@@ -1739,6 +1739,83 @@ window.XBOARD_TRANSLATIONS['zh-CN'] = {
"empty": "未找到可用的ALPN协议" "empty": "未找到可用的ALPN协议"
} }
} }
},
"socks": {
"version": {
"label": "协议版本",
"placeholder": "选择SOCKS版本"
},
"tls": {
"label": "TLS",
"placeholder": "请选择安全性",
"disabled": "不支持",
"enabled": "支持"
},
"tls_settings": {
"server_name": {
"label": "服务器名称指示(SNI)",
"placeholder": "不使用请留空"
},
"allow_insecure": "允许不安全?"
},
"network": {
"label": "传输协议",
"placeholder": "选择传输协议"
}
},
"naive": {
"tls_settings": {
"server_name": {
"label": "服务器名称指示(SNI)",
"placeholder": "不使用请留空"
},
"allow_insecure": "允许不安全?"
},
"tls": {
"label": "TLS",
"placeholder": "请选择安全性",
"disabled": "不支持",
"enabled": "支持",
"server_name": {
"label": "服务器名称指示(SNI)",
"placeholder": "当节点地址与证书不一致时用于证书验证"
},
"allow_insecure": "允许不安全连接"
}
},
"http": {
"tls": {
"label": "TLS",
"placeholder": "请选择安全性",
"disabled": "不支持",
"enabled": "支持",
"server_name": {
"label": "服务器名称指示(SNI)",
"placeholder": "当节点地址与证书不一致时用于证书验证"
},
"allow_insecure": "允许不安全连接"
},
"tls_settings": {
"server_name": {
"label": "服务器名称指示(SNI)",
"placeholder": "当节点地址与证书不一致时用于证书验证"
},
"allow_insecure": "允许不安全连接"
}
},
"mieru": {
"transport": {
"label": "传输协议",
"placeholder": "选择传输协议"
},
"multiplexing": {
"label": "多路复用",
"placeholder": "选择多路复用级别",
"MULTIPLEXING_OFF": "关闭",
"MULTIPLEXING_LOW": "低",
"MULTIPLEXING_MIDDLE": "中",
"MULTIPLEXING_HIGH": "高"
}
} }
}, },
"network_settings": { "network_settings": {