Skip to content

Fix comments (and systemtags) when involving users with numerical ids - #8355

Merged
MorrisJobke merged 4 commits into
masterfrom
fix-comments-num-index
Feb 26, 2018
Merged

Fix comments (and systemtags) when involving users with numerical ids#8355
MorrisJobke merged 4 commits into
masterfrom
fix-comments-num-index

Conversation

@blizzz

@blizzzblizzz commented Feb 14, 2018

Copy link
Copy Markdown
Member

similar cases to resolve in

  • app systemtags
  • Activity → FileHooks → own repo

and needs backporting.

Casting uids to strings everywhere is fragile, but that's how PHP deals with array keys. Relaxing setAffectedUser to accept ints would work, but is ugly. To accept IUser would be better, but would break compat.

cc @nickvergessen

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>

foreach ($users as $user => $path) {
$activity->setAffectedUser($user);
// numerical user ids end up as integers from array keys, but string

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that also means leading zeros will be a problem?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

keys with leading zeros are handled as strings, provided that they are passed as strings. #consistencyftw

@nickvergessen

Copy link
Copy Markdown
Member

Activity is fixed with that since ~1 year: https://github.com/nextcloud/activity/pull/102/files

@codecov

codecovBot commented Feb 14, 2018

Copy link
Copy Markdown

Codecov Report

Merging #8355 into master will increase coverage by 0.13%.
The diff coverage is 95.91%.

@@ Coverage Diff @@## master #8355 +/- ##
============================================
+ Coverage 51.69% 51.82% +0.13% - Complexity 25390 25392 +2 
============================================
Files 1599 1600 +1 Lines 95099 95195 +96 Branches 1376 1376 ============================================
+ Hits 49157 49339 +182 + Misses 45942 45856 -86
Impacted FilesCoverage ΔComplexity Δ
apps/comments/lib/Activity/Listener.php80.39% <100%> (+56.86%)10 <0> (ø)⬇️
apps/comments/tests/Unit/Activity/ListenerTest.php95.83% <95.83%> (ø)2 <2> (?)
core/js/js.js65.74% <0%> (-0.56%)0% <0%> (ø)
apps/files_trashbin/lib/Trashbin.php72.7% <0%> (+0.24%)136% <0%> (ø)⬇️
lib/private/Files/ObjectStore/Swift.php49.61% <0%> (+49.61%)45% <0%> (ø)⬇️

@blizzz

Copy link
Copy Markdown
MemberAuthor

Activity is fixed with that since ~1 year: https://github.com/nextcloud/activity/pull/102/files

@nickvergessen not completely, addNotificationsForUser isn't covered for instance.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz

Copy link
Copy Markdown
MemberAuthor

Activity and a fix for spreed go into respective repos. Failing test unrelated.

@blizzzblizzz added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Feb 15, 2018
@blizzzblizzz changed the title Fix comments num indexFix comments (and systemtags) when involving users with numerical idsFeb 15, 2018
@blizzz

Copy link
Copy Markdown
MemberAuthor

may i ask for a new round of reviews?

@MorrisJobke
MorrisJobke merged commit 612e875 into masterFeb 26, 2018
@MorrisJobke
MorrisJobke deleted the fix-comments-num-index branch February 26, 2018 16:13
blizzz added a commit that referenced this pull request Mar 1, 2018
test creating comments with numeric user ids
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
fix creating comments when file is accessible to users with numeric ids
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
tests for systemtags related to numeric user ids
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
fix systemtags event with numeric user ids
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
blizzz added a commit that referenced this pull request Mar 1, 2018
test creating comments with numeric user ids
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
fix creating comments when file is accessible to users with numeric ids
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
tests for systemtags related to numeric user ids
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
fix systemtags event with numeric user ids
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz

Copy link
Copy Markdown
MemberAuthor

Backports in #8615 and #8616

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@blizzz@nickvergessen@MorrisJobke