ssafronova (ssafronova) wrote in changelog,
ssafronova
ssafronova
changelog

[livejournal] r18477: LJSUP-8080: Add "Only for Office" string...

Committer: ssafronova
LJSUP-8080: Add "Only for Office" string to system message
U   trunk/cgi-bin/LJ/SiteMessages.pm
U   trunk/cgi-bin/LJ/Widget/SiteMessages.pm
Modified: trunk/cgi-bin/LJ/SiteMessages.pm
===================================================================
--- trunk/cgi-bin/LJ/SiteMessages.pm	2011-03-04 07:47:28 UTC (rev 18476)
+++ trunk/cgi-bin/LJ/SiteMessages.pm	2011-03-04 07:52:16 UTC (rev 18477)
@@ -173,6 +173,14 @@
     return grep { $_->{accounts} & $coded } @questions;
 }
 
+sub is_office_only {
+    my $class = shift;
+    my $message = shift;
+
+    # +0 is important for doing integer bitwise operation, opposite to string operation
+    return ($message->{accounts}+0) & AccountMask->{OfficeOnly};
+}
+
 sub get_messages {
     my $class = shift;
     my %opts = @_;

Modified: trunk/cgi-bin/LJ/Widget/SiteMessages.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/SiteMessages.pm	2011-03-04 07:47:28 UTC (rev 18476)
+++ trunk/cgi-bin/LJ/Widget/SiteMessages.pm	2011-03-04 07:52:16 UTC (rev 18477)
@@ -25,11 +25,13 @@
     ## <lj user> tags and lj-sys-message-close attributes
     LJ::CleanHTML::clean_event(\$text, { 'lj_sys_message_id' => $mid });
 
+    my $is_office = LJ::SiteMessages->is_office_only($message) ? '<b>[Only for office]</b> ' : '';
+
     return 
         "<p class='b-message b-message-suggestion b-message-system'>" .
         "<span class='b-message-wrap'>" .
         "<img width='16' height='14' alt='' src='$LJ::IMGPREFIX/message-system-alert.gif' />" .
-        $text .
+        $is_office . $text .
         "</span></p>";
 }
 

Tags: livejournal, pm, ssafronova
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments