-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
gui: Keep short deviceID length consistent + xrefs (fixes #9313) #9314
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
Conversation
gui/default/index.html
Outdated
@@ -910,7 +910,7 @@ <h4 class="panel-title"> | |||
</tr> | |||
<tr ng-if="deviceCfg.introducedBy"> | |||
<th><span class="far fa-fw fa-handshake-o"></span> <span translate>Introduced By</span></th> | |||
<td class="text-right">{{ deviceName(devices[deviceCfg.introducedBy]) || deviceCfg.introducedBy.substring(0, 5) }}</td> | |||
<td class="text-right">{{ deviceName(devices[deviceCfg.introducedBy]) || deviceCfg.introducedBy.substring(0, shortIDStringLength) }}</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function deviceName
already returns a short-id if there is no name, so the or part here does nothing and can be removed. Then you don't need to add shortIDStringLength
to $scope
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@imsodin Should I really remove it? There seems to be handling for undefined
with ""
which is then handled by that ||
and that one isn't present in deviceName()
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no, you are right - I misread that code. I was thinking the check was done on the same config, but it's devices[deviceCfg.introducedBy]
vs plain deviceCfg
afterwards. So lets leave the ||
part, however you can use the existing deviceShortID
function instead without needing shortIDStringLength
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@imsodin Fixed ✌️
lib/protocol/deviceid.go
Outdated
DeviceIDLength = 32 | ||
// keep consistent with shortIDStringLength in gui/default/syncthing/app.js | ||
ShortIDStringLength = 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the source of the CI failure: The added comment changes the alignment gofmt -S
expects:
=== RUN TestCheckGoFmt
gofmt_test.go:39: File ../lib/protocol/deviceid.go is not formatted correctly:
diff ../lib/protocol/deviceid.go.orig ../lib/protocol/deviceid.go
--- ../lib/protocol/deviceid.go.orig
+++ ../lib/protocol/deviceid.go
@@ -14,7 +14,7 @@
)
const (
- DeviceIDLength = 32
+ DeviceIDLength = 32
// keep consistent with shortIDStringLength in gui/default/syncthing/app.js
ShortIDStringLength = 7
)
--- FAIL: TestCheckGoFmt (1.20s)
https://github.com/syncthing/syncthing/actions/runs/7387700143/job/20096964099?pr=9314
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@imsodin Fixed 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
* main: Update dependencies (syncthing#9321) gui: Always inform about loading data in Restore Versions modal (syncthing#9317) lib/build: Allow semver build in version regex (fixes syncthing#9267) (syncthing#9316) gui: Keep short deviceID length consistent + xrefs (fixes syncthing#9313) (syncthing#9314) build(deps): bump actions/download-artifact from 3 to 4 (syncthing#9294) build(deps): bump actions/upload-artifact from 3 to 4 (syncthing#9293) gui, man, authors: Update docs, translations, and contributors gui, lib/scanner: Improve scan progress indication (ref syncthing#8331) (syncthing#9308) lib/protocol: handle empty names in unixOwnershipEqual (fixes syncthing#9039) (syncthing#9306) gui, man, authors: Update docs, translations, and contributors etc/linux-desktop: use double dash for long options (syncthing#9301) lib/connections: Skip allocation in check for missing port (syncthing#9297) lib/upgrade: Extract signing key to embedded file (fixes syncthing#9247) (syncthing#9296) gui, man, authors: Update docs, translations, and contributors build: Update quic-go (fixes syncthing#9287) lib/model: Only handle relevant folder summaries (kqueue) (fixes syncthing#9183) (syncthing#9288)
* main: Update dependencies (syncthing#9321) gui: Always inform about loading data in Restore Versions modal (syncthing#9317) lib/build: Allow semver build in version regex (fixes syncthing#9267) (syncthing#9316) gui: Keep short deviceID length consistent + xrefs (fixes syncthing#9313) (syncthing#9314) build(deps): bump actions/download-artifact from 3 to 4 (syncthing#9294) build(deps): bump actions/upload-artifact from 3 to 4 (syncthing#9293) gui, man, authors: Update docs, translations, and contributors gui, lib/scanner: Improve scan progress indication (ref syncthing#8331) (syncthing#9308) lib/protocol: handle empty names in unixOwnershipEqual (fixes syncthing#9039) (syncthing#9306) gui, man, authors: Update docs, translations, and contributors etc/linux-desktop: use double dash for long options (syncthing#9301) lib/connections: Skip allocation in check for missing port (syncthing#9297) lib/upgrade: Extract signing key to embedded file (fixes syncthing#9247) (syncthing#9296) gui, man, authors: Update docs, translations, and contributors build: Update quic-go (fixes syncthing#9287) lib/model: Only handle relevant folder summaries (kqueue) (fixes syncthing#9183) (syncthing#9288)
* main: (24 commits) lib/ignore: Refactor out result type (syncthing#9343) build: Testing infra images for infra-* branches lib/versioner: Expand tildes in version directory (fixes syncthing#9241) (syncthing#9327) lib/scanner: Prevent sync-conflict for receive-only local modifications (syncthing#9323) gui, man, authors: Update docs, translations, and contributors Fix website security link in README.md (syncthing#9325) cmd/syncthing: Add CLI completion functionality (fixes syncthing#8616) (syncthing#9226) lib/api: Save session & CSRF tokens to database, add option to stay logged in (fixes syncthing#9151) (syncthing#9284) Update dependencies (syncthing#9321) gui: Always inform about loading data in Restore Versions modal (syncthing#9317) lib/build: Allow semver build in version regex (fixes syncthing#9267) (syncthing#9316) gui: Keep short deviceID length consistent + xrefs (fixes syncthing#9313) (syncthing#9314) build(deps): bump actions/download-artifact from 3 to 4 (syncthing#9294) build(deps): bump actions/upload-artifact from 3 to 4 (syncthing#9293) gui, man, authors: Update docs, translations, and contributors gui, lib/scanner: Improve scan progress indication (ref syncthing#8331) (syncthing#9308) lib/protocol: handle empty names in unixOwnershipEqual (fixes syncthing#9039) (syncthing#9306) gui, man, authors: Update docs, translations, and contributors etc/linux-desktop: use double dash for long options (syncthing#9301) lib/connections: Skip allocation in check for missing port (syncthing#9297) ...
Purpose
Making short deviceID length consistent and referencing to protocol file for future-proof edits. Closes #9313.