1000
function make_action_link_function (
1001
node, sprite_class, method_name, handler, parameters, client) {
1002
// Performs the heavy lifting for make_action_link.
1005
function (maybe_sub) {
1006
node.replaceClass('spinner', sprite_class);
1007
var info = LP.cache.bug_subscription_info;
1008
var old = info.direct.personal[0];
1009
if (Y.Lang.isValue(maybe_sub)) {
1010
// Set the subscription in info and in cache.
1011
var sub = maybe_sub.getAttrs();
1012
if (Y.Lang.isValue(old)) {
1013
info.direct.personal[0].subscription = sub;
1015
// We don't have enough information to calculate
1016
// everything on the fly. Luckily, we don't need
1017
// most of it, and we think it is alright to not
1018
// include the extra information about
1019
// principal_is_reporter, security_contact_pillars,
1020
// and bug_supervisor_pillars.
1021
info.direct.personal.push(
1025
principal_is_reporter: false,
1026
security_contact_pillars: [],
1027
bug_supervisor_pillars: []
1029
info.direct.count += 1;
1033
if (Y.Lang.isValue(old)) {
1034
info.direct.personal.pop();
1035
info.direct.count -= 1;
1039
if (method_name === 'mute') {
1041
} else if (method_name === 'unmute') {
1044
reveal_direct_description_actions(
1045
Y.one('#direct-subscription'),
1046
get_direct_subscription_information(info));
1048
failure: handler.getFailureHandler()},
1049
parameters: parameters
1051
node.replaceClass(sprite_class, 'spinner');
1052
client.named_post(LP.cache.context.bug_link, method_name, config);
1056
1001
* Makes links for all kinds of actions.
1088
var method_call = function() {
1089
make_action_link_function(
1090
node, sprite_class, method_name, handler, parameters,
1035
function (maybe_sub) {
1036
node.replaceClass('spinner', sprite_class);
1037
var info = LP.cache.bug_subscription_info;
1038
var old = info.direct.personal[0];
1039
if (Y.Lang.isValue(maybe_sub)) {
1040
// Set the subscription in info and in cache.
1041
var sub = maybe_sub.getAttrs();
1042
if (Y.Lang.isValue(old)) {
1043
info.direct.personal[0].subscription =
1046
// We don't have enough information to
1047
// calculate everything on the fly.
1048
// Luckily, we don't need most of it,
1049
// and we think it is alright to not
1050
// include the extra information about
1051
// principal_is_reporter,
1052
// security_contact_pillars, and
1053
// bug_supervisor_pillars.
1054
info.direct.personal.push(
1058
principal_is_reporter: false,
1059
security_contact_pillars: [],
1060
bug_supervisor_pillars: []
1062
info.direct.count += 1;
1066
if (Y.Lang.isValue(old)) {
1067
info.direct.personal.pop();
1068
info.direct.count -= 1;
1072
if (method_name === 'mute') {
1074
} else if (method_name === 'unmute') {
1077
reveal_direct_description_actions(
1078
Y.one('#direct-subscription'),
1079
get_direct_subscription_information(info));
1081
failure: handler.getFailureHandler()
1083
parameters: parameters
1093
// If this a private bug, and the user is unsubscribing
1094
// themselves, give them a warning.
1096
method_name === 'unsubscribe' &&
1097
Y.Lang.isBoolean(LP.cache.bug_is_private) &&
1098
LP.cache.bug_is_private) {
1100
'<p>You will not have access to this bug or any of ',
1101
'its pages if you unsubscribe. If you want to stop ',
1102
'emails, choose the "Mute bug mail" option.</p><p>Do ',
1103
'you really want to unsubscribe from this bug?</p>'
1105
var ns = Y.lp.app.confirmationoverlay;
1106
var co = new ns.ConfirmationOverlay({
1107
submit_fn: method_call,
1108
form_content: content,
1109
headerContent: 'Unsubscribe from this bug'
1085
node.replaceClass(sprite_class, 'spinner');
1087
LP.cache.context.bug_link,
1118
1094
namespace._make_action_link = make_action_link;