Răsfoiți Sursa

Some small fixes

Markus-Rost 4 ani în urmă
părinte
comite
9c7a0e6c64
4 a modificat fișierele cu 10 adăugiri și 6 ștergeri
  1. 1 1
      RcGcDb
  2. 6 4
      dashboard/settings.js
  3. 2 0
      dashboard/src/index.css
  4. 1 1
      functions/global_block.js

+ 1 - 1
RcGcDb

@@ -1 +1 @@
-Subproject commit bd9184ef480f818a6eef7c427eb5808f092c742e
+Subproject commit 7b068067ef689ec5e316dd75ac2818ced340dcc0

+ 6 - 4
dashboard/settings.js

@@ -322,7 +322,7 @@ function update_settings(res, userSettings, guild, type, settings) {
 		if ( type !== 'default' && !hasPerm(response.userPermissions, 'VIEW_CHANNEL', 'SEND_MESSAGES') ) {
 			return res(`/guild/${guild}/settings/${type}`, 'savefail');
 		}
-		if ( settings.delete_settings ) return db.get( 'SELECT main.lang mainlang, main.wiki mainwiki, main.role mainrole, main.inline maininline, old.wiki, old.lang, old.role, old.inline FROM discord main LEFT JOIN discord old ON main.guild = old.guild AND old.channel = ? WHERE main.guild = ? AND ( main.channel = ? OR main.channel IS NULL ) ORDER BY main.channel DESC', [( response.isCategory ? '#' : '' ) + type, guild, '#' + response.parentID], function(dberror, row) {
+		if ( settings.delete_settings ) return db.get( 'SELECT GROUP_CONCAT(DISTINCT main.lang) guildlang, main.lang mainlang, main.wiki mainwiki, main.role mainrole, main.inline maininline, old.wiki, old.lang, old.role, old.inline FROM discord main LEFT JOIN discord old ON main.guild = old.guild AND old.channel = ? WHERE main.guild = ? AND ( main.channel = ? OR main.channel IS NULL ) ORDER BY main.channel DESC', [( response.isCategory ? '#' : '' ) + type, guild, '#' + response.parentID], function(dberror, row) {
 			db.run( 'DELETE FROM discord WHERE guild = ? AND channel = ?', [guild, ( response.isCategory ? '#' : '' ) + type], function (delerror) {
 				if ( delerror ) {
 					console.log( '- Dashboard: Error while removing the settings: ' + delerror );
@@ -335,7 +335,9 @@ function update_settings(res, userSettings, guild, type, settings) {
 					return;
 				}
 				if ( !row || row.wiki === null ) return;
-				var lang = new Lang(row.mainlang);
+				var lang = new Lang(( row.guildlang.split(',').find( guildlang => {
+					return ( guildlang !== row.mainlang );
+				} ) || row.mainlang ));
 				var text = lang.get('settings.dashboard.removed', `<@${userSettings.user.id}>`, `<#${type}>`);
 				if ( row.wiki !== row.mainwiki ) text += `\n${lang.get('settings.currentwiki')} <${row.wiki}>`;
 				if ( response.patreon ) {
@@ -363,7 +365,7 @@ function update_settings(res, userSettings, guild, type, settings) {
 			return fresponse;
 		} ).then( fresponse => {
 			return new Promise( function (resolve, reject) {
-				db.get( 'SELECT lang, wiki, role, inline, prefix FROM discord WHERE guild = ? AND ( channel = ? OR channel IS NULL ) ORDER BY channel DESC', [guild, '#' + response.parentID], function(error, row) {
+				db.get( 'SELECT guild.lang guildlang, main.lang, main.wiki, main.role, main.inline, main.prefix FROM discord main LEFT JOIN discord guild ON main.guild = guild.guild AND guild.channel IS NULL WHERE main.guild = ? AND ( main.channel = ? OR main.channel IS NULL ) ORDER BY main.channel DESC', [guild, '#' + response.parentID], function(error, row) {
 					if ( error ) {
 						console.log( '- Dashboard: Error while getting the settings: ' + error );
 						return reject();
@@ -382,7 +384,7 @@ function update_settings(res, userSettings, guild, type, settings) {
 			console.log( '- Dashboard: Error while testing the wiki: ' + error );
 			return Promise.reject();
 		} ).then( (row, query) => {
-			var lang = new Lang(( type === 'default' && settings.lang || row.lang ));
+			var lang = new Lang(( type === 'default' && settings.lang || row.guildlang ));
 			var embed;
 			if ( !wiki.isFandom() && query ) {
 				let notice = [];

+ 2 - 0
dashboard/src/index.css

@@ -62,6 +62,7 @@ code {
 	line-height: 1.6;
 	text-align: center;
 	margin: 0 auto 1em;
+	width: -moz-fit-content;
 	width: fit-content;
 	border: 2px solid;
 }
@@ -353,6 +354,7 @@ button.addmore:not([hidden]) {
 	display: flex;
 	margin: 20px auto;
 	padding: 20px 50px;
+	width: -moz-fit-content;
 	width: fit-content;
 	justify-content: center;
 	align-items: center;

+ 1 - 1
functions/global_block.js

@@ -51,7 +51,7 @@ function global_block(lang, msg, username, text, embed, wiki, spoiler, gender) {
 		}, error => {
 			console.log( '- Error while getting the global block: ' + error );
 		} ),
-		( isUser ? ( wiki.isGamepedia() ? got.get( 'https://help.gamepedia.com/UserProfile:' + encodeURIComponent( username ), {
+		( isUser ? ( wiki.isGamepedia() ? got.get( 'https://help.gamepedia.com/UserProfile:' + encodeURIComponent( username ) + '?cache=' + Date.now(), {
 			responseType: 'text'
 		} ).then( gresponse => {
 			var gbody = gresponse.body;