Skip to content

Commit

Permalink
Merge pull request #34 from ppfeufer/development
Browse files Browse the repository at this point in the history
"Don't Ping" option
  • Loading branch information
ppfeufer authored Nov 5, 2020
2 parents aa471de + e3b83be commit b6e75a3
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 37 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [2.4.1] - 2020-11-05

### Added

- "Don't Ping" option to ping targets


## [2.4.0] - 2020-10-26

### Added
Expand Down
2 changes: 1 addition & 1 deletion fleetpings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

default_app_config: str = "fleetpings.apps.AaFleetpingsConfig"

__version__ = "2.4.0"
__version__ = "2.4.1"
__title__ = "Fleet Pings"
Binary file modified fleetpings/locale/de/LC_MESSAGES/django.mo
Binary file not shown.
35 changes: 20 additions & 15 deletions fleetpings/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
# Translators:
# Peter Pfeufer <[email protected]>, 2020
#
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-25 01:09+0200\n"
"PO-Revision-Date: 2020-10-26 15:17+0100\n"
"POT-Creation-Date: 2020-11-05 22:51+0100\n"
"PO-Revision-Date: 2020-10-03 14:49+0000\n"
"Last-Translator: Peter Pfeufer <[email protected]>, 2020\n"
"Language-Team: German (https://www.transifex.com/ppfeufer/teams/113732/"
"de/)\n"
"Language-Team: German (https://www.transifex.com/ppfeufer/teams/113732/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.2.4\n"

#: fleetpings/models.py:42
msgid "Short name to identify this comms"
Expand Down Expand Up @@ -163,8 +162,9 @@ msgid ""
"URL of this webhook, e.g. https://discordapp.com/api/webhooks/123456/abcdef "
"or https://hooks.slack.com/services/xxxx/xxxx"
msgstr ""
"URL des Webhooks, zum Beispiel https://discordapp.com/api/webhooks/123456/"
"abcdef oder https://hooks.slack.com/services/xxxx/xxxx"
"URL des Webhooks, zum Beispiel "
"https://discordapp.com/api/webhooks/123456/abcdef oder "
"https://hooks.slack.com/services/xxxx/xxxx"

#: fleetpings/models.py:405
msgid ""
Expand Down Expand Up @@ -212,8 +212,8 @@ msgid ""
"If this checkbox is active, a fleet operations timer for this pre-ping will "
"be created."
msgstr ""
"Wenn diese Checkbox aktiv ist, wird automatisch ein Flotten Timer für "
"diesen Pre-Ping erstellt."
"Wenn diese Checkbox aktiv ist, wird automatisch ein Flotten Timer für diesen"
" Pre-Ping erstellt."

#: fleetpings/templates/fleetpings/form/fleetCommander.html:4
msgid "FC Name"
Expand Down Expand Up @@ -285,8 +285,9 @@ msgid ""
"If this checkbox is active, formup time will be set to &quot;NOW&quot; and "
"the time in the field above (if any is set) will be ignored."
msgstr ""
"Wenn diese Checkbox aktiv ist, wird die Startzeit der Flotte auf &quot;"
"JETZT&quot; gesetzt und sämtliche Angaben im obigen Feld werden ignoriert."
"Wenn diese Checkbox aktiv ist, wird die Startzeit der Flotte auf "
"&quot;JETZT&quot; gesetzt und sämtliche Angaben im obigen Feld werden "
"ignoriert."

#: fleetpings/templates/fleetpings/form/pingChannel.html:5
msgid "Ping Channel"
Expand All @@ -304,7 +305,11 @@ msgstr "Keinen, einfach nur formatieren"
msgid "Ping Target"
msgstr "Ping Ziel"

#: fleetpings/templates/fleetpings/form/pingTargets.html:17
#: fleetpings/templates/fleetpings/form/pingTargets.html:7
msgid "Don't Ping"
msgstr "Nicht pingen"

#: fleetpings/templates/fleetpings/form/pingTargets.html:19
msgid "Additionally configured ping targets"
msgstr "Zusätzlich konfigurierte Ping Ziele"

