Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Refactor PhotoDetails component to facilitate adding other media types #180

Merged
merged 3 commits into from
Sep 3, 2021

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Sep 1, 2021

Fixes

Fixes #179 by @obulat

Description

This PR extracts common functionality mainly related to license and attribution from ImageDetail components to make them usable with other media types.

Technical details

Some functions related to license handling are extracted to utils/license.js. It would be nice to find a better home than utils in the future.
Some spacing and font sizes need to be fixed to match the designs.

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main or master).
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@obulat obulat requested a review from a team as a code owner September 1, 2021 14:05
@zackkrida
Copy link
Member

This is a great idea. Thanks for doing this!

Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

This is cool! Tested locally and it seems to work well 🚀

Comment on lines 27 to 32
export const checkIsLicense = (licenseOrMark) => {
const licenseOrMarkLower = licenseOrMark ? licenseOrMark.toLowerCase() : ''
return (
!licenseOrMarkLower.includes('pdm') && !licenseOrMarkLower.includes('cc0')
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this would be clearer if the function was isPublicDomainLicense or something like that?

Copy link
Member

Choose a reason for hiding this comment

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

Something like:

export const isLicense = (licenseOrMark = '') => {
  return !['pdm', 'cc0'].includes(licenseOrMark.toLowerCase())
} 
export const isPublicDomain = (licenseOrMark = '') => {
  return ['pdm', 'cc0'].includes(licenseOrMark.toLowerCase())
} 

might be a bit clearer? just one approach, i'm sure there's better.

Copy link
Contributor

Choose a reason for hiding this comment

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

isLicense is confusing to me, but maybe it's a domain knowledge issue. Isn't CC0 and PDM still a "license" even it's public domain?

Copy link
Member

Choose a reason for hiding this comment

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

Isn't CC0 and PDM still a "license" even it's public domain?

No actually! they are just "marks" or "designations", not licenses in the legal sense. CC even explains this quite poorly, admittedly. That's the purpose of this function, to determine if something is a license or a mark, so that front-end language can be changed.

Boring legal details: https://wiki.creativecommons.org/wiki/CC0_FAQ#What_is_CC0.3F

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh cool, that's good to know! Thanks for the explanation. In that case my comment doesn't really matter 🙂 Maybe we could add a link to that wiki page in the @see for the function to document for future contributors?

Copy link
Member

Choose a reason for hiding this comment

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

that's a great suggestion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great question @sarayourfriend , and thank you for explanations, @zackkrida !
The CC Website has the following wording for its mission: "Provide Creative Commons licenses and public domain tools ...".
I love the isPublicDomain function name, but would isPDTool be more correct in legal terms? I suppose that having a comment about difference between Licenses and Public Domain tools would be enough, though.

Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM!

@obulat obulat merged commit b1bfa36 into main Sep 3, 2021
@zackkrida zackkrida added the 🧰 goal: internal improvement Improvement that benefits maintainers, not users label Sep 8, 2021
@obulat obulat deleted the refactor_media_info branch November 26, 2021 07:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🧰 goal: internal improvement Improvement that benefits maintainers, not users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Extract common media functionality from image components
3 participants