Skip to content

Conversation

luka-nextcloud
Copy link
Contributor

Resolves: #1897

@luka-nextcloud luka-nextcloud marked this pull request as ready for review August 15, 2025 18:27
@Koc
Copy link
Contributor

Koc commented Aug 15, 2025

can you please add import support 🙏? It can helps me a lot for #1801

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.

Not sure if this is intentional or not, but if you change a column name, the activity log that references the column still uses the old name which can be confusing

@luka-nextcloud
Copy link
Contributor Author

Not sure if this is intentional or not, but if you change a column name, the activity log that references the column still uses the old name which can be confusing

@enjeck Since we use the activity log to track the object's history, I think we should respect the column name at the time the action was logged

@enjeck
Copy link
Contributor

enjeck commented Aug 26, 2025

@enjeck Since we use the activity log to track the object's history, I think we should respect the column name at the time the action was logged

I agree!

@luka-nextcloud luka-nextcloud force-pushed the activity-support branch 2 times, most recently from 99bc822 to 48e8f85 Compare August 27, 2025 14:54
Comment on lines +209 to +212
switch ($subjectIdentifier) {
case self::SUBJECT_TABLE_CREATE:
$subject = $ownActivity ? $l->t('You have created a new table {table}'): $l->t('{user} has created a new table {table}');
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the right way to deal with translations with params? I figured it would be something using square brackets e.g [table], as described in https://docs.nextcloud.com/server/latest/developer_manual/basics/translations.html#php-backend.

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.

@luka-nextcloud Are you done here? Because from reading #1897, there are some requirements listed there and I wonder if we will be covering them all here

@luka-nextcloud
Copy link
Contributor Author

@luka-nextcloud Are you done here? Because from reading #1897, there are some requirements listed there and I wonder if we will be covering them all here

@enjeck In my opinion, we are done for now. The remaining requirement is clean-up schedule (number 5 and 6) which I think should be discussed and done from the activity app.

Signed-off-by: Luka Trovic <[email protected]>
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.

Great effort @luka-nextcloud 🙇 Everything looks good and works (two glitches, nothing big). Happy about this!

There are quick formal matters: please add declare(strict_types=1); to all new classes and add type hints and return types to the methods that do not have them (typically missing in some of the new classes).

And smaller functional cases:

  • table deletion activity did not show up for me (owner of the table was someone else), but only for this someone else.
  • Renaming a table, and Description update, have an issue with activity formatting or so: Rich subject or a parameter for "{user} has renamed the table {before} to {table}" is malformed

Backend-wise all is good. The frontend-usage is nice as well, I didn't check the code there though. If the items mentioned above can be addressed, green lights from my side.

private IManager $manager,
private IFactory $l10nFactory,
private TableMapper $tableMapper,
private Row2Mapper $rowMapper,
Copy link
Member

Choose a reason for hiding this comment

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

unused

Comment on lines +24 to +26
public const SUBJECT_PARAMS_MAX_LENGTH = 4000;
public const SHORTENED_MAX_LENGTH = 2000;
public const ROW_NAME_MAX_LENGTH = 20;
Copy link
Member

Choose a reason for hiding this comment

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

seem to be unusued?

Comment on lines +15 to +16
private $l10n;
private $urlGenerator;
Copy link
Member

Choose a reason for hiding this comment

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

provide type or use property promotion

Comment on lines +15 to +23
/** @var IL10N */
protected $l;

/**
* @param IL10N $l
*/
public function __construct(IL10N $l) {
$this->l = $l;
}
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
/** @var IL10N */
protected $l;
/**
* @param IL10N $l
*/
public function __construct(IL10N $l) {
$this->l = $l;
}
public function __construct(protected IL10N $l) {
}

) {
}

public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent {
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
public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent {
public function parse(string $language, IEvent $event, ?IEvent $previousEvent = null): IEvent {

return [];
}
$members = $circle->getMembers();
return array_map(fn ($member) => $member->getUserId(), $members);
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
return array_map(fn ($member) => $member->getUserId(), $members);
return array_map(static fn ($member) => $member->getUserId(), $members);

/** @var Share $share */
foreach ($shares as $share) {
if ($share->getReceiverType() === ShareReceiverType::USER) {
$sharedWithUserIds[] = $share->getReceiver();
Copy link
Member

Choose a reason for hiding this comment

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

consider using the user id as key. Instead of array_unique() later on, only array_keys() can be returned. Then array_flip() may help with array_merge.

There might be a lot of users in the result set, this would take some short cuts in cpu and memory in such cases.

'micromark-factory-title',
'micromark-util-normalize-identifier',
'micromark-factory-whitespace',
],
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what this removal is about, but if it is some cleanup of unnecessary things (smells like it!), all cool. I want to double check that this is not something unintended.

$columns .= ', ';
}
}
$subject = $ownActivity ? $l->t('You have updated cell(s) ' . $columns . ' on row {row} in table {table}') : $l->t('{user} has updated cell(s) ' . $columns . ' on row {row} in table {table}');
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
$subject = $ownActivity ? $l->t('You have updated cell(s) ' . $columns . ' on row {row} in table {table}') : $l->t('{user} has updated cell(s) ' . $columns . ' on row {row} in table {table}');
$subject = $ownActivity ? $l->t('You have updated one or more cells ' . $columns . ' on row {row} in table {table}') : $l->t('{user} has updated one or more cells ' . $columns . ' on row {row} in table {table}');

The bracket is not that natural to read. But if we can figure out whether is one or more we can use the plural functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Activity support
4 participants