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

Fix systemtatgs get,create and update API #34604

Merged
merged 1 commit into from
Feb 25, 2019
Merged

Conversation

sharidas
Copy link
Contributor

@sharidas sharidas commented Feb 25, 2019

Fix systemtags get, create and update API.
Due to recent changes made to add static tags,
the API changes are not compatible with the
older version. Hence to make them work as
before, minor changes are made.

Signed-off-by: Sujith H [email protected]

Description

Because of recent changes made to add static tags, there were changes made to getTag, createTag and updateTag. As a result they were not compatible with the older versions of oC. For example: when any of these methods were called by the user without last argument userEditable, the results were not as expected. The user gets result which were incorrect. Hence this change would help to rectify this problem. The API's should not break.

Related Issue

Motivation and Context

Fix the API breakage that happened in the systemtags for getTag, createTag and updateTag methods.

How Has This Been Tested?

  • Tested with unit test.
  • Tested by adding small snippet code to create tag, get tag and update it and verify. Sample code :
\OC::$server->getSystemTagManager()->createTag('invisibleTag', false, false);
$tag = \OC::$server->getSystemTagManager()->getTag('invisibleTag', false, false);
\OC::$server->getSystemTagManager()->updateTag($tag->getId(), 'visibleTag', true, true);

And the output captured for the values in $tag:

name = invisibleTag
UserVisible = 0
UserAssignable = 0
UserEditable 0

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • Backport (if applicable set "backport-request" label and remove when the backport was done)

Fix systemtags get, create and update API.
Due to recent changes made to add static tags,
the API changes are not compatible with the
older version. Hence to make them work as
before, minor changes are made.

Signed-off-by: Sujith H <[email protected]>
@sharidas sharidas added this to the development milestone Feb 25, 2019
@sharidas sharidas self-assigned this Feb 25, 2019
@codecov
Copy link

codecov bot commented Feb 25, 2019

Codecov Report

Merging #34604 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #34604      +/-   ##
============================================
+ Coverage     65.22%   65.23%   +<.01%     
- Complexity    18434    18440       +6     
============================================
  Files          1203     1203              
  Lines         69816    69825       +9     
  Branches       1280     1280              
============================================
+ Hits          45540    45549       +9     
  Misses        23904    23904              
  Partials        372      372
Flag Coverage Δ Complexity Δ
#javascript 53.05% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 66.63% <100%> (ø) 18440 <15> (+6) ⬆️
Impacted Files Coverage Δ Complexity Δ
lib/private/SystemTag/SystemTagManager.php 96.25% <100%> (+0.14%) 55 <15> (+6) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1517b62...ef32686. Read the comment docs.

3 similar comments
@codecov
Copy link

codecov bot commented Feb 25, 2019

Codecov Report

Merging #34604 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #34604      +/-   ##
============================================
+ Coverage     65.22%   65.23%   +<.01%     
- Complexity    18434    18440       +6     
============================================
  Files          1203     1203              
  Lines         69816    69825       +9     
  Branches       1280     1280              
============================================
+ Hits          45540    45549       +9     
  Misses        23904    23904              
  Partials        372      372
Flag Coverage Δ Complexity Δ
#javascript 53.05% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 66.63% <100%> (ø) 18440 <15> (+6) ⬆️
Impacted Files Coverage Δ Complexity Δ
lib/private/SystemTag/SystemTagManager.php 96.25% <100%> (+0.14%) 55 <15> (+6) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1517b62...ef32686. Read the comment docs.

@codecov
Copy link

codecov bot commented Feb 25, 2019

Codecov Report

Merging #34604 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #34604      +/-   ##
============================================
+ Coverage     65.22%   65.23%   +<.01%     
- Complexity    18434    18440       +6     
============================================
  Files          1203     1203              
  Lines         69816    69825       +9     
  Branches       1280     1280              
============================================
+ Hits          45540    45549       +9     
  Misses        23904    23904              
  Partials        372      372
Flag Coverage Δ Complexity Δ
#javascript 53.05% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 66.63% <100%> (ø) 18440 <15> (+6) ⬆️
Impacted Files Coverage Δ Complexity Δ
lib/private/SystemTag/SystemTagManager.php 96.25% <100%> (+0.14%) 55 <15> (+6) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1517b62...ef32686. Read the comment docs.

@codecov
Copy link

codecov bot commented Feb 25, 2019

Codecov Report

Merging #34604 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #34604      +/-   ##
============================================
+ Coverage     65.22%   65.23%   +<.01%     
- Complexity    18434    18440       +6     
============================================
  Files          1203     1203              
  Lines         69816    69825       +9     
  Branches       1280     1280              
============================================
+ Hits          45540    45549       +9     
  Misses        23904    23904              
  Partials        372      372
Flag Coverage Δ Complexity Δ
#javascript 53.05% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 66.63% <100%> (ø) 18440 <15> (+6) ⬆️
Impacted Files Coverage Δ Complexity Δ
lib/private/SystemTag/SystemTagManager.php 96.25% <100%> (+0.14%) 55 <15> (+6) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1517b62...ef32686. Read the comment docs.

@sharidas sharidas changed the title [WIP] Fix systemtatgs get,create and update API Fix systemtatgs get,create and update API Feb 25, 2019
Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍 fine for now

if ($userEditable === null) {
$userEditable = 1;
} elseif (\is_bool($userEditable)) {
$userEditable = (int)$userEditable;
Copy link
Contributor

Choose a reason for hiding this comment

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

it's a bit weird to check whether it's a boolean and then convert it to an int.

I also still wonder why we used ints below instead of boolean

@PVince81 PVince81 merged commit 80aaf87 into master Feb 25, 2019
@PVince81 PVince81 deleted the systemtag-api-fix branch February 25, 2019 13:37
@PVince81
Copy link
Contributor

@sharidas please backport

@sharidas
Copy link
Contributor Author

Backport PR: #34610

@lock lock bot locked as resolved and limited conversation to collaborators Feb 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The SystemTagManager API should behave as it was before for methods like createTag, getTag
2 participants