Rename button "download torrent" to "download private torrent" when the tracker is in close mode#487
Merged
josecelano merged 5 commits intotorrust:developfrom Feb 27, 2024
Conversation
even when it has to be hidden. For example, when the tracker is private and the user is not logged in.
Member
Author
Tracker modes can be:
```typescript
export declare enum TrackerMode {
Public = 0,
Private = 1,
Whitelisted = 2,
PrivateWhitelisted = 3
}
```
We also call a public tracker to the subset: `Public` and `Whitelisted`.
This refactor uses "open" and "close" for:
- Open: `Public` or `Whitelisted`
- Close: `Private` or `PrivateWhitelisted`
See: torrust/torrust-tracker#717
when the user is not logged in and the tracker is private.
The type TrackerMode was being used but the API wrapper returns a string: `Public`, `Private`, ... It was not detecting the rigth tracker mode. todo: change the `useSettings` function to return typed value if we want to compare to another type (TrackerMode).
Member
Author
|
There was also a bug in this function: export function isTrackerPublic (): boolean {
const settings = useSettings();
return settings.value.tracker_mode === TrackerMode.Public ||
settings.value.tracker_mode === TrackerMode.Whitelisted;
}
export function isUserLoggedIn (): boolean {
return !!useUser().value?.username;
}It was not working because The temporary patch is: export function isTrackerOpen (): boolean {
const settings = useSettings();
// todo: we are not using the type TrackerMode in
// settings.value.tracker_mode
return settings.value.tracker_mode === "Public" ||
settings.value.tracker_mode === "Whitelisted";
}We could change the |
Member
Author
|
ACK 385b695 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Uh oh!
There was an error while loading. Please reload this page.