1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Don't color usernames if the color has not been set explicitly

This commit is contained in:
Maximilian Mader 2014-08-12 20:43:35 +02:00
parent c44dea73d3
commit 2ad26f0d04
3 changed files with 12 additions and 7 deletions

View File

@ -124,8 +124,13 @@ public function getUsername($colored = false) {
if ($this->type == self::TYPE_INFORMATION) return WCF::getLanguage()->get('chat.global.information'); if ($this->type == self::TYPE_INFORMATION) return WCF::getLanguage()->get('chat.global.information');
if ($colored) { if ($colored) {
if ($this->color1 !== null || $this->color2 !== null) {
$username = \chat\util\ChatUtil::gradient($username, $this->color1, $this->color2); $username = \chat\util\ChatUtil::gradient($username, $this->color1, $this->color2);
} }
else {
$username = '<span class="defaultColor">'.$username.'</span>';
}
}
return $username; return $username;
} }

View File

@ -32,8 +32,8 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler)
$editor = new \wcf\data\user\UserEditor($this->user); $editor = new \wcf\data\user\UserEditor($this->user);
$editor->update(array( $editor->update(array(
'chatColor1' => 0, 'chatColor1' => null,
'chatColor2' => 0 'chatColor2' => null
)); ));
$this->didInit(); $this->didInit();
} }

View File

@ -19,8 +19,8 @@ CREATE TABLE chat1_message (
message MEDIUMTEXT NOT NULL, message MEDIUMTEXT NOT NULL,
enableSmilies TINYINT(1) NOT NULL DEFAULT 1, enableSmilies TINYINT(1) NOT NULL DEFAULT 1,
enableHTML TINYINT(1) NOT NULL DEFAULT 0, enableHTML TINYINT(1) NOT NULL DEFAULT 0,
color1 INT(10) NOT NULL DEFAULT 0, color1 INT(10) DEFAULT NULL,
color2 INT(10) NOT NULL DEFAULT 0, color2 INT(10) DEFAULT NULL,
additionalData TEXT DEFAULT NULL, additionalData TEXT DEFAULT NULL,
attachmentID INT(10) DEFAULT NULL, attachmentID INT(10) DEFAULT NULL,
@ -62,8 +62,8 @@ CREATE TABLE chat1_suspension (
); );
ALTER TABLE wcf1_user ADD COLUMN chatRoomID INT(10) DEFAULT NULL; ALTER TABLE wcf1_user ADD COLUMN chatRoomID INT(10) DEFAULT NULL;
ALTER TABLE wcf1_user ADD COLUMN chatColor1 INT(10) NOT NULL DEFAULT 0; ALTER TABLE wcf1_user ADD COLUMN chatColor1 INT(10) DEFAULT NULL;
ALTER TABLE wcf1_user ADD COLUMN chatColor2 INT(10) NOT NULL DEFAULT 0; ALTER TABLE wcf1_user ADD COLUMN chatColor2 INT(10) DEFAULT NULL;
ALTER TABLE wcf1_user ADD COLUMN chatLastActivity INT(10) NOT NULL DEFAULT 0; ALTER TABLE wcf1_user ADD COLUMN chatLastActivity INT(10) NOT NULL DEFAULT 0;
ALTER TABLE wcf1_user ADD COLUMN chatAway TEXT DEFAULT NULL; ALTER TABLE wcf1_user ADD COLUMN chatAway TEXT DEFAULT NULL;
ALTER TABLE wcf1_user ADD COLUMN chatLastSeen INT(10) NOT NULL DEFAULT 0; ALTER TABLE wcf1_user ADD COLUMN chatLastSeen INT(10) NOT NULL DEFAULT 0;