Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(desktop): add publish topic validation #1008

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/lang/connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,13 @@ export default {
ja: 'トピックを入力してください',
hu: 'Téma szükséges',
},
topicCannotContain: {
zh: '不能向包含通配符 #、+、$ 的 Topic 发布消息',
en: 'You cannot publish the message to a Topic that contains wildcards characters #, +, $',
tr: '#, +, $ karakterlerini içeren bir Konuya mesaj gönderemezsiniz',
ja: 'ワイルドカード文字 #、+、$ を含むトピックにメッセージを送信できません',
hu: '#, +, $ karakterlerini tartalmazó témához nem küldhetsz üzenetet',
},
topicTips: {
zh: '可订阅单个或多个主题,订阅多主题时,请使用逗号分隔(,)',
en: 'You can subscribe to single or multiple topics, please use comma separation to subscribe to multiple topics (,)',
Expand Down
6 changes: 6 additions & 0 deletions src/views/connections/ConnectionsDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,12 @@ export default class ConnectionsDetail extends Vue {
return false
}
if (topic && (topic.includes('+') || topic.includes('#') || topic.includes('$'))) {
this.$message.warning(this.$tc('connections.topicCannotContain'))
this.stopTimedSend()
return false
}
let props: PushPropertiesModel | undefined = undefined
if (properties && Object.entries(properties).filter(([_, v]) => v !== null && v !== undefined).length > 0) {
const propRecords = Object.entries(properties).filter(([_, v]) => v !== null && v !== undefined)
Expand Down