Expand Down
8 changes: 6 additions & 2 deletions fleetpings/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-25 01:09+0200\n"
"POT-Creation-Date: 2020-11-05 22:51+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -286,7 +286,11 @@ msgstr ""
msgid "Ping Target"
msgstr ""

#: fleetpings/templates/fleetpings/form/pingTargets.html:17
#: fleetpings/templates/fleetpings/form/pingTargets.html:7
msgid "Don't Ping"
msgstr ""

#: fleetpings/templates/fleetpings/form/pingTargets.html:19
msgid "Additionally configured ping targets"
msgstr ""

Expand Down
48 changes: 30 additions & 18 deletions fleetpings/static/fleetpings/js/fleetpings.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,24 +213,28 @@ jQuery(document).ready(function($) {
var webhookPingTextFooter = '';
var pingText = '';

// determine pingTargetText
// determine pingTarget and pingTargetText
var discordPingTarget = '';
if(pingTargetText.indexOf('@') > -1) {
discordPingTarget = pingTargetText;
} else {
discordPingTarget = '@' + pingTargetText;
}

// determine pingTarget
var webhookPingTarget = '';
if(pingTarget.indexOf('@') > -1) {
webhookPingTarget = pingTarget;
} else {
webhookPingTarget = '<@&' + pingTarget + '>';
}

// separator
pingText += ' :: ';
if(pingTarget !== '') {
// pingTarget
if (pingTarget.indexOf('@') > -1) {
webhookPingTarget = pingTarget;
} else {
webhookPingTarget = '<@&' + pingTarget + '>';
}

// pingTargetText
if(pingTargetText.indexOf('@') > -1) {
discordPingTarget = pingTargetText;
} else {
discordPingTarget = '@' + pingTargetText;
}

// separator
pingText += ' :: ';
}

// fleet announcement
pingText += '**';
Expand Down Expand Up @@ -374,9 +378,13 @@ jQuery(document).ready(function($) {
// send the ping to Discord
if(webhookType === 'Discord') {
if(undefined !== webhookEmbedPing && webhookEmbedPing === 'True') {
if(pingTarget !== '') {
webhookPingTarget += ' :: ';
}

sendEmbeddedDiscordPing(
webhookUrl,
webhookPingTarget + ' :: **' + webhookPingTextHeader + '**' + '\n' + '** **',
webhookPingTarget + '**' + webhookPingTextHeader + '**' + '\n' + '** **',
// embedded content » https://discohook.org/ - https://leovoel.github.io/embed-visualizer/
{
'title': '**.: Fleet Details :.**',
Expand All @@ -394,7 +402,11 @@ jQuery(document).ready(function($) {

// send the ping to Discord
if(webhookType === 'Slack') {
var slackEmbedPingTarget = webhookPingTarget.replace('@', '!');
var slackEmbedPingTarget = '';

if(pingTarget !== '') {
slackEmbedPingTarget = '<' + webhookPingTarget.replace('@', '!') + '> :: ';
}

/**
* payload to send to Slack
Expand All @@ -406,7 +418,7 @@ jQuery(document).ready(function($) {
{
'fallback': pingText,
'color': embedColor,
'pretext': '<' + slackEmbedPingTarget + '>' + ' :: *' + webhookPingTextHeader + '*',
'pretext': slackEmbedPingTarget + '*' + webhookPingTextHeader + '*',
'text': '*.: Fleet Details :.*' + '\n' + webhookPingTextContent.split('**').join('*'),
'footer': webhookPingTextFooter,
// 'footer_icon': 'https://platform.slack-edge.com/img/default_application_icon.png'
Expand Down
2 changes: 1 addition & 1 deletion fleetpings/static/fleetpings/js/fleetpings.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions fleetpings/templates/fleetpings/form/pingTargets.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<label class="col-md-3 control-label" for="pingTarget">{% trans "Ping Target" %}</label>
<div class="col-md-9">
<select id="pingTarget" name="pingTarget" class="form-control">
<option value="">{% trans "Don't Ping" %}</option>

{% if platformUsed == 'Slack' %}
<option value="@here">@here</option>
<option value="@channel">@channel</option>
Expand Down

0 comments on commit b6e75a3

Please sign in to comment.