apprise icon indicating copy to clipboard operation
apprise copied to clipboard

[MINOR] Remove title_body

Open KentonParton opened this issue 3 years ago • 4 comments

Description: Related issue (if applicable): # #654

Checklist

  • [x] The code change is tested and works locally.
  • [x] There is no commented out code in this PR.
  • [x] No lint errors (use flake8)
  • [x] 100% test coverage

Testing

Anyone can help test this source code as follows:

# Create a virtual environment to work in as follows:
python3 -m venv apprise

# Change into our new directory
cd apprise

# Activate our virtual environment
source bin/activate

# Install the branch
pip install git+https://github.com/caronc/apprise.git@<this.branch-name>

# Test out the changes with the following command:
apprise -t "Test Title" -b "Test Message" \
  <apprise url related to ticket>

KentonParton avatar Aug 28 '22 15:08 KentonParton

Codecov Report

Merging #655 (f809be2) into master (782f2e6) will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##            master      #655   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          113       113           
  Lines        14479     14478    -1     
  Branches      2743      2743           
=========================================
- Hits         14479     14478    -1     
Impacted Files Coverage Δ
apprise/plugins/NotifyOpsgenie.py 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Aug 28 '22 15:08 codecov-commenter

This doesn't really work because the title is not a mandatory field where the body is.

If anything i could see you fixing body and not title as per your patch.

But more importantly, maybe we need a ?title=no parameter in the URL so that your expected behaviour is only applied when required?

caronc avatar Sep 01 '22 00:09 caronc

Ahh, didn't realise that title wasn't required. What do you think about the latest commit?

Originally, if the length of title + body exceeded the OpsGenie title character limit, the title you had set would be removed entirely. With the latest update, if title is not set, body will be used but if title is used, it will be used and not body.

KentonParton avatar Sep 05 '22 19:09 KentonParton

@caronc what do you think about the comment and changes above? Thanks!

KentonParton avatar Sep 11 '22 18:09 KentonParton

@caronc sorry to keep mentioning you but what do you think about the comment and changes above? Thanks!

KentonParton avatar Sep 27 '22 20:09 KentonParton

Sorry to take so long to get back to you. I did have a look at it.

I think the problem is the message length. Do you know the maximum allowable characters we can have in an opsgenie message (in total)?

caronc avatar Sep 27 '22 21:09 caronc

The message aka title has a max length of 130 characters. The description has a max length of 15,000 characters. https://docs.opsgenie.com/docs/alert-api#create-alert.

Originally, if the length of title + body exceeded the 130 character title limit, the title you had set would be removed entirely. With the latest update, if title is not set, body will be used but if title is set, title will be used and not body. If title exceeds 130 characters, it will continue to be truncated like before.

KentonParton avatar Sep 27 '22 22:09 KentonParton

Okay, you win :wink: ... ~~Merged~~.

What i'll do is turn it into a switch instead; let me update your code.

caronc avatar Sep 27 '22 22:09 caronc

Hahaha, as long as you are happy with it too! :)

KentonParton avatar Sep 27 '22 22:09 KentonParton

I didn't realize there was a description field as well that also got the body contents. Your patch makes more sense now that i had a closer look.

Originally i thought we were just loosing the body completely at the times the title wasn't specified. But that's not the case (you said this in your last message too).

It's all good. Sorry that it took so long for me to clue in.

Thank you very much for the PR :rocket:

caronc avatar Sep 27 '22 22:09 caronc