fix(sharing): list accounts with matches in email

* Show users with matches in the email address.
* List email addresses in sharing dialog.

`NcSelect` filters the options based on matches in `label` and `subname`.
By using the email address as a subname we ensure
options with a matching email address are shown.

Signed-off-by: Max <max@nextcloud.com>
This commit is contained in:
Max
2024-11-04 08:31:37 +01:00
parent 4ad732a7c4
commit 3e4bf0eb99
3 changed files with 46 additions and 4 deletions

View File

@@ -6,11 +6,14 @@ import { randUser } from '../utils/index.js'
import { sampleBoard } from '../utils/sampleBoard'
const user = randUser()
const recipient = randUser()
const domain = Math.random().toString(36).replace(/[^a-z]+/g, '').slice(0, 10)
describe('Board', function() {
before(function() {
cy.createUser(user)
cy.createUser(recipient)
cy.login(recipient)
cy.setUserEmail(recipient, `${recipient.userId}@${domain}.com`)
})
beforeEach(function() {
@@ -34,6 +37,24 @@ describe('Board', function() {
})
})
it('Share a board to a user by email', function() {
const board = sampleBoard('Shared by email')
cy.createExampleBoard({ user, board }).then((board) => {
const boardId = board.id
cy.visit(`/apps/deck/#/board/${boardId}`)
cy.get('.board-title').contains(board.title)
// domain is only in the email address - not in user ids.
cy.shareBoardWithUi(domain, recipient.userId)
cy.login(recipient)
cy.visit(`/apps/deck/#/board/${boardId}`)
cy.get('.board-title').contains(board.title)
cy.get('.button-vue[aria-label*="Add card"]')
.should('not.exist')
})
})
it('Share a board to a user as writable', function() {
const board = sampleBoard('Editable board')
cy.createExampleBoard({ user, board }).then((board) => {