From 4b8aeabf91a9549d93287c3d762b7e0e8974face Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rytis=20Slatkevi=C4=8Dius?=
Date: Wed, 26 Sep 2007 15:46:54 +0000
Subject: [PATCH] User web: fix an annoyance when team founder transfer is
requested and the requester leaves the team. NOTE: DB UPDATE REQUIRED.
svn path=/trunk/boinc/; revision=13673
---
checkin_notes | 15 ++++++++++
db/schema.sql | 2 +-
html/inc/team.inc | 5 ++--
html/ops/db_update.php | 7 ++++-
html/user/team_change_founder_form.php | 36 +++++++++++++++---------
html/user/team_founder_transfer_form.php | 4 +++
6 files changed, 51 insertions(+), 18 deletions(-)
diff --git a/checkin_notes b/checkin_notes
index 9ce3e51311..8f2212b01d 100755
--- a/checkin_notes
+++ b/checkin_notes
@@ -8785,3 +8785,18 @@ Charlie 25 Sep 2007
mac_build/
boinc.xcodeproj/
project.pbxproj
+
+Rytis 26 Sep 2007
+ - User web: fix an annoyance when team founder transfer is requested and
+ the requester leaves the team.
+ NOTE: DB UPDATE REQUIRED.
+
+ db/schema.sql
+ html/
+ inc/
+ team.inc
+ ops/
+ db_update.php
+ user/
+ team_change_founder_form.php
+ team_founder_transfer_form.php
diff --git a/db/schema.sql b/db/schema.sql
index 60bb08e3f6..0130f490d1 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -112,7 +112,7 @@ create table team (
expavg_credit double not null, /* temp */
expavg_time double not null,
seti_id integer not null,
- ping_user integer unsigned not null default 0,
+ ping_user integer not null default 0,
ping_time integer unsigned not null default 0,
primary key (id)
) type=InnoDB;
diff --git a/html/inc/team.inc b/html/inc/team.inc
index 3e64e34ff5..b529ae2f8d 100644
--- a/html/inc/team.inc
+++ b/html/inc/team.inc
@@ -1,4 +1,5 @@
teamid) return;
mysql_query("update user set teamid=0 where id=$user->id");
- mysql_query("update team set ping_user=0 where id=".$user->teamid." and ping_user=".$user->id);
+ mysql_query("update team set ping_user=-ping_user where id=".$user->teamid." and ping_user=".$user->id);
$now = time();
mysql_query("insert into team_delta (userid, teamid, timestamp, joining, total_credit) values ($user->id, $user->teamid, $now, 0, $user->total_credit)");
}
@@ -297,7 +298,7 @@ function team_count_nusers($teamid) {
// 30 days to assume foundership before someone elase can request it
//
function new_transfer_request_ok($team, $now) {
- if ($team->ping_user == 0) {
+ if ($team->ping_user <= 0) {
if ($team->ping_time < $now - 60 * 86400) {
return true;
}
diff --git a/html/ops/db_update.php b/html/ops/db_update.php
index a83f600d99..caba5f3bd9 100755
--- a/html/ops/db_update.php
+++ b/html/ops/db_update.php
@@ -440,11 +440,16 @@ function update_7_26_2007() {
);
}
+function update_9_26_2007() {
+ // Change field type from unsigned to signed
+ do_query("ALTER TABLE `team` CHANGE `ping_user` `ping_user` INT( 10 ) NOT NULL DEFAULT '0'");
+}
+
// modify the following to call the function you want.
// Make sure you do all needed functions, in order.
// (Look at your DB structure using "explain" queries to see
// which ones you need).
-//update_7_26_2007();
+//update_9_26_2007();
?>
diff --git a/html/user/team_change_founder_form.php b/html/user/team_change_founder_form.php
index 49178909cd..cc0522c7f7 100644
--- a/html/user/team_change_founder_form.php
+++ b/html/user/team_change_founder_form.php
@@ -1,4 +1,5 @@
name");
-if ($team->ping_user) {
- $ping_user = lookup_user_id($team->ping_user);
- echo "Team member ".user_links($ping_user)." has requested this
- team's founder position. This may be because you left
- the team or haven't had contact with the team for a long time.
- ";
- echo "
Use the following form to transfer team founder position or
-
-
- ";
+if ($team->ping_user != 0) {
+ if ($team->ping_user < 0) {
+ $ping_user = lookup_user_id(-$team->ping_user);
+ echo "Team member ".user_links($ping_user)." has requested this
+ team's founder position, but has already left the team.
+ ";
+ } else {
+ $ping_user = lookup_user_id($team->ping_user);
+ echo "Team member ".user_links($ping_user)." has requested this
+ team's founder position. This may be because you left
+ the team or haven't had contact with the team for a long time.
+ ";
+ echo "Use the following form to transfer team founder position or
+
+
+ ";
+ }
}
echo "
diff --git a/html/user/team_founder_transfer_form.php b/html/user/team_founder_transfer_form.php
index 1081f79684..baa00de001 100644
--- a/html/user/team_founder_transfer_form.php
+++ b/html/user/team_founder_transfer_form.php
@@ -1,4 +1,5 @@
ping_user < 0) {
+ $team->ping_user = -$team->ping_user;
+ }
$ping_user = lookup_user_id($team->ping_user);
echo "Founder change has already been requested by ".
user_links($ping_user)." on ".date_str($team->ping_time).".