Skip to content

Commit

Permalink
Merge pull request #30 from CMU-17313Q/mergingp1tags
Browse files Browse the repository at this point in the history
merging KRAARK with p1
  • Loading branch information
Abdallah-Abdaljalil authored Sep 19, 2024
2 parents fe805df + d9eb9a0 commit 4c8f1d4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/topics/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ const utils = require('../utils');
const batch = require('../batch');
const cache = require('../cache');

function extractTagValues(tags) {
return tags.map(tagItem => tagItem.value);
}


module.exports = function (Topics) {
Topics.createTags = async function (tags, tid, timestamp) {
if (!Array.isArray(tags) || !tags.length) {
Expand Down Expand Up @@ -158,7 +163,7 @@ module.exports = function (Topics) {

// update 'tags' field in topic hash
topicData.forEach((topic) => {
topic.tags = topic.tags.map(tagItem => tagItem.value);
topic.tags = extractTagValues(topic.tags);
const index = topic.tags.indexOf(tag);
if (index !== -1) {
topic.tags.splice(index, 1, newTagName);
Expand Down

0 comments on commit 4c8f1d4

Please sign in to comment.