Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix message prefs conversion script; minor updates

  • Loading branch information...
commit 3ac2be683e661196187ec9a850b4f83e0674d703 1 parent fdf4d7d
@pudge pudge authored
View
3  Slash/Apache/User/User.pm
@@ -359,7 +359,8 @@ sub userdir_handler {
# $r->uri($ops{$op}[0]);
# $r->filename($constants->{basedir} . $ops{$op}[0]);
# Not against it, or something like it. This is getting a bit long.
- # I would rather prefer it did not turn out like ops have though. -Brian
+ # I would rather prefer it did not turn out like ops have though. -Brian
+ # what do you mean? -- pudge
if ($op eq 'journal') {
$r->args("op=display&nick=$nick");
View
2  plugins/Search/search.pl
@@ -201,7 +201,7 @@ sub userSearch {
slashDisplay('searchform', {
op => $form->{op},
'sort' => _sort(),
- journal_option => 1,
+ journal_option => 1,
});
if (@$users) {
View
11 themes/slashcode/htdocs/users.pl
@@ -490,13 +490,15 @@ sub mailPasswd {
doEmail($uid, $emailtitle, $msg) if $user_edit->{nickname};
print getMessage('mailpasswd_mailed_msg', { name => $user_edit->{nickname} });
}
+
+#################################################################
sub showSubmissions {
my($id) = @_;
my $slashdb = getCurrentDB();
my $form = getCurrentForm();
my $constants = getCurrentStatic();
my $user = getCurrentUser();
- my ($uid, $nickname);
+ my($uid, $nickname);
if ($form->{uid} or $form->{nick}) {
$uid = $form->{uid} ? $form->{uid} : $slashdb->getUserUID($form->{nick});
@@ -514,13 +516,14 @@ sub showSubmissions {
slashDisplay('userSub', {
nick => $nickname,
- uid => $uid,
+ uid => $uid,
nickmatch_flag => ($user->{uid} == $uid ? 1 : 0),
stories => $stories,
storycount => $storycount,
});
}
+#################################################################
sub showComments {
my($id) = @_;
my $slashdb = getCurrentDB();
@@ -528,7 +531,7 @@ sub showComments {
my $constants = getCurrentStatic();
my $user = getCurrentUser();
my $commentstruct = [];
- my ($uid, $nickname);
+ my($uid, $nickname);
if ($form->{uid} or $form->{nick}) {
$uid = $form->{uid} ? $form->{uid} : $slashdb->getUserUID($form->{nick});
@@ -586,7 +589,7 @@ sub showComments {
slashDisplay('userCom', {
nick => $nickname,
- uid => $uid,
+ uid => $uid,
nickmatch_flag => ($user->{uid} == $uid ? 1 : 0),
points => $slashdb->getUser($uid, 'points'),
lastgranted => $slashdb->getUser($uid, 'lastgranted'),
View
67 utils/message_journal_updates.plx
@@ -1,6 +1,9 @@
#!perl -w
use Slash::Test shift;
+=pod
+
+# populate new "people" table
my $friends = $slashdb->sqlSelectAll("uid,friend", "journal_friends");
for my $id (@$friends) {
$slashdb->sqlReplace("people", {
@@ -10,60 +13,30 @@ for my $id (@$friends) {
});
}
-# catch the headlines-only people
-my $prefs = $slashdb->sqlSelectAll(<<COLS, <<TABLES, <<WHERE);
-up1.uid, up1.value
-COLS
-users_param AS up1
-TABLES
-up1.name="messagecodes_1"
-WHERE
-
-for my $user (@$prefs) {
- my $uid = $user->[0];
- my $mode = $user->[1] ? 0 : -1;
-
- $slashdb->sqlReplace("users_messages", {
- uid => $uid,
- code => 1,
- mode => $mode,
- });
-}
-
+=cut
-my $prefs = $slashdb->sqlSelectAll(<<COLS, <<TABLES, <<WHERE);
-upd.uid, upd.value, up0.value, up1.value, up2.value,
-up3.value, up4.value, up5.value, up6.value
+for my $code (0..6) {
+ my $prefs = $slashdb->sqlSelectAll(<<COLS, <<TABLES, <<WHERE);
+upd.uid, upd.value, upc.value
COLS
-users_param AS upd, users_param AS up0, users_param AS up1, users_param AS up2,
-users_param AS up3, users_param AS up4, users_param AS up5, users_param AS up6
+users_param AS upd, users_param AS upc
TABLES
-upd.uid=up0.uid AND upd.uid=up1.uid AND upd.uid=up2.uid AND upd.uid=up3.uid AND
-upd.uid=up4.uid AND upd.uid=up5.uid AND upd.uid=up6.uid AND
-upd.name="deliverymodes" AND up0.name="messagecodes_0" AND
-up1.name="messagecodes_1" AND up2.name="messagecodes_2" AND
-up3.name="messagecodes_3" AND up4.name="messagecodes_0" AND
-up5.name="messagecodes_5" AND up6.name="messagecodes_0"
+upd.uid=upc.uid AND
+upd.name="deliverymodes" AND upc.name="messagecodes_$code"
WHERE
-for my $user (@$prefs) {
- my $uid = $user->[0];
- my $mode = $user->[1];
-
- # set up proper mode for each
- my @codes = map { $_ ? $mode : -1 } @{$user}[2..8];
-
- # disallow web for new submissions and nightly mails
- for (0, 1, 6) {
- $codes[$_] = 0 if $codes[$_] == 1;
- }
+ for my $user (@$prefs) {
+ my $uid = $user->[0];
+ my $mode = $user->[1];
+ my $val = $user->[2];
+ $mode = $val && $mode >= 0
+ ? ($code =~ /^(?:0|1|6)$/ ? 0 : $mode)
+ : -1;
- # set each
- for (my $i = 0; $i < @codes; $i++) {
$slashdb->sqlReplace("users_messages", {
- uid => $uid,
- code => $i,
- mode => $codes[$i],
+ uid => $uid,
+ code => $code,
+ mode => $mode,
});
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.