Skip to content

Commit

Permalink
updated to warn upon saving of questionable skid for admins
Browse files Browse the repository at this point in the history
  • Loading branch information
tvroom committed Jan 30, 2007
1 parent e8ca6b8 commit d7c263d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
27 changes: 23 additions & 4 deletions plugins/Admin/admin.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,7 @@ sub editStory {
# that determination. Now that we have $newarticle, should
# we be using that instead? - Jamie
# if that tells us, then sure - pudge

if ($form->{title}) {

my $storyskin = $gSkin;
Expand All @@ -1185,6 +1186,7 @@ sub editStory {
$storyref->{related_cids_hr} = $related_cids_hr;
my($chosen_hr) = extractChosenFromForm($form);
$storyref->{topics_chosen} = $chosen_hr;

my $rendered_hr = $slashdb->renderTopics($chosen_hr);
$storyref->{topics_rendered} = $rendered_hr;
$storyref->{primaryskid} = $slashdb->getPrimarySkidFromRendered($rendered_hr);
Expand Down Expand Up @@ -1435,7 +1437,6 @@ sub editStory {
my $files = $blobdb->getFilesForStory($sid);
$attached_files = slashDisplay('attached_files', { files => $files }, { Return => 1});
}

my $shown_in_desc = getDescForTopicsRendered($storyref->{topics_rendered},
$storyref->{primaryskid},
$display_check ? 1 : 0);
Expand Down Expand Up @@ -2025,9 +2026,18 @@ sub updateStory {
titlebar('100%', getTitle('story_update_failed'));
editStory(@_);
} else {
titlebar('100%', getTitle('updateStory-title'));
$slashdb->setRelatedStoriesForStory($form->{sid}, $related_sids_hr, $related_urls_hr, $related_cids_hr);
my $st = $slashdb->getStory($form->{sid});
my %warn_skids = map {$_ => 1 } split('\|', $constants->{admin_warn_primaryskid});
my $data = {};
if ($warn_skids{$st->{primaryskid}}) {
$data->{warn_skid} = $st->{primaryskid};
if ($constants->{plugin}{Remarks}) {
my $remarks = getObject("Slash::Remarks");
$remarks->createRemark("WARNING: $st->{sid} has a primaryskid of $st->{primaryskid}", { type => 'system' });
}
}
titlebar('100%', getTitle('updateStory-title', $data));
$slashdb->setRelatedStoriesForStory($form->{sid}, $related_sids_hr, $related_urls_hr, $related_cids_hr);
$slashdb->createSignoff($st->{stoid}, $user->{uid}, "updated");
# make sure you pass it the goods
listStories(@_);
Expand Down Expand Up @@ -2345,9 +2355,18 @@ sub saveStory {
if ($sid) {
$slashdb->setRelatedStoriesForStory($sid, $related_sids_hr, $related_urls_hr);
slashHook('admin_save_story_success', { story => $data });
titlebar('100%', getTitle('saveStory-title'));
my $st = $slashdb->getStory($data->{sid});
my $stoid = $st->{stoid};
my %warn_skids = map {$_ => 1 } split('\|', $constants->{admin_warn_primaryskid});
my $data = {};
if ($warn_skids{$st->{primaryskid}}) {
$data->{warn_skid} = $st->{primaryskid};
if ($constants->{plugin}{Remarks}) {
my $remarks = getObject("Slash::Remarks");
$remarks->createRemark("WARNING: $st->{sid} has a primaryskid of $st->{primaryskid}", { type => 'system' });
}
}
titlebar('100%', getTitle('saveStory-title', $data) );
$slashdb->createSignoff($stoid, $user->{uid}, "saved");
if ($constants->{tags_admin_autoaddstorytopics} && $constants->{plugin}{Tags}) {
my $tree = $slashdb->getTopicTree();
Expand Down
6 changes: 5 additions & 1 deletion plugins/Admin/templates/titles;admin;default
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ Filter# [% form.filter_id %] saved.

[% CASE 'updateStory-title' %]
Article [% form.sid %] Saved
}[% warn_skid %]|
[% IF warn_skid; the_skin = Slash.db.getSkin(warn_skid); "<b>Warning Story saved to $warn_skid - $the_skin.name</b>"; END; %]

[% CASE 'saveStory-title' %]
Inserted [% form.sid %] [% form.title %]
Inserted [% form.sid %] [% form.title %]
|[% warn_skid %]|
[% IF warn_skid; the_skin = Slash.db.getSkin(warn_skid); "<b>Warning Story saved to $warn_skid - $the_skin.name</b>"; END; %]

[% CASE 'story_update_failed' %]
Updating [% form.sid %] '[% form.title %]' failed. Best two out of three?
Expand Down

0 comments on commit d7c263d

Please sign in to comment.