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

Question mark in peer-deletion confirmation dialog is on a new line #16742

Closed
stephendonner opened this issue Jul 1, 2021 · 11 comments
Closed
Assignees
Labels
closed/stale Issue is no longer relevant, perhaps because the feature it refers to has been deprecated. feature/web3/ipfs good first issue OS/Desktop priority/P5 Not scheduled. Don't anticipate work on this any time soon.

Comments

@stephendonner
Copy link

Description

(Super, super minor.)

Question mark in peer-deletion confirmation dialog is on a new line

Steps to Reproduce

  1. new profile
  2. launch Brave
  3. set up a peer (see Allow users to add IPFS peer servers #15567 for full steps)
  4. load brave://settings/ipfs/peers
  5. click on the trash-can icon
  6. look at the resulting dialog

Actual result:

Do you really want to delete
12D3KooWDL8FAiiaGoTuzsAFvKrNCHA2NnaNMDNYTTaqgAszY7R4
?

Screen Shot 2021-07-01 at 1 40 31 PM

Expected result:

? would preferably be on the same line; maybe truncate the long peer ID with ... or something?

Reproduces how often:

100%

Brave version (brave://version info)

Brave 1.28.37 Chromium: 91.0.4472.124 (Official Build) nightly (x86_64)
Revision 7345a6d1bfcaff81162a957e9b7d52649fe2ac38-refs/branch-heads/4472_114@{#6}
OS macOS Version 11.4 (Build 20F71)
@himanshu007-creator
Copy link

himanshu007-creator commented Jul 2, 2021

Hi, i would like to work on this issue.

proposed solution

function truncateString(str, num) {
if (str.length > num) {
return str.slice(0, num) + "...";
} else {
return str;
}
}

I would like if someone could guide me to the file. Thanks

@deepxcode
Copy link

@stephendonner Would like to work on this? Can you assign this to me?
Thank You.

@stephendonner
Copy link
Author

@stephendonner Would like to work on this? Can you assign this to me?
Thank You.

Sure, thanks!

@deepxcode
Copy link

@stephendonner I read the pre-requisites to set up a peer, Is it necessary to have to two different machines to make a peer, I only have one laptop with me.

@stephendonner
Copy link
Author

@stephendonner I read the pre-requisites to set up a peer, Is it necessary to have to two different machines to make a peer, I only have one laptop with me.

Nope; you can set up one on nightly and another on beta or dev (1.27.x branch`) - they use different ports.

@deepxcode
Copy link

deepxcode commented Jul 8, 2021

Hey @petemill and @mkarolin , I know how to truncate the string.
The code is need to be changed in this file right? settings_localized_strings_provider.cc

The id is in line 296: {"ipfsDeletePeerConfirmation", IDS_SETTINGS_IPFS_DELETE_PEER_CONFIRMATION},
I can add a method in that file like this:

#include <iostream>
#include <string>
using namespace std;

string truncate(string str, size_t width, bool show_ellipsis=true)
{
    if (str.length() > width)
        if (show_ellipsis)
            return str.substr(0, width) + "...";
        else
            return str.substr(0, width);
    return str;
}

and then just do the following change
{"ipfsDeletePeerConfirmation", truncate(IDS_SETTINGS_IPFS_DELETE_PEER_CONFIRMATION, 8)},

After this, I guess the issue will be resolved.
Am I allowed to write the above method (truncate) in the file?
If so, then I can resolve the issue.

Till now I am able to come up with this approach to resolve the issue, If you are not satisfied with this approach, I will think of another way.

@petemill
Copy link
Member

petemill commented Jul 8, 2021

I don't think truncating the string in c++ is appropriate when this is a display issue and can be fixed close to the UI in JavaScript. You can truncTe there but it's still a long string of random characters to put in. A sentence. Perhaps it would be better to separate the peer ID and the question, e.g.

[peer ID]
Are you sure you want to delete this IPFS peer?

@deepxcode
Copy link

Yes it would be better if we do that, will make the necessary changes and make the Pull request.
Thank you

@deepxcode
Copy link

deepxcode commented Jul 9, 2021

So instead of

      <message name="IDS_SETTINGS_IPNS_DELETE_KEY_CONFIRMATION" desc="Confirmation text for deleting a key from IPFS keys manager page">
        Do you really want to delete <ph name="KEY_NAME">$1<ex>MyCustomKey</ex></ph>?
      </message>

It will be,

      <message name="IDS_SETTINGS_IPNS_DELETE_KEY_CONFIRMATION" desc="Confirmation text for deleting a key from IPFS keys manager page">
         <ph name="KEY_NAME">$1<ex>MyCustomKey</ex></ph>
         Are you sure you want to delete this IPFS peer?
      </message>

Am I right @petemill ?

@rebron rebron added the priority/P5 Not scheduled. Don't anticipate work on this any time soon. label May 18, 2022
@wadehrarshpreet
Copy link

@rebron seems working fine. Can see ? same line with peer ipfs address
Screenshot 2022-05-27 at 11 18 54 PM

Brave v1.39.111

@srirambv
Copy link
Contributor

This seem to be fixed already based on the above comment and checked on 1.49.100 as well. Closing the issue for now. Can always reopen if it regresses.

@srirambv srirambv closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2023
@srirambv srirambv added the closed/stale Issue is no longer relevant, perhaps because the feature it refers to has been deprecated. label Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed/stale Issue is no longer relevant, perhaps because the feature it refers to has been deprecated. feature/web3/ipfs good first issue OS/Desktop priority/P5 Not scheduled. Don't anticipate work on this any time soon.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants