Changeset 1128
- Timestamp:
- 09/23/08 16:15:26 (14 months ago)
- Location:
- trunk/ActionStreams/plugins/ActionStreams
- Files:
-
- 4 modified
-
config.yaml (modified) (1 diff)
-
lib/ActionStreams/Event.pm (modified) (3 diffs)
-
lib/ActionStreams/Plugin.pm (modified) (5 diffs)
-
tmpl/other_profiles.tmpl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ActionStreams/plugins/ActionStreams/config.yaml
r1126 r1128 23 23 add_other_profile: $ActionStreams::ActionStreams::Plugin::add_other_profile 24 24 remove_other_profile: $ActionStreams::ActionStreams::Plugin::remove_other_profile 25 itemset_update_profiles: $ActionStreams::ActionStreams::Plugin::itemset_update_profiles 25 26 itemset_hide_events: $ActionStreams::ActionStreams::Plugin::itemset_hide_events 26 27 itemset_show_events: $ActionStreams::ActionStreams::Plugin::itemset_show_events -
trunk/ActionStreams/plugins/ActionStreams/lib/ActionStreams/Event.pm
r1111 r1128 9 9 use ActionStreams::Scraper; 10 10 11 our $ first_update= 0;11 our $hide_timeless = 0; 12 12 13 13 __PACKAGE__->install_properties({ … … 54 54 my %profile = @_; 55 55 56 # Keep this option out of band so we don't have to count on 57 # implementations of update_events() passing it through. 58 local $hide_timeless = delete $profile{hide_timeless} ? 1 : 0; 59 56 60 my $warn = $SIG{__WARN__} || sub { print STDERR $_[0] }; 57 61 local $SIG{__WARN__} = sub { … … 356 360 }); 357 361 $event->tags(@$tags) if $tags; 358 if ($ first_update&& !$event->created_on) {362 if ($hide_timeless && !$event->created_on) { 359 363 $event->visible(0); 360 364 } -
trunk/ActionStreams/plugins/ActionStreams/lib/ActionStreams/Plugin.pm
r1114 r1128 366 366 added => $app->param('added') ? 1 : 0, 367 367 removed => $app->param('removed') ? 1 : 0, 368 updated => $app->param('updated') ? 1 : 0, 368 369 _build_service_data( 369 370 networks => $app->registry('profile_services'), … … 482 483 } 483 484 485 sub itemset_update_profiles { 486 my $app = shift; 487 488 my %users; 489 my $page_author_id; 490 PROFILE: for my $profile ($app->param('id')) { 491 my ($author_id, $type, $ident) = split /:/, $profile, 3; 492 493 my $user = ($users{$author_id} ||= MT->model('author')->load($author_id)) 494 or next PROFILE; 495 next PROFILE 496 if $app->user->id != $author_id && !$app->user->is_superuser(); 497 498 my $profiles = $user->other_profiles($type); 499 if (!$profiles) { 500 next PROFILE; 501 } 502 my @profiles = grep { $_->{ident} eq $ident } @$profiles; 503 for my $author_profile (@profiles) { 504 update_events_for_profile($user, $author_profile, 505 synchronous => 1); 506 } 507 508 $page_author_id = 1; 509 } 510 511 return $app->redirect($app->uri( 512 mode => 'other_profiles', 513 args => { id => ($page_author_id || $app->user->id), updated => 1 }, 514 )); 515 } 516 484 517 sub first_profile_update { 485 518 my ($cb, $app, $user, $profile) = @_; 486 require ActionStreams::Event; 487 local $ActionStreams::Event::first_update = 1; 488 update_events_for_profile($user, $profile); 519 update_events_for_profile($user, $profile, 520 synchronous => 1, hide_timeless => 1); 489 521 } 490 522 … … 979 1011 980 1012 sub update_events { 981 require ActionStreams::Event;982 1013 my $mt = MT->app; 983 984 1014 $mt->run_callbacks('pre_action_streams_task', $mt); 985 1015 … … 1000 1030 1001 1031 sub update_events_for_profile { 1002 my ($author, $profile ) = @_;1032 my ($author, $profile, %param) = @_; 1003 1033 my $type = $profile->{type}; 1004 1034 my $streams = $profile->{streams}; 1005 1035 return if !$streams || !%$streams; 1006 1036 1037 require ActionStreams::Event; 1007 1038 my @event_classes = ActionStreams::Event->classes_for_type($type) 1008 1039 or return; … … 1014 1045 next EVENTCLASS if !$streams->{$event_class->class_type}; 1015 1046 1016 if ($ActionStreams::Event::first_update) { 1017 # Do the first update synchronously. 1047 if ($param{synchronous}) { 1018 1048 $event_class->update_events_safely( 1019 author => $author, 1049 author => $author, 1050 hide_timeless => $param{hide_timeless} ? 1 : 0, 1020 1051 %$profile, 1021 1052 ); -
trunk/ActionStreams/plugins/ActionStreams/tmpl/other_profiles.tmpl
r471 r1128 56 56 </mtapp:statusmsg> 57 57 </mt:if> 58 <mt:if name="updated"> 59 <mtapp:statusmsg 60 id="updated" 61 class="success"> 62 <__trans phrase="The selected profiles were scanned for updates."> 63 </mtapp:statusmsg> 64 </mt:if> 58 65 </mt:setvarblock> 59 66 … … 76 83 title="<__trans phrase="Delete selected profiles (x)">" 77 84 ><__trans phrase="Delete"></a> 85 <a href="javascript:void(0)" 86 onclick="doForMarkedInThisWindow(getByID('profile-listing-form'), '<__trans phrase="profile">', '<__trans phrase="profiles">', 'id', 'itemset_update_profiles'); return false" 87 title="<__trans phrase="Scan now for new actions">" 88 ><__trans phrase="Update Now"></a> 78 89 </mt:setvarblock> 79 90 <mt:var name="position_actions_top" value="1">
