Skip to content

Commit

Permalink
fix reject liinks (#272)
Browse files Browse the repository at this point in the history
Dear team,

This PR addresses a bug related to the idCampaign variable and the
assignment of the idLink variable. The following changes have been made
to resolve the issues:

Fixing idCampaign Bug: The bug in the idCampaign variable has been
resolved

Assigning idLink from URL Parameter: The idLink variable is now assigned
the value of req.params.id, which retrieves the parameter from the
request URL. This ensures that the correct idLink is obtained for
further processing within the function.

These changes aim to fix the bugs and ensure that the correct values are
used for idCampaign and idLink in the rejectLink function. Reviewers,
please verify the updated code and provide any feedback, suggestions, or
alternative approaches if necessary.

Thank you for your attention to detail and your valuable input.

Best regards,
Rania Morheg
  • Loading branch information
ksibisamir committed Jun 22, 2023
2 parents 2dbda2c + 3a1da1d commit 1be59f9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions controllers/campaign.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2447,16 +2447,19 @@ module.exports.campaignInvested = async (req, res) => {
//REJECT influencer link controller by advertiser
exports.rejectLink = async (req, res) => {
const { lang = 'en', title = '', idCampaign, reason, email, link } = req.body;
const { idLink } = req.params;
const idUser = '0' + req.user._id;


const campaign = await fetchCampaign({_id: idCampaign});
const idUser = '0' +req.user._id;
const idLink = req.params.id

configureTranslation(lang)
let reqReason = reason.map(str => str)

const campaign = await fetchCampaign({_id:campaignId});


try {
if (idUser !== campaign?.idNode) {

return responseHandler.makeResponseError(res, 401, 'unauthorized');
}

Expand All @@ -2472,6 +2475,7 @@ exports.rejectLink = async (req, res) => {
{ returnOriginal: false }
)
let id = +req.body.idUser

const notificationPromise = notificationManager(id, 'cmp_candidate_reject_link', {
cmp_name: title,
action: 'link_rejected',
Expand Down

0 comments on commit 1be59f9

Please sign in to comment.