mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
Remove library/user notification toggles
* Filter out notifications using custom conditions
This commit is contained in:
parent
1bfcd34247
commit
64c9247dd1
5 changed files with 18 additions and 69 deletions
|
@ -47,24 +47,12 @@ DOCUMENTATION :: END
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block">Change the library's picture in Tautulli. To reset to default, leave this field empty and save.</p>
|
<p class="help-block">Change the library's picture in Tautulli. To reset to default, leave this field empty and save.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" id="do_notify" name="do_notify" value="1" ${helpers.checked(data['do_notify'])}> Enable notifications
|
|
||||||
</label>
|
|
||||||
<p class="help-block">Uncheck this if you do not want to receive notifications for this library's activity.</p>
|
|
||||||
</div>
|
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="keep_history" name="keep_history" value="1" ${helpers.checked(data['keep_history'])}> Keep history
|
<input type="checkbox" id="keep_history" name="keep_history" value="1" ${helpers.checked(data['keep_history'])}> Keep history
|
||||||
</label>
|
</label>
|
||||||
<p class="help-block">Uncheck this if you do not want to keep any history on this library's activity.</p>
|
<p class="help-block">Uncheck this if you do not want to keep any history on this library's activity.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" id="do_notify_created" name="do_notify_created" value="1" ${helpers.checked(data['do_notify_created'])}> Enable recently added notifications
|
|
||||||
</label>
|
|
||||||
<p class="help-block">Uncheck this if you do not want to receive recently added notifications for this library.</p>
|
|
||||||
</div>
|
|
||||||
% if data['section_id']:
|
% if data['section_id']:
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button class="btn btn-danger" id="delete-all-history">Purge</button>
|
<button class="btn btn-danger" id="delete-all-history">Purge</button>
|
||||||
|
@ -85,15 +73,7 @@ DOCUMENTATION :: END
|
||||||
// Save library options
|
// Save library options
|
||||||
$("#save_library").on('click', function () {
|
$("#save_library").on('click', function () {
|
||||||
var custom_thumb = $("#custom_thumb_url").val();
|
var custom_thumb = $("#custom_thumb_url").val();
|
||||||
var do_notify = 0;
|
|
||||||
var do_notify_created = 0;
|
|
||||||
var keep_history = 0;
|
var keep_history = 0;
|
||||||
if ($("#do_notify").is(":checked")) {
|
|
||||||
do_notify = 1;
|
|
||||||
}
|
|
||||||
if ($("#do_notify_created").is(":checked")) {
|
|
||||||
do_notify_created = 1;
|
|
||||||
}
|
|
||||||
if ($("#keep_history").is(":checked")) {
|
if ($("#keep_history").is(":checked")) {
|
||||||
keep_history = 1;
|
keep_history = 1;
|
||||||
}
|
}
|
||||||
|
@ -103,8 +83,6 @@ DOCUMENTATION :: END
|
||||||
data: {
|
data: {
|
||||||
section_id: '${data["section_id"]}',
|
section_id: '${data["section_id"]}',
|
||||||
custom_thumb: custom_thumb,
|
custom_thumb: custom_thumb,
|
||||||
do_notify: do_notify,
|
|
||||||
do_notify_created: do_notify_created,
|
|
||||||
keep_history: keep_history
|
keep_history: keep_history
|
||||||
},
|
},
|
||||||
cache: false,
|
cache: false,
|
||||||
|
|
|
@ -56,12 +56,6 @@ DOCUMENTATION :: END
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block">Change the users profile picture in Tautulli. To reset to default, leave this field empty and save.</p>
|
<p class="help-block">Change the users profile picture in Tautulli. To reset to default, leave this field empty and save.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" id="do_notify" name="do_notify" value="1" ${helpers.checked(data['do_notify'])}> Enable notifications
|
|
||||||
</label>
|
|
||||||
<p class="help-block">Uncheck this if you do not want to receive notifications for this user's activity.</p>
|
|
||||||
</div>
|
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="keep_history" name="keep_history" value="1" ${helpers.checked(data['keep_history'])}> Keep history
|
<input type="checkbox" id="keep_history" name="keep_history" value="1" ${helpers.checked(data['keep_history'])}> Keep history
|
||||||
|
@ -95,12 +89,8 @@ DOCUMENTATION :: END
|
||||||
$("#save_user").on('click', function () {
|
$("#save_user").on('click', function () {
|
||||||
var friendly_name = $("input#friendly_name").val();
|
var friendly_name = $("input#friendly_name").val();
|
||||||
var custom_thumb = $("#custom_avatar_url").val();
|
var custom_thumb = $("#custom_avatar_url").val();
|
||||||
var do_notify = 0;
|
|
||||||
var keep_history = 0;
|
var keep_history = 0;
|
||||||
var allow_guest = 0;
|
var allow_guest = 0;
|
||||||
if ($("#do_notify").is(":checked")) {
|
|
||||||
do_notify = 1;
|
|
||||||
}
|
|
||||||
if ($("#keep_history").is(":checked")) {
|
if ($("#keep_history").is(":checked")) {
|
||||||
keep_history = 1;
|
keep_history = 1;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +104,6 @@ DOCUMENTATION :: END
|
||||||
user_id: '${data["user_id"]}',
|
user_id: '${data["user_id"]}',
|
||||||
friendly_name: friendly_name,
|
friendly_name: friendly_name,
|
||||||
custom_thumb: custom_thumb,
|
custom_thumb: custom_thumb,
|
||||||
do_notify: do_notify,
|
|
||||||
keep_history: keep_history,
|
keep_history: keep_history,
|
||||||
allow_guest: allow_guest
|
allow_guest: allow_guest
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,9 +28,7 @@ libraries_list_table_options = {
|
||||||
$(td).html('<div class="edit-library-toggles">' +
|
$(td).html('<div class="edit-library-toggles">' +
|
||||||
'<button class="btn btn-xs btn-warning delete-library" data-id="' + rowData['section_id'] + '" data-toggle="button"><i class="fa fa-trash-o fa-fw"></i> Delete</button> ' +
|
'<button class="btn btn-xs btn-warning delete-library" data-id="' + rowData['section_id'] + '" data-toggle="button"><i class="fa fa-trash-o fa-fw"></i> Delete</button> ' +
|
||||||
'<button class="btn btn-xs btn-warning purge-library" data-id="' + rowData['section_id'] + '" data-toggle="button"><i class="fa fa-eraser fa-fw"></i> Purge</button>   ' +
|
'<button class="btn btn-xs btn-warning purge-library" data-id="' + rowData['section_id'] + '" data-toggle="button"><i class="fa fa-eraser fa-fw"></i> Purge</button>   ' +
|
||||||
'<input type="checkbox" id="do_notify-' + rowData['section_id'] + '" name="do_notify" value="1" ' + rowData['do_notify'] + '><label class="edit-tooltip" for="do_notify-' + rowData['section_id'] + '" data-toggle="tooltip" title="Toggle Notifications"><i class="fa fa-bell fa-lg fa-fw"></i></label> ' +
|
|
||||||
'<input type="checkbox" id="keep_history-' + rowData['section_id'] + '" name="keep_history" value="1" ' + rowData['keep_history'] + '><label class="edit-tooltip" for="keep_history-' + rowData['section_id'] + '" data-toggle="tooltip" title="Toggle History"><i class="fa fa-history fa-lg fa-fw"></i></label> ' +
|
'<input type="checkbox" id="keep_history-' + rowData['section_id'] + '" name="keep_history" value="1" ' + rowData['keep_history'] + '><label class="edit-tooltip" for="keep_history-' + rowData['section_id'] + '" data-toggle="tooltip" title="Toggle History"><i class="fa fa-history fa-lg fa-fw"></i></label> ' +
|
||||||
'<input type="checkbox" id="do_notify_created-' + rowData['section_id'] + '" name="do_notify_created" value="1" ' + rowData['do_notify_created'] + '><label class="edit-tooltip" for="do_notify_created-' + rowData['section_id'] + '" data-toggle="tooltip" title="Toggle Recently Added"><i class="fa fa-download fa-lg fa-fw"></i></label> ' +
|
|
||||||
'</div>');
|
'</div>');
|
||||||
},
|
},
|
||||||
"width": "7%",
|
"width": "7%",
|
||||||
|
@ -258,15 +256,7 @@ $('#libraries_list_table').on('change', 'td.edit-control > .edit-library-toggles
|
||||||
var row = libraries_list_table.row(tr);
|
var row = libraries_list_table.row(tr);
|
||||||
var rowData = row.data();
|
var rowData = row.data();
|
||||||
|
|
||||||
var do_notify = 0;
|
|
||||||
var do_notify_created = 0;
|
|
||||||
var keep_history = 0;
|
var keep_history = 0;
|
||||||
if ($('#do_notify-' + rowData['section_id']).is(':checked')) {
|
|
||||||
do_notify = 1;
|
|
||||||
}
|
|
||||||
if ($('#do_notify_created-' + rowData['section_id']).is(':checked')) {
|
|
||||||
do_notify_created = 1;
|
|
||||||
}
|
|
||||||
if ($('#keep_history-' + rowData['section_id']).is(':checked')) {
|
if ($('#keep_history-' + rowData['section_id']).is(':checked')) {
|
||||||
keep_history = 1;
|
keep_history = 1;
|
||||||
}
|
}
|
||||||
|
@ -280,8 +270,6 @@ $('#libraries_list_table').on('change', 'td.edit-control > .edit-library-toggles
|
||||||
url: 'edit_library',
|
url: 'edit_library',
|
||||||
data: {
|
data: {
|
||||||
section_id: rowData['section_id'],
|
section_id: rowData['section_id'],
|
||||||
do_notify: do_notify,
|
|
||||||
do_notify_created: do_notify_created,
|
|
||||||
keep_history: keep_history,
|
keep_history: keep_history,
|
||||||
custom_thumb: custom_thumb
|
custom_thumb: custom_thumb
|
||||||
},
|
},
|
||||||
|
|
|
@ -45,7 +45,6 @@ users_list_table_options = {
|
||||||
$(td).html('<div class="edit-user-toggles">' +
|
$(td).html('<div class="edit-user-toggles">' +
|
||||||
'<button class="btn btn-xs btn-warning delete-user" data-id="' + rowData['user_id'] + '" data-toggle="button"><i class="fa fa-trash-o fa-fw"></i> Delete</button> ' +
|
'<button class="btn btn-xs btn-warning delete-user" data-id="' + rowData['user_id'] + '" data-toggle="button"><i class="fa fa-trash-o fa-fw"></i> Delete</button> ' +
|
||||||
'<button class="btn btn-xs btn-warning purge-user" data-id="' + rowData['user_id'] + '" data-toggle="button"><i class="fa fa-eraser fa-fw"></i> Purge</button>   ' +
|
'<button class="btn btn-xs btn-warning purge-user" data-id="' + rowData['user_id'] + '" data-toggle="button"><i class="fa fa-eraser fa-fw"></i> Purge</button>   ' +
|
||||||
'<input type="checkbox" id="do_notify-' + rowData['user_id'] + '" name="do_notify" value="1" ' + rowData['do_notify'] + '><label class="edit-tooltip" for="do_notify-' + rowData['user_id'] + '" data-toggle="tooltip" title="Toggle Notifications"><i class="fa fa-bell fa-lg fa-fw"></i></label> ' +
|
|
||||||
'<input type="checkbox" id="keep_history-' + rowData['user_id'] + '" name="keep_history" value="1" ' + rowData['keep_history'] + '><label class="edit-tooltip" for="keep_history-' + rowData['user_id'] + '" data-toggle="tooltip" title="Toggle History"><i class="fa fa-history fa-lg fa-fw"></i></label> ' +
|
'<input type="checkbox" id="keep_history-' + rowData['user_id'] + '" name="keep_history" value="1" ' + rowData['keep_history'] + '><label class="edit-tooltip" for="keep_history-' + rowData['user_id'] + '" data-toggle="tooltip" title="Toggle History"><i class="fa fa-history fa-lg fa-fw"></i></label> ' +
|
||||||
'<input type="checkbox" id="allow_guest-' + rowData['user_id'] + '" name="allow_guest" value="1" ' + rowData['allow_guest'] + '><label class="edit-tooltip" for="allow_guest-' + rowData['user_id'] + '" data-toggle="tooltip" title="Toggle Guest Access"><i class="fa fa-unlock-alt fa-lg fa-fw"></i></label> ' +
|
'<input type="checkbox" id="allow_guest-' + rowData['user_id'] + '" name="allow_guest" value="1" ' + rowData['allow_guest'] + '><label class="edit-tooltip" for="allow_guest-' + rowData['user_id'] + '" data-toggle="tooltip" title="Toggle Guest Access"><i class="fa fa-unlock-alt fa-lg fa-fw"></i></label> ' +
|
||||||
'</div>');
|
'</div>');
|
||||||
|
@ -284,12 +283,8 @@ $('#users_list_table').on('change', 'td.edit-control > .edit-user-toggles > inpu
|
||||||
var row = users_list_table.row(tr);
|
var row = users_list_table.row(tr);
|
||||||
var rowData = row.data();
|
var rowData = row.data();
|
||||||
|
|
||||||
var do_notify = 0;
|
|
||||||
var keep_history = 0;
|
var keep_history = 0;
|
||||||
var allow_guest = 0;
|
var allow_guest = 0;
|
||||||
if ($('#do_notify-' + rowData['user_id']).is(':checked')) {
|
|
||||||
do_notify = 1;
|
|
||||||
}
|
|
||||||
if ($('#keep_history-' + rowData['user_id']).is(':checked')) {
|
if ($('#keep_history-' + rowData['user_id']).is(':checked')) {
|
||||||
keep_history = 1;
|
keep_history = 1;
|
||||||
}
|
}
|
||||||
|
@ -304,7 +299,6 @@ $('#users_list_table').on('change', 'td.edit-control > .edit-user-toggles > inpu
|
||||||
data: {
|
data: {
|
||||||
user_id: rowData['user_id'],
|
user_id: rowData['user_id'],
|
||||||
friendly_name: friendly_name,
|
friendly_name: friendly_name,
|
||||||
do_notify: do_notify,
|
|
||||||
keep_history: keep_history,
|
keep_history: keep_history,
|
||||||
allow_guest: allow_guest,
|
allow_guest: allow_guest,
|
||||||
thumb: rowData['user_thumb']
|
thumb: rowData['user_thumb']
|
||||||
|
|
|
@ -131,19 +131,19 @@ def notify_conditions(notify_action=None, stream_data=None, timeline_data=None):
|
||||||
if stream_data:
|
if stream_data:
|
||||||
|
|
||||||
# Check if notifications enabled for user and library
|
# Check if notifications enabled for user and library
|
||||||
user_data = users.Users()
|
# user_data = users.Users()
|
||||||
user_details = user_data.get_details(user_id=stream_data['user_id'])
|
# user_details = user_data.get_details(user_id=stream_data['user_id'])
|
||||||
|
#
|
||||||
|
# library_data = libraries.Libraries()
|
||||||
|
# library_details = library_data.get_details(section_id=stream_data['section_id'])
|
||||||
|
|
||||||
library_data = libraries.Libraries()
|
# if not user_details['do_notify']:
|
||||||
library_details = library_data.get_details(section_id=stream_data['section_id'])
|
# logger.debug(u"Tautulli NotificationHandler :: Notifications for user '%s' are disabled." % user_details['username'])
|
||||||
|
# return False
|
||||||
if not user_details['do_notify']:
|
#
|
||||||
logger.debug(u"Tautulli NotificationHandler :: Notifications for user '%s' are disabled." % user_details['username'])
|
# elif not library_details['do_notify'] and notify_action not in ('on_concurrent', 'on_newdevice'):
|
||||||
return False
|
# logger.debug(u"Tautulli NotificationHandler :: Notifications for library '%s' are disabled." % library_details['section_name'])
|
||||||
|
# return False
|
||||||
elif not library_details['do_notify'] and notify_action not in ('on_concurrent', 'on_newdevice'):
|
|
||||||
logger.debug(u"Tautulli NotificationHandler :: Notifications for library '%s' are disabled." % library_details['section_name'])
|
|
||||||
return False
|
|
||||||
|
|
||||||
if notify_action == 'on_concurrent':
|
if notify_action == 'on_concurrent':
|
||||||
pms_connect = pmsconnect.PmsConnect()
|
pms_connect = pmsconnect.PmsConnect()
|
||||||
|
@ -188,12 +188,12 @@ def notify_conditions(notify_action=None, stream_data=None, timeline_data=None):
|
||||||
elif timeline_data:
|
elif timeline_data:
|
||||||
|
|
||||||
# Check if notifications enabled for library
|
# Check if notifications enabled for library
|
||||||
library_data = libraries.Libraries()
|
# library_data = libraries.Libraries()
|
||||||
library_details = library_data.get_details(section_id=timeline_data['section_id'])
|
# library_details = library_data.get_details(section_id=timeline_data['section_id'])
|
||||||
|
#
|
||||||
if not library_details['do_notify_created']:
|
# if not library_details['do_notify_created']:
|
||||||
# logger.debug(u"Tautulli NotificationHandler :: Notifications for library '%s' is disabled." % library_details['section_name'])
|
# # logger.debug(u"Tautulli NotificationHandler :: Notifications for library '%s' is disabled." % library_details['section_name'])
|
||||||
return False
|
# return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue