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

Kept historical resource naming after renaming in activity for shares… #10266

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

2403905
Copy link
Contributor

@2403905 2403905 commented Oct 8, 2024

… and public links.

Description

Related Issue

  • Fixes <issue_link>

Motivation and Context

How Has This Been Tested?

  • test environment:
  • test case 1:
  • test case 2:
  • ...

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • 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:

@2403905
Copy link
Contributor Author

2403905 commented Oct 9, 2024

@SagarGi Could you have a look tests error output https://drone.owncloud.com/owncloud/ocis/39752/38/6
There are similar errors related to ... emplate.properties.message mismatch but in the output i see different Received

@2403905
Copy link
Contributor Author

2403905 commented Oct 9, 2024

There are many misleading errors like below that were produced after the code changes because the json schema in a test case contains the redundant required elements.

The pattern "{user} updated {field} for a link {token} on {resource}" expects 4 requered fields, but the jcon schema expects 5 "required": ["field","folder","resource","token","user"]

And the test produce misled error....

ERROR IN A CI
      2. properties.value.items.2.oneOf.1.properties.template.properties.message:
         - Const failed
           Expected: {user} shared {resource} via link
           Received: {user} updated {field} for a link {token} on {resource}
                        "message": {
                          "const": "{user} updated {field} for a link {token} on {resource}"
                        },
                        "variables": {
                          "type": "object",
                          "required": ["field","folder","resource","token","user"],

FYI @SagarGi @individual-it

@2403905 2403905 force-pushed the issue-10210 branch 3 times, most recently from 9c4566e to f57f7d1 Compare October 10, 2024 08:37
@PrajwolAmatya PrajwolAmatya self-assigned this Oct 14, 2024
@PrajwolAmatya PrajwolAmatya removed their assignment Oct 15, 2024
Comment on lines 164 to 165
WithResource(toRef(ev.ItemID), false),
WithVar("resource", storagespace.FormatResourceID(ev.ItemID), ev.ResourceName),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't WithVar not just overwrite WithResource? Maybe we should adjust WithResource to expect the resource name?

Copy link
Contributor Author

@2403905 2403905 Oct 18, 2024

Choose a reason for hiding this comment

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

Do you mean like this?

// WithResource sets the resource variable for an activity
func WithResource(ref *provider.Reference, addSpace bool, explicitResourceName string) ActivityOption {
	return func(ctx context.Context, gwc gateway.GatewayAPIClient, vars map[string]interface{}) error {
		info, err := utils.GetResource(ctx, ref, gwc)
		if err != nil {
			if explicitResourceName == "" {
				explicitResourceName = filepath.Base(ref.GetPath())
			}
			vars["resource"] = Resource{
				Name: explicitResourceName,
			}
			n := getFolderName(ctx, gwc, ref)
			vars["folder"] = Resource{
				Name: n,
			}
			return err
		}

		if explicitResourceName == "" {
			explicitResourceName = info.GetName()
		}
		vars["resource"] = Resource{
			ID:   storagespace.FormatResourceID(info.GetId()),
			Name: explicitResourceName,
		}

		if addSpace {
			vars["space"] = Resource{
				ID:   info.GetSpace().GetId().GetOpaqueId(),
				Name: info.GetSpace().GetName(),
			}
		}

		parent, err := utils.GetResourceByID(ctx, info.GetParentId(), gwc)
		if err != nil {
			return err
		}
		vars["folder"] = Resource{
			ID:   info.GetParentId().GetOpaqueId(),
			Name: parent.GetName(),
		}

		return nil
	}
}

@2403905 2403905 force-pushed the issue-10210 branch 2 times, most recently from 9c04e61 to e628bea Compare October 18, 2024 09:04
@2403905 2403905 marked this pull request as ready for review October 18, 2024 09:07
@2403905 2403905 requested a review from kobergj October 18, 2024 09:08
Copy link

@2403905 2403905 enabled auto-merge October 18, 2024 09:31
@2403905 2403905 merged commit 6517a33 into owncloud:master Oct 18, 2024
4 checks passed
ownclouders pushed a commit that referenced this pull request Oct 18, 2024
Kept historical resource naming after renaming in activity for shares…
@micbar micbar mentioned this pull request Oct 21, 2024
18 tasks
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.

3 participants