From 5dd9fbe564ffcca1f2b850e27ed136154ba80013 Mon Sep 17 00:00:00 2001 From: RongYYYY Date: Sun, 6 Oct 2024 13:56:28 -0400 Subject: [PATCH 1/3] Skin_Update_1.0 Initial trial on updating skin based on time in day --- public/src/admin/appearance/skins.js | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/public/src/admin/appearance/skins.js b/public/src/admin/appearance/skins.js index 17cb426d6e..7e0281f8fb 100644 --- a/public/src/admin/appearance/skins.js +++ b/public/src/admin/appearance/skins.js @@ -22,6 +22,7 @@ define('admin/appearance/skins', [ } }); settings.load('custom-skins', $('.custom-skin-settings')); + setThemeBasedOnTime(bsData); // Call the theme selection logic Skins.render(bsData); }); @@ -124,5 +125,37 @@ define('admin/appearance/skins', [ }); } + function setThemeBasedOnTime() { + console.log("Hello, world!1"); // Logs a message + + const hour = new Date().getHours(); + const isNight = (hour >= 18 || hour < 6); // Night from 6 PM to 6 AM + + if (isNight) { + // Assuming `dark-theme` is the theme ID for dark mode + const darkTheme = bsData.themes.find(theme => theme.name.toLowerCase().includes('dark')); + if (darkTheme) { + applyTheme(darkTheme); + } + } else { + // Assuming `light-theme` is the theme ID for light mode + const lightTheme = bsData.themes.find(theme => theme.name.toLowerCase().includes('light')); + if (lightTheme) { + applyTheme(lightTheme); + } + } + } + + function applyTheme(theme) { + console.log("Hello, world!2"); // Logs a message + const cssSrc = theme.css; // Assuming the theme object contains a 'css' property + const themeId = theme.name; + + // Update the theme using similar logic as the 'click' event for user selection + $('link#theme').attr('href', cssSrc); + app.config.bootswatchSkin = themeId; + highlightSelectedTheme(themeId); // Reuse the existing function + } + return Skins; }); From db645984b098d3c10390558aa6bff45ec147c050 Mon Sep 17 00:00:00 2001 From: RongYYYY Date: Sun, 6 Oct 2024 23:23:42 -0400 Subject: [PATCH 2/3] Problem-solved feature Pivoted to problem-solved feature. --- dump.rdb | Bin 0 -> 55519 bytes public/src/admin/appearance/skins.js | 5 ++- public/src/client/topic.js | 22 +++++++++++++ src/controllers/topics.js | 17 ++++++++++ src/plugins/mark-as-solved.js | 45 +++++++++++++++++++++++++++ src/socket.io/topics.js | 34 ++++++++++++++++++++ 6 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 dump.rdb create mode 100644 src/plugins/mark-as-solved.js diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 0000000000000000000000000000000000000000..c22c9a14ce3286faaf308349220263e11c0aeca8 GIT binary patch literal 55519 zcmdVD349yZbuWAe8$o~zz?~8$3>WPLiG?d7D??JNCE2nh%dsVy7yttj5(vN;P!ydw zfh}3G_Qi5+$Ff5&anhv8%hIe(^I-GkrAc4ECTW_qc}Y8Vl2^BGzQhf`mlrpU-nsYA z0D}<#lJcT__79@OnLD_1@409FpL2F^+PH0x%jI^zS)LR^5z%=>NE-XQJYBtSTIeqV zk(8L>-ZTbNkqP1Dmc9D1H_elx5OPik6EE)?W6_&tJ|1=kcu~lpKcN2@8qnL;jV0rg z312W0@_BuUWaLOBDvSxDkNjHnrQ(T5Q1k_p0-q9QIcccX(aIpygpSAf3BmZW0^=It zd76PMkBiaCF@LAd>2*p>Cvv9c&rByeoi4NB`C8|;y;&E$%qFbmr(n{_y^&N@ut>{O z=%R$&j!iK>5EVjp#GDBUVlWv=q$2THMVdJSFBcG!O(XHiSgJzLoEVRULPD&JVNQtC zVoI1`%h5^hGwiI%%rK9_x^Y{pZ;eM{yM_BE1u-SoA?EB%gL#L*9}y}MbIoqU@8t2N zA|cUtBqB_S?d=GmD#S2|F~O${K4$nB8HUlr{|5M6vzZccG3D#yZoL(5wxDB)NXTGf zj!nW3hB*cggMXb2#$zcVmNK8`#ZZ_Zn-Y>K9{#94g%?0f@e>Kl+@ssy3|)pLF282) z&Fzh+_}+-YaUnDr6?}9d#M!|Ojtwvg13J%#CL*zjm`d`gcv7sM+lW^fKihg~OEezf zqwLOjNJzKnYUVc0v@qq@Y-@90S%@6)ONze9#F03rhF6D{JC>`c;e`U!&_Jj`J#Gah zhINz})&ViV#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q;!StG)lL6X_FQh$OGDpCc1>?V z4MmQCYYULia@R$`wYLw)b?%o3k3IO zw!aB~frP-nPW~SL0!=3W_bY!OH5#A+1F6?Yiq25wF)w`g8P!+)hw@duD_!zet^RM@ zAVO+n+nHARtF9_v^&RD_-jKgaof)j*g=&?dL}svNREf-B%sNYC22*ABre_AvcDm(^ zzUx^8*I>kruY{?L)g9s)>~9#EKA^Cp&1-8VRi) z+)+I1QAvS z>L0JUzhLEeT;-}r<#z)6Wp8@r_huT-28JO<0#QM(tcx*fv&Aj0rxf0PJ!JVRB|%lK z8qGS9!$8I1;!xT*xWh8SeefMhwVwRP2(^$1a=jd9p%6c;&vTO@_1WGPWMY^R*5%j& z!SRc}9@q6%jj_7YoVzmtcoZy5L?20;zK(0W*vl8HT>EHGcW~yvFwSu1(|S_3_N78~Yayoqv#Fw41&}MT zpsa$k#j*-Mq0TB`OJxE12J5}M%Gz4w9HTglCI|*&v>;yY?utW1^ME@ue?9kj^DA<9QAnWnX4|eSN~zMG0VsC&fgBU5$;!-7_87DXJ=?Ur0(3ZyVJ~XStsY zEp;qaImDj7-r7x?$s6HeGgf1+gg*9#$#y)qcE(!Mk=N>$mbZ9oW_+>o77MSSf9+cb NzIx!6_x`Z@{{qt>H+BF3 literal 0 HcmV?d00001 diff --git a/public/src/admin/appearance/skins.js b/public/src/admin/appearance/skins.js index 7e0281f8fb..f7cef51d02 100644 --- a/public/src/admin/appearance/skins.js +++ b/public/src/admin/appearance/skins.js @@ -12,6 +12,7 @@ define('admin/appearance/skins', [ method: 'get', url: 'https://bootswatch.com/api/5.json', }).done((bsData) => { + console.log("Hello, world!3"); hooks.on('action:settings.sorted-list.loaded', (data) => { if (data.hash === 'custom-skins') { // slugify all custom-skin ids after load @@ -22,11 +23,12 @@ define('admin/appearance/skins', [ } }); settings.load('custom-skins', $('.custom-skin-settings')); - setThemeBasedOnTime(bsData); // Call the theme selection logic + // setThemeBasedOnTime(bsData); // Call the theme selection logic Skins.render(bsData); }); $('#save-custom-skins').on('click', function () { + console.log("Hello, world!3"); settings.save('custom-skins', $('.custom-skin-settings'), function () { alerts.success('[[admin/appearance/skins:save-custom-skins-success]]'); }); @@ -35,6 +37,7 @@ define('admin/appearance/skins', [ $('#skins').on('click', function (e) { + console.log("Hello, world!3"); let target = $(e.target); if (!target.attr('data-action')) { diff --git a/public/src/client/topic.js b/public/src/client/topic.js index 7e65cbeb4f..8391a65f8c 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -70,6 +70,16 @@ define('forum/topic', [ handleBookmark(tid); handleThumbs(); + $(document).on('click', '.mark-as-solved', function(e) { + e.preventDefault(); + const postIndex = $(this).closest('[data-index]').attr('data-index'); + const tid = ajaxify.data.tid; + const pid = $(this).attr('data-pid'); // Assuming the post has a data-pid attribute + + markAsSolved(postIndex, tid, pid); + }); + + $(window).on('scroll', utils.debounce(updateTopicTitle, 250)); handleTopicSearch(); @@ -207,6 +217,18 @@ define('forum/topic', [ }); } + function markAsSolved(postIndex, tid, pid) { + socket.emit('plugins.markAsSolved', { tid: tid, pid: pid }, function(err, data) { + if (err) { + alerts.error(err.message); + } else { + alerts.success('Marked as Solved!'); + // Optionally update the UI to reflect the solved status + $('[data-index="' + postIndex + '"]').addClass('solved-post'); + } + }); + } + function addBlockQuoteHandler() { components.get('topic').on('click', 'blockquote .toggle', function () { const blockQuote = $(this).parent('blockquote'); diff --git a/src/controllers/topics.js b/src/controllers/topics.js index d83ce8e602..5769a2cae5 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -45,6 +45,23 @@ topicsController.get = async function getTopic(req, res, next) { user.auth.getFeedToken(req.uid), ]); + console.log(posts); + + const pids = await topics.getPidsFromSet(`tid:${tid}:posts`, 0, -1); + + // Fetch the posts by post IDs + const postsArray = await posts.getPostsByPids(pids); + + // Add 'canMarkAsSolved' and 'solved' to each post + postsArray.forEach(async (post) => { + const canMarkAsSolved = (req.uid === post.uid || await privileges.isAdminOrMod(req.uid)); + post.canMarkAsSolved = canMarkAsSolved; + post.solved = post.solved || false; + }); + + // Pass the updated posts and other data to the template + res.render('topic', { topicData, posts: postsArray, userPrivileges, settings }); + let currentPage = parseInt(req.query.page, 10) || 1; const pageCount = Math.max(1, Math.ceil((topicData && topicData.postcount) / settings.postsPerPage)); const invalidPagination = (settings.usePagination && (currentPage < 1 || currentPage > pageCount)); diff --git a/src/plugins/mark-as-solved.js b/src/plugins/mark-as-solved.js new file mode 100644 index 0000000000..3cd762df6b --- /dev/null +++ b/src/plugins/mark-as-solved.js @@ -0,0 +1,45 @@ +const topics = require.main.require('./src/topics'); +const posts = require.main.require('./src/posts'); +const privileges = require.main.require('./src/privileges'); + +module.exports = function(socket, callback) { + socket.on('plugins.markAsSolved', async (data, callback) => { + const { tid, pid } = data; + + try { + // Fetch the topic and check if the user has permission to mark as solved + const topic = await topics.getTopicData(tid); + const canMarkAsSolved = await privileges.posts.canEdit(pid, socket.uid); + + if (!canMarkAsSolved) { + return callback(new Error('You do not have permission to mark as solved.')); + } + + // Mark the post as solved in the database + await posts.setPostField(pid, 'solved', 1); + + // Optionally mark the entire topic as solved + await topics.setTopicField(tid, 'solved', 1); + + // Success callback with more detailed response + callback(null, { message: 'Post and topic marked as solved.', tid, pid }); + } catch (err) { + // Handle any errors during the process + callback(new Error('An error occurred while marking the post as solved.')); + } + }); +}; + +function markAsSolved(tid, pid) { + socket.emit('plugins.markAsSolved', { tid: tid, pid: pid }, function (err, data) { + if (err) { + app.alertError(err.message); + } else { + app.alertSuccess('Post marked as solved!'); + + // Update UI: Hide the button and show the "Solved" label + document.querySelector(`[data-pid="${pid}"] .mark-as-solved`).style.display = 'none'; + document.querySelector(`[data-pid="${pid}"] .solved-label`).style.display = 'block'; + } + }); +} diff --git a/src/socket.io/topics.js b/src/socket.io/topics.js index 3df9cdc1a2..8da37ccd8c 100644 --- a/src/socket.io/topics.js +++ b/src/socket.io/topics.js @@ -121,6 +121,40 @@ SocketTopics.getMyNextPostIndex = async function (socket, data) { return await posts.getPidIndex(userPidsInTopic[0], data.tid, data.sort); }; +SocketTopics.markAsSolved = async function (socket, data) { + if (!socket.uid) { + throw new Error('[[error:not-logged-in]]'); + } + + if (!data || !data.tid || !data.pid) { + throw new Error('[[error:invalid-data]]'); + } + + // Fetch the topic and check if the user has permission to mark as solved + const topic = await topics.getTopicData(data.tid); + const canMarkAsSolved = await privileges.posts.canEdit(data.pid, socket.uid); + + if (!canMarkAsSolved) { + throw new Error('[[error:no-privileges]]'); + } + + // Mark the post as solved in the database + await posts.setPostField(data.pid, 'solved', 1); + + // Optionally mark the entire topic as solved + await topics.setTopicField(data.tid, 'solved', 1); + + // Emit an event or log the action if necessary + events.log({ + type: 'post-mark-solved', + uid: socket.uid, + tid: data.tid, + pid: data.pid, + }); + + return { message: 'Post marked as solved.' }; +}; + SocketTopics.getPostCountInTopic = async function (socket, tid) { if (!socket.uid || !tid) { return 0; From f78e1c368852e448176d1974b33892958d19fad6 Mon Sep 17 00:00:00 2001 From: RongYYYY Date: Thu, 10 Oct 2024 02:33:59 -0400 Subject: [PATCH 3/3] Update and pivot. --- dump.rdb | Bin 55519 -> 56828 bytes src/controllers/topics.js | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/dump.rdb b/dump.rdb index c22c9a14ce3286faaf308349220263e11c0aeca8..1f541bebfd1b5d241ab94d929741819c50676334 100644 GIT binary patch delta 2513 zcmbVNeQXnD7{B-0UVC@l){d<$+i1J3W8l`c9s6pDaFA_e1H*_A$QaUYyLHv|gI>Eq zVD@0(vMB?6r^dJdN=#4`)YAk6BRa{5sQ5{uiBgP0A|_zcfB3BLbz4`+CP zufZdvUBB%kcNANQ-?`oDq;VX?WfU6>`h%RK!df9Kfq*KBptI<6eKE7l;^H_q#90De zVYkP}S$zI>wzbt9>SVpFxziQ&`h8n09$$zJj(?lGTp^FoTy3?Qeg2@=)m7Hx@8~E` zHmrY`hLHz%Og4Pf2`m3&!WECS^L-sBClsvI4M1*WINdk}zZNZ-#nS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Os<#y{}ymyzvY_VA^wi4_1G;>)wS?IlrMQ%r#)m&!n?xu#h+Owd&ARBt_ zM-3yozH!Dvj7w|%R0&bq0=5VhfpwYx@kCb6`uPo#=ep9#&_E$8W$B}^P@wb3B6Kry z8GV_4Tk&+&QP5nhm#C<2@LrtBQC%vPY?#_`Sw}i9H!>x=?R8t~sM85FUy4~2 zLL7zA?G&lj2%0oa2~9JCBNFslBK=}J-aI!JhvT#n78*_P(kDAe{=`@!JQ)?CA~^-j zm*k{o$|`RDC@(5jrS9~)ZN;``-?3x9lODID!|M)A+c!`YZq;VTDwVOyNP)xeak=BG z&fcnBBffxQW`xC4TS?(?EvomS)4E-yuWk`F)ccCSWQ-p8s7|shERC;9a x!>kdKvWkg&j$@P6YU&h&!ohK63 { + // const canMarkAsSolved = (req.uid === post.uid || await privileges.isAdminOrMod(req.uid)); + // post.canMarkAsSolved = canMarkAsSolved; - // Add 'canMarkAsSolved' and 'solved' to each post - postsArray.forEach(async (post) => { - const canMarkAsSolved = (req.uid === post.uid || await privileges.isAdminOrMod(req.uid)); - post.canMarkAsSolved = canMarkAsSolved; - post.solved = post.solved || false; - }); + // // Ensure 'solved' status is passed correctly + // post.solved = post.solved || false; + // }); - // Pass the updated posts and other data to the template - res.render('topic', { topicData, posts: postsArray, userPrivileges, settings }); + // // Pass the updated posts and other necessary data to the template + // res.render('topic', { topicData, posts: postsArray, userPrivileges, settings }); let currentPage = parseInt(req.query.page, 10) || 1; const pageCount = Math.max(1, Math.ceil((topicData && topicData.postcount) / settings.postsPerPage));