Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
a3cbf561
Commit
a3cbf561
authored
Sep 01, 2005
by
myk%mozilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partial fix for bug 302669: rewrites Attachment.pm to provide a real Attachment class; r=lpsolit
parent
a094f0eb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
39 deletions
+47
-39
Attachment.pm
Bugzilla/Attachment.pm
+0
-0
Bug.pm
Bugzilla/Bug.pm
+3
-1
Flag.pm
Bugzilla/Flag.pm
+29
-22
list.html.tmpl
template/en/default/attachment/list.html.tmpl
+6
-6
show.xml.tmpl
template/en/default/bug/show.xml.tmpl
+2
-2
filterexceptions.pl
template/en/default/filterexceptions.pl
+2
-2
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+5
-6
No files found.
Bugzilla/Attachment.pm
View file @
a3cbf561
This diff is collapsed.
Click to expand it.
Bugzilla/Bug.pm
View file @
a3cbf561
...
@@ -354,7 +354,9 @@ sub attachments {
...
@@ -354,7 +354,9 @@ sub attachments {
my
(
$self
)
=
@_
;
my
(
$self
)
=
@_
;
return
$self
->
{
'attachments'
}
if
exists
$self
->
{
'attachments'
};
return
$self
->
{
'attachments'
}
if
exists
$self
->
{
'attachments'
};
return
[]
if
$self
->
{
'error'
};
return
[]
if
$self
->
{
'error'
};
$self
->
{
'attachments'
}
=
Bugzilla::Attachment::
query
(
$self
->
{
bug_id
});
$self
->
{
'attachments'
}
=
Bugzilla::
Attachment
->
get_attachments_by_bug
(
$self
->
bug_id
);
return
$self
->
{
'attachments'
};
return
$self
->
{
'attachments'
};
}
}
...
...
Bugzilla/Flag.pm
View file @
a3cbf561
...
@@ -347,26 +347,26 @@ sub validate {
...
@@ -347,26 +347,26 @@ sub validate {
# can_see_bug() will refer to old settings.
# can_see_bug() will refer to old settings.
if
(
!
$requestee
->
can_see_bug
(
$bug_id
))
{
if
(
!
$requestee
->
can_see_bug
(
$bug_id
))
{
ThrowUserError
(
"flag_requestee_unauthorized"
,
ThrowUserError
(
"flag_requestee_unauthorized"
,
{
flag_type
=>
$flag
->
{
'type'
},
{
flag_type
=>
$flag
->
{
'type'
},
requestee
=>
$requestee
,
requestee
=>
$requestee
,
bug_id
=>
$bug_id
,
bug_id
=>
$bug_id
,
attach
_id
=>
attach
ment
=>
$flag
->
{
target
}
->
{
attachment
}
$flag
->
{
target
}
->
{
attachment
}
->
{
id
}
});
});
}
}
# Throw an error if the target is a private attachment and
# Throw an error if the target is a private attachment and
# the requestee isn't in the group of insiders who can see it.
# the requestee isn't in the group of insiders who can see it.
if
(
$flag
->
{
target
}
->
{
attachment
}
->
{
exists
}
if
(
$flag
->
{
target
}
->
{
attachment
}
&&
$cgi
->
param
(
'isprivate'
)
&&
$cgi
->
param
(
'isprivate'
)
&&
Param
(
"insidergroup"
)
&&
Param
(
"insidergroup"
)
&&
!
$requestee
->
in_group
(
Param
(
"insidergroup"
)))
&&
!
$requestee
->
in_group
(
Param
(
"insidergroup"
)))
{
{
ThrowUserError
(
"flag_requestee_unauthorized_attachment"
,
ThrowUserError
(
"flag_requestee_unauthorized_attachment"
,
{
flag_type
=>
$flag
->
{
'type'
},
{
flag_type
=>
$flag
->
{
'type'
},
requestee
=>
$requestee
,
requestee
=>
$requestee
,
bug_id
=>
$bug_id
,
bug_id
=>
$bug_id
,
attach
_id
=>
attach
ment
=>
$flag
->
{
target
}
->
{
attachment
}
$flag
->
{
target
}
->
{
attachment
}
->
{
id
}
});
});
}
}
}
}
}
}
...
@@ -532,7 +532,9 @@ sub create {
...
@@ -532,7 +532,9 @@ sub create {
$flag
->
{
'id'
}
=
(
&::
FetchOneColumn
()
||
0
)
+
1
;
$flag
->
{
'id'
}
=
(
&::
FetchOneColumn
()
||
0
)
+
1
;
# Insert a record for the flag into the flags table.
# Insert a record for the flag into the flags table.
my
$attach_id
=
$flag
->
{
'target'
}
->
{
'attachment'
}
->
{
'id'
}
||
"NULL"
;
my
$attach_id
=
$flag
->
{
target
}
->
{
attachment
}
?
$flag
->
{
target
}
->
{
attachment
}
->
{
id
}
:
"NULL"
;
my
$requestee_id
=
$flag
->
{
'requestee'
}
?
$flag
->
{
'requestee'
}
->
id
:
"NULL"
;
my
$requestee_id
=
$flag
->
{
'requestee'
}
?
$flag
->
{
'requestee'
}
->
id
:
"NULL"
;
&::
SendSQL
(
"INSERT INTO flags (id, type_id,
&::
SendSQL
(
"INSERT INTO flags (id, type_id,
bug_id, attach_id,
bug_id, attach_id,
...
@@ -807,7 +809,8 @@ sub FormToNewFlags {
...
@@ -807,7 +809,8 @@ sub FormToNewFlags {
{
'type_id'
=>
$type_id
,
{
'type_id'
=>
$type_id
,
'target_type'
=>
$target
->
{
'type'
},
'target_type'
=>
$target
->
{
'type'
},
'bug_id'
=>
$target
->
{
'bug'
}
->
{
'id'
},
'bug_id'
=>
$target
->
{
'bug'
}
->
{
'id'
},
'attach_id'
=>
$target
->
{
'attachment'
}
->
{
'id'
},
'attach_id'
=>
$target
->
{
'attachment'
}
?
$target
->
{
'attachment'
}
->
{
'id'
}
:
undef
,
'is_active'
=>
1
});
'is_active'
=>
1
});
# Do not create a new flag of this type if this flag type is
# Do not create a new flag of this type if this flag type is
...
@@ -902,15 +905,18 @@ sub get_target {
...
@@ -902,15 +905,18 @@ sub get_target {
my
$target
=
{
'exists'
=>
0
};
my
$target
=
{
'exists'
=>
0
};
if
(
$attach_id
)
{
if
(
$attach_id
)
{
$target
->
{
'attachment'
}
=
new
Bugzilla::
Attachmen
t
(
$attach_id
);
$target
->
{
'attachment'
}
=
Bugzilla::
Attachment
->
ge
t
(
$attach_id
);
if
(
$bug_id
)
{
if
(
$bug_id
)
{
# Make sure the bug and attachment IDs correspond to each other
# Make sure the bug and attachment IDs correspond to each other
# (i.e. this is the bug to which this attachment is attached).
# (i.e. this is the bug to which this attachment is attached).
$bug_id
==
$target
->
{
'attachment'
}
->
{
'bug_id'
}
if
(
!
$target
->
{
'attachment'
}
||
return
{
'exists'
=>
0
};
||
$target
->
{
'attachment'
}
->
{
'bug_id'
}
!=
$bug_id
)
{
return
{
'exists'
=>
0
};
}
}
}
$target
->
{
'bug'
}
=
GetBug
(
$
target
->
{
'attachment'
}
->
{
'bug_id'
}
);
$target
->
{
'bug'
}
=
GetBug
(
$
bug_id
);
$target
->
{
'exists'
}
=
$target
->
{
'attachment'
}
->
{
'exists'
}
;
$target
->
{
'exists'
}
=
1
;
$target
->
{
'type'
}
=
"attachment"
;
$target
->
{
'type'
}
=
"attachment"
;
}
}
elsif
(
$bug_id
)
{
elsif
(
$bug_id
)
{
...
@@ -937,20 +943,21 @@ Sends an email notification about a flag being created or fulfilled.
...
@@ -937,20 +943,21 @@ Sends an email notification about a flag being created or fulfilled.
sub
notify
{
sub
notify
{
my
(
$flag
,
$template_file
)
=
@_
;
my
(
$flag
,
$template_file
)
=
@_
;
my
$attachment_is_private
=
$flag
->
{
'target'
}
->
{
'attachment'
}
?
$flag
->
{
'target'
}
->
{
'attachment'
}
->
{
'isprivate'
}
:
undef
;
# If the target bug is restricted to one or more groups, then we need
# If the target bug is restricted to one or more groups, then we need
# to make sure we don't send email about it to unauthorized users
# to make sure we don't send email about it to unauthorized users
# on the request type's CC: list, so we have to trawl the list for users
# on the request type's CC: list, so we have to trawl the list for users
# not in those groups or email addresses that don't have an account.
# not in those groups or email addresses that don't have an account.
if
(
$flag
->
{
'target'
}
->
{
'bug'
}
->
{
'restricted'
}
if
(
$flag
->
{
'target'
}
->
{
'bug'
}
->
{
'restricted'
}
||
$attachment_is_private
)
{
||
$flag
->
{
'target'
}
->
{
'attachment'
}
->
{
'isprivate'
})
{
my
@new_cc_list
;
my
@new_cc_list
;
foreach
my
$cc
(
split
(
/[, ]+/
,
$flag
->
{
'type'
}
->
{
'cc_list'
}))
{
foreach
my
$cc
(
split
(
/[, ]+/
,
$flag
->
{
'type'
}
->
{
'cc_list'
}))
{
my
$ccuser
=
Bugzilla::
User
->
new_from_login
(
$cc
)
||
next
;
my
$ccuser
=
Bugzilla::
User
->
new_from_login
(
$cc
)
||
next
;
next
if
$flag
->
{
'target'
}
->
{
'bug'
}
->
{
'restricted'
}
next
if
$flag
->
{
'target'
}
->
{
'bug'
}
->
{
'restricted'
}
&&
!
$ccuser
->
can_see_bug
(
$flag
->
{
'target'
}
->
{
'bug'
}
->
{
'id'
});
&&
!
$ccuser
->
can_see_bug
(
$flag
->
{
'target'
}
->
{
'bug'
}
->
{
'id'
});
next
if
$
flag
->
{
'target'
}
->
{
'attachment'
}
->
{
'isprivate'
}
next
if
$
attachment_is_private
&&
Param
(
"insidergroup"
)
&&
Param
(
"insidergroup"
)
&&
!
$ccuser
->
in_group
(
Param
(
"insidergroup"
));
&&
!
$ccuser
->
in_group
(
Param
(
"insidergroup"
));
push
(
@new_cc_list
,
$cc
);
push
(
@new_cc_list
,
$cc
);
...
...
template/en/default/attachment/list.html.tmpl
View file @
a3cbf561
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
[% IF !attachment.isprivate || canseeprivate %]
[% IF !attachment.isprivate || canseeprivate %]
<tr [% "class=\"bz_private\"" IF attachment.isprivate %]>
<tr [% "class=\"bz_private\"" IF attachment.isprivate %]>
<td valign="top">
<td valign="top">
<a href="attachment.cgi?id=[% attachment.
attach
id %]">[% attachment.description FILTER html FILTER obsolete(attachment.isobsolete) %]</a>
<a href="attachment.cgi?id=[% attachment.id %]">[% attachment.description FILTER html FILTER obsolete(attachment.isobsolete) %]</a>
</td>
</td>
<td valign="top">
<td valign="top">
...
@@ -49,11 +49,11 @@
...
@@ -49,11 +49,11 @@
</td>
</td>
<td valign="top">
<td valign="top">
<a href="mailto:[% attachment.
submitt
er.email FILTER html %]">
<a href="mailto:[% attachment.
attach
er.email FILTER html %]">
[% attachment.
submitter.name || attachment.submitt
er.login FILTER html %]
[% attachment.
attacher.name || attachment.attach
er.login FILTER html %]
</a>
</a>
</td>
</td>
<td valign="top">[% attachment.
date
FILTER time %]</td>
<td valign="top">[% attachment.
attached
FILTER time %]</td>
<td valign="top">[% attachment.datasize FILTER unitconvert %]</td>
<td valign="top">[% attachment.datasize FILTER unitconvert %]</td>
[% IF show_attachment_flags %]
[% IF show_attachment_flags %]
...
@@ -75,9 +75,9 @@
...
@@ -75,9 +75,9 @@
[% END %]
[% END %]
<td valign="top">
<td valign="top">
<a href="attachment.cgi?id=[% attachment.
attach
id %]&action=edit">Edit</a>
<a href="attachment.cgi?id=[% attachment.id %]&action=edit">Edit</a>
[% IF attachment.ispatch && patchviewerinstalled %]
[% IF attachment.ispatch && patchviewerinstalled %]
| <a href="attachment.cgi?id=[% attachment.
attach
id %]&action=diff">Diff</a>
| <a href="attachment.cgi?id=[% attachment.id %]&action=diff">Diff</a>
[% END %]
[% END %]
[% Hook.process("action") %]
[% Hook.process("action") %]
</td>
</td>
...
...
template/en/default/bug/show.xml.tmpl
View file @
a3cbf561
...
@@ -73,8 +73,8 @@
...
@@ -73,8 +73,8 @@
ispatch="1"
ispatch="1"
[% END %]
[% END %]
>
>
<attachid>[% a.
attach
id %]</attachid>
<attachid>[% a.id %]</attachid>
<date>[% a.
date
FILTER time FILTER xml %]</date>
<date>[% a.
attached
FILTER time FILTER xml %]</date>
<desc>[% a.description FILTER xml %]</desc>
<desc>[% a.description FILTER xml %]</desc>
<ctype>[% a.contenttype FILTER xml %]</ctype>
<ctype>[% a.contenttype FILTER xml %]</ctype>
[% FOREACH flag = a.flags %]
[% FOREACH flag = a.flags %]
...
...
template/en/default/filterexceptions.pl
View file @
a3cbf561
...
@@ -368,7 +368,7 @@
...
@@ -368,7 +368,7 @@
'bug/show.xml.tmpl'
=>
[
'bug/show.xml.tmpl'
=>
[
'VERSION'
,
'VERSION'
,
'a.
attach
id'
,
'a.id'
,
'field'
,
'field'
,
],
],
...
@@ -458,7 +458,7 @@
...
@@ -458,7 +458,7 @@
],
],
'attachment/list.html.tmpl'
=>
[
'attachment/list.html.tmpl'
=>
[
'attachment.
attach
id'
,
'attachment.id'
,
'flag.status'
,
'flag.status'
,
'bugid'
,
'bugid'
,
],
],
...
...
template/en/default/global/user-error.html.tmpl
View file @
a3cbf561
...
@@ -442,7 +442,7 @@
...
@@ -442,7 +442,7 @@
You asked [% requestee.identity FILTER html %]
You asked [% requestee.identity FILTER html %]
for <code>[% flag_type.name FILTER html %]</code> on [% terms.bug %]
for <code>[% flag_type.name FILTER html %]</code> on [% terms.bug %]
[% bug_id FILTER html -%]
[% bug_id FILTER html -%]
[% IF attach
_id %], attachment [% attach_
id FILTER html %][% END %],
[% IF attach
ment %], attachment [% attachment.
id FILTER html %][% END %],
but that [% terms.bug %] has been restricted to users in certain groups,
but that [% terms.bug %] has been restricted to users in certain groups,
and the user you asked isn't in all the groups to which
and the user you asked isn't in all the groups to which
the [% terms.bug %] has been restricted.
the [% terms.bug %] has been restricted.
...
@@ -455,11 +455,10 @@
...
@@ -455,11 +455,10 @@
You asked [% requestee.identity FILTER html %]
You asked [% requestee.identity FILTER html %]
for <code>[% flag_type.name FILTER html %]</code> on
for <code>[% flag_type.name FILTER html %]</code> on
[%+ terms.bug %] [%+ bug_id FILTER html %],
[%+ terms.bug %] [%+ bug_id FILTER html %],
attachment [% attach_id FILTER html %], but that attachment is restricted
attachment [% attachment.id FILTER html %], but that attachment
to users
is restricted to users in the [% Param("insidergroup") FILTER html %] group,
in the [% Param("insidergroup") FILTER html %] group, and the user
and the user you asked isn't in that group. Please choose someone else
you asked isn't in that group. Please choose someone else to ask,
to ask, or ask an administrator to add the user to the group.
or ask an administrator to add the user to the group.
[% ELSIF error == "flag_type_cc_list_invalid" %]
[% ELSIF error == "flag_type_cc_list_invalid" %]
[% title = "Flag Type CC List Invalid" %]
[% title = "Flag Type CC List Invalid" %]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment