This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION apply_default_theme_for_new_user() RETURNS TRIGGER AS $defaultTheme$ | |
BEGIN | |
IF (SELECT COUNT(*) FROM preferences WHERE userid=NEW.id AND category='theme') = 0 THEN | |
INSERT INTO preferences (userid, category, name, value) | |
VALUES (NEW.id, 'theme', '', '{"awayIndicator":"#b8b884","buttonBg":"#004818","buttonColor":"#ffffff","centerChannelBg":"#ffffff","centerChannelColor":"#444444","codeTheme":"monokai","linkColor":"#004818","mentionBg":"#7E9949","mentionColor":"#ffffff","mentionHighlightBg":"#cceecc","mentionHighlightLink":"#444444","newMessageSeparator":"#90ad58","onlineIndicator":"#99cb3f","sidebarBg":"#262626","sidebarHeaderBg":"#363636","sidebarHeaderTextColor":"#ffffff","sidebarText":"#ffffff","sidebarTextActiveBorder":"#7e9949","sidebarTextActiveColor":"#ffffff","sidebarTextHoverBg":"#525252","sidebarUnreadText":"#0aff44","type":"custom"}'); | |
END IF; | |
RETURN NEW; | |
END; | |
$defaultTheme$ LANGUAGE 'plpgsql'; |