Skip to content

Commit

Permalink
Merge pull request #95 from codecov/revert-91-scott/comment-feedback-…
Browse files Browse the repository at this point in the history
…link

Revert "Move feedback link out of footer section and always include at the bottom of a comment
  • Loading branch information
scott-codecov committed Sep 8, 2023
2 parents 8a59e46 + 191e551 commit 69bdfd1
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 59 deletions.
22 changes: 0 additions & 22 deletions services/notification/notifiers/mixins/message/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ async def create_message(
section_writer,
)

await self._write_feedback_link(comparison, settings, write)

return [m for m in message if m is not None]

async def _possibly_write_gh_app_login_announcement(
Expand All @@ -174,26 +172,6 @@ async def _possibly_write_gh_app_login_announcement(
write(f":exclamation: {message_to_display}")
write("")

async def _write_feedback_link(
self, comparison: ComparisonProxy, settings: dict, write: Callable
):
hide_project_coverage = settings.get("hide_project_coverage", False)
if hide_project_coverage:
write(
":loudspeaker: Thoughts on this report? [Let us know!]({0}).".format(
"https://about.codecov.io/pull-request-comment-report/"
)
)
else:
repo_service = comparison.repository_service.service
write(
":loudspeaker: Have feedback on the report? [Share it here]({0}).".format(
"https://gitlab.com/codecov-open-source/codecov-user-feedback/-/issues/4"
if repo_service == "gitlab"
else "https://about.codecov.io/codecov-pr-comment-feedback/"
)
)

async def write_section_to_msg(
self, comparison, changes, diff, links, write, section_writer, behind_by=None
):
Expand Down
17 changes: 16 additions & 1 deletion services/notification/notifiers/mixins/message/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,28 @@ async def write_section(*args, **kwargs):
class NewFooterSectionWriter(BaseSectionWriter):
async def do_write_section(self, comparison, diff, changes, links, behind_by=None):
hide_project_coverage = self.settings.get("hide_project_coverage", False)
if not hide_project_coverage:
if hide_project_coverage:
yield ("")
yield (
":loudspeaker: Thoughts on this report? [Let us know!]({0}).".format(
"https://about.codecov.io/pull-request-comment-report/"
)
)
else:
repo_service = comparison.repository_service.service
yield ("")
yield (
"[:umbrella: View full report in Codecov by Sentry]({0}?src=pr&el=continue). ".format(
links["pull"]
)
)
yield (
":loudspeaker: Have feedback on the report? [Share it here]({0}).".format(
"https://about.codecov.io/codecov-pr-comment-feedback/"
if repo_service == "github"
else "https://gitlab.com/codecov-open-source/codecov-user-feedback/-/issues/4"
)
)


class NewHeaderSectionWriter(BaseSectionWriter):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ async def test_notify(self, sample_comparison, codecov_vcr, mock_configuration):
"> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`",
"> Powered by [Codecov](https://app.codecov.io/gh/joseph-sentry/codecov-demo/pull/9?src=pr&el=footer). Last update [5b174c2...5601846](https://app.codecov.io/gh/joseph-sentry/codecov-demo/pull/9?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).",
"",
f":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).",
]
for exp, res in zip(result.data_sent["message"], message):
assert exp == res
Expand Down Expand Up @@ -534,7 +533,6 @@ async def test_notify_gitlab(
"> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`",
"> Powered by [Codecov](https://app.codecov.io/gl/joseph-sentry/example-python/pull/1?src=pr&el=footer). Last update [0fc784a...0b6a213](https://app.codecov.io/gl/joseph-sentry/example-python/pull/1?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).",
"",
f":loudspeaker: Have feedback on the report? [Share it here](https://gitlab.com/codecov-open-source/codecov-user-feedback/-/issues/4).",
]
for exp, res in zip(result.data_sent["message"], message):
assert exp == res
Expand Down Expand Up @@ -602,8 +600,8 @@ async def test_notify_new_layout(
"</details>",
"",
"[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/joseph-sentry/codecov-demo/pull/9?src=pr&el=continue). ",
"",
":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).",
"",
]
for exp, res in zip(result.data_sent["message"], message):
assert exp == res
Expand Down Expand Up @@ -682,8 +680,8 @@ async def test_notify_with_components(
"</details>",
"",
"[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/joseph-sentry/codecov-demo/pull/9?src=pr&el=continue). ",
"",
":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).",
"",
]
for exp, res in zip(result.data_sent["message"], message):
assert exp == res
Expand Down
3 changes: 0 additions & 3 deletions services/notification/notifiers/tests/unit/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,6 @@ async def test_build_default_payload(
f"",
f"... and [1 file with indirect coverage changes](test.example.br/gh/test_build_default_payload/{repo.name}/pull/{sample_comparison.pull.pullid}/indirect-changes?src=pr&el=tree-more)",
f"",
":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).",
]
),
},
Expand Down Expand Up @@ -1559,7 +1558,6 @@ async def test_build_default_payload_with_flags(
f"",
f"... and [1 file with indirect coverage changes](test.example.br/gh/test_build_default_payload_with_flags/{repo.name}/pull/{sample_comparison.pull.pullid}/indirect-changes?src=pr&el=tree-more)",
f"",
":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).",
]
),
},
Expand Down Expand Up @@ -1610,7 +1608,6 @@ async def test_build_default_payload_with_flags_and_footer(
f"> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`",
f"> Powered by [Codecov](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=footer). Last update [{base_commit.commitid[:7]}...{head_commit.commitid[:7]}](test.example.br/gh/{test_name}/{repo.name}/pull/{sample_comparison.pull.pullid}?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).",
f"",
":loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/).",
]
),
},
Expand Down
Loading

0 comments on commit 69bdfd1

Please sign in to comment.