Skip to content

Conversation

@vitormattos
Copy link

@vitormattos vitormattos added this to the Nextcloud 25 milestone Jun 13, 2022
@vitormattos vitormattos self-assigned this Jun 13, 2022
@vitormattos vitormattos force-pushed the feature/add-comments-expire-date branch 3 times, most recently from 02c2aa0 to 509ab48 Compare June 13, 2022 16:16
@nickvergessen
Copy link
Member

Tested with our instance:

SELECT COUNT(*) FROM oc_comments;
+----------+
| COUNT(*) |
+----------+
|  1059368 |
+----------+

ALTER TABLE `oc_comments` ADD `expire_date` DATETIME NULL AFTER `reactions`; 
Query OK, 0 rows affected (0.028 sec)
Records: 0  Duplicates: 0  Warnings: 0

ALTER TABLE `oc_comments` ADD INDEX `expire_date` (`expire_date`); 
Query OK, 0 rows affected (2.084 sec)
Records: 0  Duplicates: 0  Warnings: 0

So sounds good.

@vitormattos
Copy link
Author

Now, can I squash the commits?

@nickvergessen
Copy link
Member

Now, can I squash the commits?

Sounds good to me

@nickvergessen nickvergessen added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jun 14, 2022
@nickvergessen
Copy link
Member

you need to run bash build/autoload... and commit the changed files in lib/composer/composer/autoload_* (not the installed.php and InstalledVersion.php)

@nickvergessen nickvergessen requested review from a team, CarlSchwan, blizzz and icewind1991 and removed request for a team June 14, 2022 15:02
@vitormattos vitormattos force-pushed the feature/add-comments-expire-date branch from 81ccb9f to 71b1fbb Compare June 15, 2022 14:50
@vitormattos vitormattos force-pushed the feature/add-comments-expire-date branch from 71b1fbb to c59b0c2 Compare June 15, 2022 14:59
@vitormattos
Copy link
Author

vitormattos commented Jun 15, 2022

Autoload updated with new migration file and commits squashed.

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.

CI is unhappy

expire_date is also not exposed in DAV API, making it inconsistent with the other features. Cf. apps/dav/lib/Comments/CommentNode.php

);

// just to make sure they are really set, with correct actor data
$comment = $manager->get(strval($ids[1]));
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
$comment = $manager->get(strval($ids[1]));
$comment = $manager->get((string)$ids[1]);

micro optimization :)

Copy link
Author

Choose a reason for hiding this comment

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

Good question. I tested the two ways and don't identify the difference. Can you explain the optimization in this case?
https://gist.github.com/vitormattos/e242d41f92dc1ae4548c7311644fb287

Copy link
Author

Choose a reason for hiding this comment

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

PS: I only followed the pattern to get string value used in other methods of this test class, but normally I prefer to use (string) only because I think is most common to found in texts.

Only by curiosity I did this:

git grep strval|wc -l
32
git grep "(string)"|wc -l
481

Maybe, I think is good to change the 32 places of strval in server repository to (string)

Copy link
Author

@vitormattos vitormattos Jun 20, 2022

Choose a reason for hiding this comment

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

I did other test to check the opcode in site 3v4l.org using the follow code:

echo (string) 1;
echo strval(1);
echo (string) 1;

...and the opcode is the same:

line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   CAST                                          6  ~0      1
          1        ECHO                                                     ~0
    4     2        CAST                                          6  ~1      1
          3        ECHO                                                     ~1
    5     4        CAST                                          6  ~2      1
          5        ECHO                                                     ~2
    6     6      > RETURN                                                   1

https://3v4l.org/kiXe0/vld

I duplicated the first row to check if the return is from strval or is the return of script, the return is from script.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, it was intval vs int-casting. Never mind then!

@nickvergessen
Copy link
Member

expire_date is also not exposed in DAV API

Neither is the optional refernce_id that we added for talk specifically. I think that's fine.

@blizzz
Copy link
Member

blizzz commented Jun 15, 2022

expire_date is also not exposed in DAV API

Neither is the optional refernce_id that we added for talk specifically. I think that's fine.

Does not mean it is not worth to add it there as well. The reference id has of course less meaning for file comments. The expiry date would be more relevant, but on the other hand the web ui does not offer this option either. Thus, I also agree it is okay to leave it out, nevertheless worth to point out that this is done deliberately.

P.S.: i.e. my rejection is about the failing tests.

```
git grep strval|wc -l
32
git grep "(string)"|wc -l
481
```

Signed-off-by: Vitor Mattos <[email protected]>
@blizzz blizzz added 4. to release Ready to be released and/or waiting for tests to finish enhancement and removed 3. to review Waiting for reviews labels Jun 24, 2022
@blizzz blizzz merged commit 4722baf into master Jun 24, 2022
@blizzz blizzz deleted the feature/add-comments-expire-date branch June 24, 2022 08:28
@nickvergessen
Copy link
Member

Missing a version bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish enhancement feature: comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants