Commit Graph

64 Commits

Author SHA1 Message Date
Joas Schilling 5164f43bd3 Fix linter
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-02-11 09:35:37 +00:00
Joas Schilling cf11f914a7 Make Psalm happy
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-02-11 09:35:36 +00:00
Joas Schilling 8e43331d47 Improve mention matches
The previous regex didn't correctly match users with . ' or -

Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-02-11 09:35:36 +00:00
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +01:00
Joas Schilling ede7510854
Add a function to get the unread count for multiple objects in one go
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-04 11:01:21 +01:00
Joas Schilling 1f1244fdcc
Fix PHP CS
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-10-22 11:00:54 +02:00
Joas Schilling 8600e51df5
Fix manager creation and testing
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-10-22 10:54:03 +02:00
Joas Schilling 2dd50b4adc
Fix return type
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-10-21 11:02:05 +02:00
Joas Schilling 6400221fba
Less magic
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-10-21 09:47:40 +02:00
Joas Schilling d462439a63
Get the last comment date for a list of actors (to allow sorting mention suggestions e.g.)
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-10-21 09:18:51 +02:00
Joas Schilling 89651c5233
Allow to search on multiple objects with one query
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-10-21 09:16:42 +02:00
Joas Schilling 326640462b
Add methods to get the number of comments and last comment since a date
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-10-21 09:15:38 +02:00
Joas Schilling 2cc35cc65d
Include an option to also include the lastKnownCommentId object
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-10-21 09:08:48 +02:00
John Molakvoæ (skjnldsv) 3e1916080a
Add ICommentsManager::load method
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2020-10-20 14:39:28 +02:00
Joas Schilling 17454f6ce9
Use PSR logger interface in comments manager
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-10-07 08:57:45 +02:00
Christoph Wurst d9015a8c94
Format code to a single space around binary operators
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-10-05 20:25:24 +02:00
Morris Jobke 99c9423766
Remove @suppress SqlInjectionChecker
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-09-16 15:53:56 +02:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +02:00
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +02:00
Christoph Wurst 2fbad1ed72
Fix (array) indent style to always use one tab
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 10:16:08 +02:00
Joas Schilling 60d9384e5e
Optionally write the reference id into the database
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-03-31 10:51:16 +02:00
Joas Schilling a20e81f0f3
Allow to set and get the reference id
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-03-31 10:51:16 +02:00
Arthur Schiwon 4c7bd11fc8
for the DB ot pick an index specify the object_type
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2020-02-03 16:17:25 +01:00
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Roeland Jago Douma 68748d4f85
Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +01:00
Joas Schilling e4b36f4f47
Fix user with id 0 to be able to comment
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-09-25 09:07:07 +02:00
Joas Schilling 7d3a349d8f
PHPStorm code cleanup
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-07-24 10:39:57 +02:00
Joas Schilling 3b334169a8
Get the topmost parent for the parent instead of doing endless recursion
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-07-24 10:39:22 +02:00
Joas Schilling 77918356d6
Allow guest mentions of talk to be parsed
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-07-10 15:33:10 +02:00
Joas Schilling c15c2e440f
Allow apps to overwrite the maximum length when reading from database
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-07-01 15:48:26 +02:00
Joas Schilling d2c8a11c07
Allow apps to store longer messages in the comments API
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-06-26 10:14:24 +02:00
Roeland Jago Douma f394bf356e
Rewrite getNumberOfUnreadCommentsForFolder query
Before the joining and filtering removed unkown files. Resulting in
manual queries for all the files with no (unread) comments (the 99%).

Long story short. This will return a list of all the files in the parent
folder with their unread comment count (can be 0). But this makes sure
that the result is properly cached. In the dav handling.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-12-20 20:43:10 +01:00
Joas Schilling bb352fb667
Use the defined func()->count() instead of manual counting
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-11-08 15:44:45 +01:00
Joas Schilling 10ba0bed8a
Match mentions when the username is wrapped in quotes
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-11-07 12:33:44 +01:00
Morris Jobke b458ed9c82
Properly escape column name in "createFunction" call
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-10-16 15:24:02 +02:00
Joas Schilling 66945f9574
Allow to filter the unread count by verb
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-07-30 09:41:51 +02:00
Joas Schilling ac2314e3d0 Add pagination support
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-07-25 18:53:45 +02:00
Joas Schilling 8c7969e730 Allow to search by comments
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-07-25 18:53:44 +02:00
Mario Danic 47769d2640 New regex to match mentions
Signed-off-by: Mario Danic <mario@lovelyhq.com>
2018-06-08 10:21:19 +02:00
Mario Danic dc7beda308 Remove unsupported modifier
Signed-off-by: Mario Danic <mario@lovelyhq.com>
2018-06-08 00:59:31 +02:00
Mario Danic 6bf8fca574 Fix mentions regex
Signed-off-by: Mario Danic <mario@lovelyhq.com>
2018-06-08 00:35:51 +02:00
Joas Schilling 446efa4625
Only query last comment info, when there is one
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-04-23 11:50:30 +02:00
Joas Schilling 5157349b69
Fix docs
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-04-19 17:10:03 +02:00
Joas Schilling f50abde7ac
Add proper comment offset support
The offset is based on the last known comment instead of limit-offset,
so new comments don't mess up requests which get the history of an object-

Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-04-18 14:23:15 +02:00
Morris Jobke c1e4f9f305
Use type casting instead of *val() method
It should be up to 6x faster

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 11:35:42 +01:00
Arthur Schiwon 3784fa2074
comments should compile mentions also if done by author
it is used by clients for formatting reasons, there is no reason not format
the author if her handle is included in the comment body.
It is unrelated to sending out notifications.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-01-17 13:48:43 +01:00
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00
Joas Schilling 20f8d1094a
Can not insert auto increment on oracle
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-08-02 09:48:16 +02:00
Joas Schilling b29baababd
Oracle does not support PDO::FETCH_KEY_PAIR
Signed-off-by: Joas Schilling <coding@schilljs.com>
2017-08-02 09:48:12 +02:00
Lukas Reschke 3d2600b039
Add Phan plugin to check for SQL injections
This adds a phan plugin which checks for SQL injections on code using our QueryBuilder, while it isn't perfect it should already catch most potential issues.

As always, static analysis will sometimes have false positives and this is also here the case. So in some cases the analyzer just doesn't know if something is potential user input or not, thus I had to add some `@suppress SqlInjectionChecker` in front of those potential injections.

The Phan plugin hasn't the most awesome code but it works and I also added a file with test cases.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2017-07-20 22:48:13 +02:00