Commit d2bcee82 authored by henry's avatar henry Committed by brizental
Browse files

fixup! BB 33852: Clean up about:logins (LockWise) to avoid mentioning sync, etc.

TB 44128: Fix about:logins to be able to hard disable the "new-login-button".
parent 83a221c1
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -27,9 +27,6 @@ const gElements = {
      ".menuitem-remove-all-logins"
    );
  },
  get createNewLoginButton() {
    return this.loginList.shadowRoot.querySelector(".create-login-button");
  },
};

let numberOfLogins = 0;
@@ -136,9 +133,7 @@ window.addEventListener("AboutLoginsChromeToContent", event => {
      gElements.loginList.setSortDirection(event.detail.value.selectedSort);
      document.documentElement.classList.add("initialized");
      gElements.loginList.classList.add("initialized");
      if (!event.detail.value.canCreateLogins) {
        gElements.createNewLoginButton.disabled = true;
      }
      gElements.loginList.canCreateLogins = event.detail.value.canCreateLogins;
      break;
    }
    case "ShowLoginItemError": {
+4 −1
Original line number Diff line number Diff line
@@ -48,6 +48,9 @@ export class CreateLoginButton extends MozLitElement {
  static get properties() {
    return {
      disabled: { type: Boolean, reflect: true },
      // Whether the button is disabled no matter if the "disabled" attribute is
      // switched.
      hardDisabled: { type: Boolean, reflect: true },
    };
  }

@@ -62,7 +65,7 @@ export class CreateLoginButton extends MozLitElement {
        l10nId: "create-login-button",
        variant: "icon-button",
        icon: "chrome://global/skin/icons/plus.svg",
        disabled: this.disabled,
        disabled: this.disabled || this.hardDisabled,
      })}
    `;
  }
+24 −1
Original line number Diff line number Diff line
@@ -111,6 +111,28 @@ export default class LoginList extends HTMLElement {
    this._blankLoginListItem.hidden = true;
  }

  /**
   * Whether the user can create logins.
   *
   * @type {boolean}
   */
  _canCreateLogins = false;

  get canCreateLogins() {
    return this._canCreateLogins;
  }

  set canCreateLogins(value) {
    this._canCreateLogins = Boolean(value);
    this._canCreateLoginsUpdate();
  }

  _canCreateLoginsUpdate() {
    if (this._createLoginButton) {
      this._createLoginButton.hardDisabled = !this.canCreateLogins;
    }
  }

  connectedCallback() {
    if (this.shadowRoot) {
      return;
@@ -122,6 +144,7 @@ export default class LoginList extends HTMLElement {

    this._count = shadowRoot.querySelector(".count");
    this._createLoginButton = shadowRoot.querySelector("create-login-button");
    this._canCreateLoginsUpdate();
    this._list = shadowRoot.querySelector("ol");
    this._list.appendChild(this._blankLoginListItem);
    this._sortSelect = shadowRoot.querySelector("#login-sort");
@@ -426,7 +449,7 @@ export default class LoginList extends HTMLElement {
        break;
      }
      case "AboutLoginsShowBlankLogin": {
        if (!event.defaultPrevented) {
        if (!event.defaultPrevented && this.canCreateLogins) {
          this._selectedGuid = null;
          this._setListItemAsSelected(this._blankLoginListItem);
        }