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

integrations: Assign default logo to integrations #23712

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nagyem
Copy link
Collaborator

@nagyem nagyem commented Nov 30, 2022

If an integration does not have a logo, then a generic bot logo will be assigned. This allows the use of logos in documentation. Automated tests verify the creation of a generic logo when one is not given. My initial implementation made a copy of static/images/integrations/logos/generic.png to static/images/integrations/logos/{name}.png. I decided to instead just set self.logo_path=static/images/integrations/logos/generic.png without making a copy because the django staticfiles manifest was not updated when the file got created, causing a ValueError on line 130 in integrations.py return staticfiles_storage.url(self.logo_path)

The UI for the attribution is not particularly nice to look at. I think there needs to be more padding between the text and the image. Thoughts?

Fixes: #22582

Screenshots and screen captures:
Attribution:
Screen Shot 2023-01-05 at 3 00 28 PM

Default logo used for "Generic Bot" in documentation:
Screen Shot 2022-12-03 at 2 58 17 PM

Self-review checklist

  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

@alya
Copy link
Contributor

alya commented Dec 1, 2022

@nagyem Thanks for the PR! Please add a screenshot of an integration using the logo to the PR description, fix the failing tests, and post a comment when the PR is ready for review.

@nagyem
Copy link
Collaborator Author

nagyem commented Dec 4, 2022

Ready for review!

@@ -23,6 +23,11 @@ <h1>Website attributions</h1>
<img alt="" src="/static/images/landing-page/companies/software-engineer.svg" />
<p>"<a href="https://iconscout.com/illustration/software-engineer-2043023">Software engineer Illustration</a>" By <a href="https://iconscout.com/contributors/delesign/illustrations">Delesign Graphic</a> is licensed under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.</p>
</li>
<li>
<b>Default Integration Logo</b>
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use sentence case here, as we generally do at Zulip, and match the formatting above of the other attribution label. I.e.:

Default integration logo:

<b>Default Integration Logo</b>
<img alt="" src="/static/images/integrations/logos/generic.png" />
<p>"<a href="https://www.flaticon.com/free-icons/technology">Technology icons"</a> created by Freepik - Flaticon.</p>
</li>
Copy link
Contributor

Choose a reason for hiding this comment

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

Something seems off with quotation marks here.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, @nagyem can you add a commit at the top of this PR correcting the quotation marks used here. We should be using <p>"<a href='https://iconscout.com/illustration/software-engineer-2043023'>Software engineer Illustration</a>"

@alya
Copy link
Contributor

alya commented Dec 7, 2022

Thanks! I left a couple of small comments. @amanagr , perhaps you could take a look as well?

I have not pulled down the PR for manual testing.

@nagyem
Copy link
Collaborator Author

nagyem commented Dec 9, 2022

@alya Reviewed your comments and made updates to the text to match the format of the other attribution.

Could you help me understand the build fail? I'm not familiar with Puppet.

@alya
Copy link
Contributor

alya commented Dec 9, 2022

Could you help me understand the build fail? I'm not familiar with Puppet.

Please post a question in the #development help stream in the Zulip development community. Be sure to follow https://zulip.readthedocs.io/en/latest/contributing/asking-great-questions.html. Thanks!

@amanagr
Copy link
Member

amanagr commented Dec 12, 2022

@nagyem can you provide steps for testing this locally?

@nagyem
Copy link
Collaborator Author

nagyem commented Dec 12, 2022

@amanagr

To run the backend tests:
Run ./tools/test-backend zerver/tests/test_integrations.py in the Zulip dev environment.

To manually test the default logo:
Add WebhookIntegration("alertmanager", ["misc"], display_name="New Integration"), to the WEBHOOK_INTEGRATIONS variable on line 326 in zerver/lib/integrations.py

(I used the name "alertmanager" because using a random name would cause an import error. "alertmanager" has a logo defined, but the logo path does not follow the default path generated/bots/{name}/logo.png, so without defining a logo, the generic bot will be used.)

Navigate to http://localhost:9991/integrations/ to see the generic logo being used.

Copy link
Member

@amanagr amanagr left a comment

Choose a reason for hiding this comment

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

@nagyem thanks for the help with testing. LGTM other than the comment I made above. I would have liked for us to use svg format for the generic logo but I would leave it for TIm to comment on.

<b>Default Integration Logo</b>
<img alt="" src="/static/images/integrations/logos/generic.png" />
<p>"<a href="https://www.flaticon.com/free-icons/technology">Technology icons"</a> created by Freepik - Flaticon.</p>
</li>
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, @nagyem can you add a commit at the top of this PR correcting the quotation marks used here. We should be using <p>"<a href='https://iconscout.com/illustration/software-engineer-2043023'>Software engineer Illustration</a>"

@zulipbot zulipbot added size: L and removed size: M labels Dec 15, 2022
@alya
Copy link
Contributor

alya commented Dec 30, 2022

@nagyem Will you have a chance to address @amanagr 's feedback, or should someone else take over finishing the PR? Thanks!

@nagyem
Copy link
Collaborator Author

nagyem commented Jan 2, 2023

@alya I addressed @amanagr ’s comments in my last commit

@alya
Copy link
Contributor

alya commented Jan 2, 2023

@alya I addressed @amanagr ’s comments in my last commit

Got it. For future reference, you need to post a comment when doing so, as otherwise reviewers don't know that it's time to take another look at the PR.

@amanagr
Copy link
Member

amanagr commented Jan 5, 2023

@nagyem LGTM, can you move the last commit to be the first and improve its commit message based on https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html#commit-messages. Thanks!

@nagyem
Copy link
Collaborator Author

nagyem commented Jan 5, 2023

@amanagr @alya Done! Let me know if there's anything else I need to do.

@alya
Copy link
Contributor

alya commented Jan 5, 2023

For some reason the logo shows up twice on the /attribution page.

Let's also add a line break after Default integration logo:, so that the logo isn't squashed up against the heading.

@alya
Copy link
Contributor

alya commented Jan 5, 2023

The integrations page looks good to me in manual testing!

If an integration does not have a logo, then a generic
bot logo will be assigned. This allows the use of logos
in documentation. Automated tests verifythe creation of
a generic logo when one is not given.
@nagyem
Copy link
Collaborator Author

nagyem commented Jan 5, 2023

@alya I pushed the change and rebased to keep the commit history clean. I added two breaks because one was not sufficient.

@alya
Copy link
Contributor

alya commented Jan 5, 2023

Thanks! Please update the /attributions screenshot in the PR description with the latest version.

@nagyem
Copy link
Collaborator Author

nagyem commented Jan 5, 2023

@alya Done!

@alya
Copy link
Contributor

alya commented Jan 5, 2023

@timabbott This PR has been reviewed by @amanagr and me -- please take a look!

@alya alya added the integration review Added by maintainers when a PR may be ready for integration. label Jan 5, 2023
@zulipbot
Copy link
Member

Heads up @nagyem, we just merged some commits that conflict with the changes you made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/main branch and resolve your pull request's merge conflicts accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has conflicts integration review Added by maintainers when a PR may be ready for integration. size: L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

integrations: Ensure that logo_url is available for all integrations.
4 participants