oarevalo / BugLogHQ

BugLogHQ is a tool to centralize the handling of automated bug reports from multiple applications. BugLogHQ provides a unified view of error messages sent from any number of applications, allowing the developer to search, graph, forward, and explore the bug reports submitted by the applications.
http://www.bugloghq.com
155 stars 67 forks source link

Alerts not getting removed #133

Open KrunchMuffin opened 8 years ago

KrunchMuffin commented 8 years ago

For whatever reason, alerts are not being removed from page to page, or even same page on refresh. I don't know why this would have started. I haven't changed anything. Any ideas?

oarevalo commented 8 years ago

by alerts you mean the little confirmation messages that show up on the top?

KrunchMuffin commented 8 years ago

correct

oarevalo commented 8 years ago

Not sure what could it be, but I can tell you that those are controlled by in-memory cookies that are set server-side when the action occurs, and are forcibly expired when the alert is rendered.

https://github.com/oarevalo/BugLogHQ/blob/master/hq/includes/message.cfm#L17-L18

KrunchMuffin commented 8 years ago

definitely not getting removed. THis is ACF11 btw.

image

oarevalo commented 8 years ago

Maybe it is related to this bug: http://www.bennadel.com/blog/2975-coldfusion-11-will-not-accept-incoming-empty-cookie-values.htm https://bugbase.adobe.com/index.cfm?event=bug&id=4043038

Can you try deleting the cookie instead of expiring it?

This thread also talks about this issue: https://forums.adobe.com/thread/876889?start=0&tstart=0

KrunchMuffin commented 8 years ago

I have tried everything I can, and still nothing. image

image

oarevalo commented 8 years ago

the thread i linked on my last comment mentions to include the domain on the cfcookie, maybe that works?

KrunchMuffin commented 8 years ago

I tried that as well.

KrunchMuffin commented 8 years ago

in the setMessage fn, I even set an expire date of 1 min from Now(), but chrome still says session.

KrunchMuffin commented 8 years ago

ok, I think I got it working. Not sure if it's the best way, but... instead of assigning to msgstruct, I am using the cookie data. and I moved the cfcookie expires to the bottom of the page and also added a structdelete cookie for both.

oarevalo commented 8 years ago

interesting.. can you post your code here?

KrunchMuffin commented 8 years ago
<!--- This template displays a system message --->

<!--- This indicates how to find the images within the HTML --->
<cfset IMAGES_ROOT = "core/images">
<cfif isDefined("request.requestState._coreImagesPath")>
    <cfset IMAGES_ROOT = request.requestState._coreImagesPath>
</cfif>
<cfparam name="cookie.message_type" default="">
<cfparam name="cookie.message_text" default="">
<cfset msgStruct.type = cookie.message_type>
<cfset msgStruct.text = cookie.message_text>
<!--- <cfdump var="#msgStruct#" label="Msg Struct"> --->
<!--- expire cookies instead of just deleting them because of bluedragon compatibility,
seems that deleting from the cookie struct in BD does not actually erase the cookie --->
<!--- <cfcookie name="message_type" expires="now">
<cfcookie name="message_text" expires="now"> --->

<!--- Render Message --->
<cfif cookie.message_text neq "">
    <!--- Get image to display --->
    <cfif CompareNocase(cookie.message_type, "error") eq 0>
        <cfset img = "emsg.gif">
        <cfset extclass = "alert-error">
        <cfset autodismiss = false>
    <cfelseif CompareNocase(cookie.message_type, "warning") eq 0>
        <cfset img = "wmsg.gif">
        <cfset extclass = "">
        <cfset autodismiss = false>
    <cfelse>
        <cfset img = "cmsg.gif">
        <cfset extclass = "alert-success">
        <cfset autodismiss = true>
    </cfif>

    <cfoutput>
        <div class="alert #extclass#" id="alert">
            <a class="close" data-dismiss="alert">&times;</a>
            <img src="#IMAGES_ROOT#/#img#" align="absmiddle" alt="#cookie.message_type#"> #cookie.message_text#
        </div>
        <cfif autodismiss>
            <script type="text/javascript">__removeAlert = true;</script>
        </cfif>
    </cfoutput>
</cfif>
<cfcookie name="message_type" expires="now">
<cfcookie name="message_text" expires="now">
<cfset delete_cookie=StructDelete(cookie,"message_type")>
<cfset delete_cookie=StructDelete(cookie,"message_text")>