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

share with teams #1465

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

share with teams #1465

wants to merge 1 commit into from

Conversation

hweihwang
Copy link
Contributor

@hweihwang hweihwang commented Nov 18, 2024

Fixes #142

@hweihwang hweihwang force-pushed the share-with-teams branch 5 times, most recently from 8a288e5 to a6da886 Compare November 18, 2024 10:12
@juliusknorr juliusknorr requested review from blizzz and enjeck November 18, 2024 13:10
@juliusknorr juliusknorr added enhancement New feature or request 2. developing Work in progress labels Nov 18, 2024
@hweihwang hweihwang linked an issue Nov 18, 2024 that may be closed by this pull request
Copy link
Member

@blizzz blizzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the backend bits only so far.

lib/Helper/CircleHelper.php Outdated Show resolved Hide resolved
lib/Helper/CircleHelper.php Outdated Show resolved Hide resolved
lib/Helper/UserHelper.php Outdated Show resolved Hide resolved
lib/Service/ShareService.php Show resolved Hide resolved
@hweihwang
Copy link
Contributor Author

Thanks Arthur @blizzz 🙏 - those are really helpful!

@hweihwang hweihwang force-pushed the share-with-teams branch 2 times, most recently from 93927cb to a36c56e Compare November 20, 2024 10:21
@hweihwang hweihwang marked this pull request as ready for review November 20, 2024 10:22
@hweihwang hweihwang force-pushed the share-with-teams branch 6 times, most recently from 7803db6 to 34d53d6 Compare November 22, 2024 07:05
@hweihwang hweihwang requested a review from blizzz November 22, 2024 07:27
Copy link
Contributor

@enjeck enjeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just testing this out, and it looks pretty good!
Just want to confirm one thing. Is it okay that when if I share with a team, and later disable the Teams app, the team display name can not be shown (just the circle ID)? I assume this is expected since we can't access the display name if the app is disabled, but would like to confirm?

Screenshot from 2024-11-30 01-28-27

@hweihwang
Copy link
Contributor Author

Thank you @enjeck! That's a really good points, I didn't think about that actually. I think we can hide those shares when circles disabled, that would be better and more appropriate for this case. Let me know if we expect it different like completely remove those shares @juliusknorr @blizzz , thank you!

@juliusknorr
Copy link
Member

I think we can hide those shares when circles disabled

Yes, would agree with that. I think we do it the same way in the files app 👍

@enjeck
Copy link
Contributor

enjeck commented Dec 9, 2024

I think we can hide those shares when circles disabled

To confirm, in addition to hiding the shares from the sidebar, the tables are not shared with the users in a team?

Signed-off-by: Hoang Pham <[email protected]>
@hweihwang
Copy link
Contributor Author

Yes @enjeck, we check from BE so when getting all tables of a user will exclude those circle's shares

Copy link
Member

@blizzz blizzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backendwise looks OK (only nitpicks, not blocking), did not do functional tests so far.

Comment on lines +22 to +45
private LoggerInterface $logger;
private bool $circlesEnabled;
private ?CirclesManager $circlesManager;

/**
* @psalm-suppress UndefinedClass
*/
public function __construct(
LoggerInterface $logger,
IAppManager $appManager
) {
$this->logger = $logger;
$this->circlesEnabled = $appManager->isEnabledForUser('circles');
$this->circlesManager = null;

if ($this->circlesEnabled) {
try {
$this->circlesManager = Server::get(CirclesManager::class);
} catch (Throwable $e) {
$this->logger->warning('Failed to get CirclesManager: ' . $e->getMessage());
$this->circlesEnabled = false;
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private LoggerInterface $logger;
private bool $circlesEnabled;
private ?CirclesManager $circlesManager;
/**
* @psalm-suppress UndefinedClass
*/
public function __construct(
LoggerInterface $logger,
IAppManager $appManager
) {
$this->logger = $logger;
$this->circlesEnabled = $appManager->isEnabledForUser('circles');
$this->circlesManager = null;
if ($this->circlesEnabled) {
try {
$this->circlesManager = Server::get(CirclesManager::class);
} catch (Throwable $e) {
$this->logger->warning('Failed to get CirclesManager: ' . $e->getMessage());
$this->circlesEnabled = false;
}
}
}
private bool $circlesEnabled;
private ?CirclesManager $circlesManager;
/**
* @psalm-suppress UndefinedClass
*/
public function __construct(
private LoggerInterface $logger,
IAppManager $appManager
) {
$this->circlesEnabled = $appManager->isEnabledForUser('circles');
$this->circlesManager = null;
if ($this->circlesEnabled) {
try {
$this->circlesManager = Server::get(CirclesManager::class);
} catch (Throwable $e) {
$this->logger->warning('Failed to get CirclesManager: ' . $e->getMessage());
$this->circlesEnabled = false;
}
}
}

nitpick: use property promotion

Comment on lines +18 to +19
* @psalm-suppress UndefinedClass
* @psalm-suppress UndefinedDocblockClass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are they about? There should be nothing extra ordinary here?

Comment on lines +28 to +30
/**
* @psalm-suppress UndefinedClass
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question

Comment on lines +31 to +33
/**
* @psalm-suppress UndefinedDocblockClass
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is psalm complaining about here?


/**
* @psalm-import-type TablesShare from ResponseDefinitions
* @psalm-suppress UndefinedDocblockClass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also wondering here

@@ -85,7 +93,9 @@ public function findAll(string $nodeType, int $nodeId, ?string $userId = null, b
$userId = $this->permissionsService->preCheckUserId($userId);

try {
$shares = $this->mapper->findAllSharesForNode($nodeType, $nodeId, $userId);
$excluded = !$this->circleHelper->isCirclesEnabled() ? ['circle'] : [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another nitpick: ideal turn 'cirlce' into a constant (and adapt follow up usages).

(Yes, existing group string suffers from the same)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Share with Teams
4 participants